Skip to content

Commit

Permalink
Solve comments.
Browse files Browse the repository at this point in the history
* Avoid sending tags for submitted_payloads, active_sessions and
  memory_usage.
* Comment code managing trace_api_bytes as there is no suppor it.
* Add status code to HTTP error logs.
* Define constants for for literals.
* Replace 'trace-chunk-*' for 'trace-chunks-*.
  • Loading branch information
hoolioh committed May 30, 2024
1 parent bf33702 commit 19ca4c1
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions sidecar/src/self_telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ struct MetricData<'a> {
trace_api_requests: ContextKey,
trace_api_responses: ContextKey,
trace_api_errors: ContextKey,
trace_api_bytes: ContextKey,
trace_chunk_sent: ContextKey,
trace_chunk_dropped: ContextKey,
// TODO: APMSP-1157 - Enable this metric when support is enabled.
// trace_api_bytes: ContextKey,
trace_chunks_sent: ContextKey,
trace_chunks_dropped: ContextKey,
}
impl<'a> MetricData<'a> {
async fn send(&self, key: ContextKey, value: f64, tags: Vec<Tag>) {
Expand Down Expand Up @@ -111,23 +112,24 @@ impl<'a> MetricData<'a> {
],
));
}
if trace_metrics.bytes_sent > 0 {
futures.push(self.send(
self.trace_api_bytes,
trace_metrics.bytes_sent as f64,
vec![Tag::new("src_library", "libdatadog").unwrap()],
));
}
// TODO: APMSP-1157 - Enable this metric when support is enabled.
// if trace_metrics.bytes_sent > 0 {
// futures.push(self.send(
// self.trace_api_bytes,
// trace_metrics.bytes_sent as f64,
// vec![Tag::new("src_library", "libdatadog").unwrap()],
// ));
// }
if trace_metrics.chunks_sent > 0 {
futures.push(self.send(
self.trace_chunk_sent,
self.trace_chunks_sent,
trace_metrics.chunks_sent as f64,
vec![Tag::new("src_library", "libdatadog").unwrap()],
));
}
if trace_metrics.chunks_dropped > 0 {
futures.push(self.send(
self.trace_chunk_dropped,
self.trace_chunks_dropped,
trace_metrics.chunks_dropped as f64,
vec![Tag::new("src_library", "libdatadog").unwrap()],
));
Expand Down Expand Up @@ -256,22 +258,23 @@ impl SelfTelemetry {
true,
MetricNamespace::Tracers,
),
trace_api_bytes: worker.register_metric_context(
"trace_api_bytes".to_string(),
vec![],
MetricType::Count,
true,
MetricNamespace::Tracers,
),
trace_chunk_sent: worker.register_metric_context(
"trace_chunk_sent".to_string(),
// TODO: APMSP-1157 - Enable this metric when support is enabled.
// trace_api_bytes: worker.register_metric_context(
// "trace_api_bytes".to_string(),
// vec![],
// MetricType::Distribution,
// true,
// MetricNamespace::Tracers,
// ),
trace_chunks_sent: worker.register_metric_context(
"trace_chunks_sent".to_string(),
vec![],
MetricType::Count,
true,
MetricNamespace::Tracers,
),
trace_chunk_dropped: worker.register_metric_context(
"trace_chunk_dropped".to_string(),
trace_chunks_dropped: worker.register_metric_context(
"trace_chunks_dropped".to_string(),
vec![],
MetricType::Count,
true,
Expand Down

0 comments on commit 19ca4c1

Please sign in to comment.