Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/dogstatsd/src/datadog/shipping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl DdApi {

/// Ship a serialized series to the API, blocking
pub async fn ship_series(&self, series: &Series) -> Result<Response, ShippingError> {
let url = format!("{}/api/v2/series", &self.metrics_intake_url_prefix);
let url = format!("{}/api/v2/series", self.metrics_intake_url_prefix);
let safe_body = serde_json::to_vec(&series)
.map_err(|e| ShippingError::Payload(format!("Failed to serialize series: {e}")))?;
trace!("Sending body: {:?}", &series);
Expand All @@ -54,10 +54,10 @@ impl DdApi {
&self,
sketches: &SketchPayload,
) -> Result<Response, ShippingError> {
let url = format!("{}/api/beta/sketches", &self.metrics_intake_url_prefix);
let url = format!("{}/api/beta/sketches", self.metrics_intake_url_prefix);
let safe_body = sketches
.write_to_bytes()
.map_err(|e| ShippingError::Payload(format!("Failed to serialize series: {e}")))?;
.map_err(|e| ShippingError::Payload(format!("Failed to serialize sketches: {e}")))?;
trace!("Sending distributions: {:?}", &sketches);
self.ship_data(url, safe_body, "application/x-protobuf")
.await
Expand Down
5 changes: 2 additions & 3 deletions crates/dogstatsd/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ pub fn parse_metric_namespace(namespace: &str) -> Option<String> {
let mut chars = trimmed.chars();

// Check first character is a letter
if let Some(first_char) = chars.next() {
{
let first_char = chars.next()?;
if !first_char.is_ascii_alphabetic() {
tracing::error!(
"DD_STATSD_METRIC_NAMESPACE must start with a letter, got: '{}'. Ignoring namespace.",
trimmed
);
return None;
}
} else {
return None;
}

// Check remaining characters are valid (alphanumeric, underscore, or period)
Expand Down
Loading