Skip to content

Commit 9cf047b

Browse files
committed
Add durable function tag for enhanced metrics
1 parent afbc9f2 commit 9cf047b

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

bottlecap/src/flushing/service.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ impl FlushingService {
9898
let series = flush_response.series;
9999
let sketches = flush_response.distributions;
100100

101+
debug!(
102+
"FLUSHING_SERVICE | flushing {} series batch(es) and {} sketch batch(es)",
103+
series.len(),
104+
sketches.len()
105+
);
106+
for (i, sketch_payload) in sketches.iter().enumerate() {
107+
for sketch in &sketch_payload.sketches {
108+
debug!(
109+
"FLUSHING_SERVICE | sketch batch[{}]: metric='{}' tags={:?}",
110+
i,
111+
sketch.metric,
112+
sketch.tags
113+
);
114+
}
115+
}
116+
101117
for (idx, flusher) in self.metrics_flushers.iter().enumerate() {
102118
let flusher = flusher.clone();
103119
let series_clone = series.clone();

bottlecap/src/lifecycle/invocation/processor.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,18 @@ impl Processor {
285285
/// This is used to create a cold start span, since this telemetry event does not
286286
/// provide a `request_id`, we try to guess which invocation is the cold start.
287287
pub fn on_platform_init_start(&mut self, time: DateTime<Utc>, runtime_version: Option<String>) {
288+
debug!(
289+
"PlatformInitStart received: runtime_version={:?}",
290+
runtime_version
291+
);
288292
if runtime_version
289293
.as_deref()
290294
.is_some_and(|rv| rv.contains("DurableFunction"))
291295
{
296+
debug!("DurableFunction detected in runtime_version, setting durable_function:true tag on enhanced metrics");
292297
self.enhanced_metrics.set_durable_function_tag();
298+
} else {
299+
debug!("runtime_version does not contain 'DurableFunction', skipping durable_function tag");
293300
}
294301
let start_time: i64 = SystemTime::from(time)
295302
.duration_since(UNIX_EPOCH)

bottlecap/src/metrics/enhanced/lambda.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@ impl Lambda {
6363

6464
/// Sets the `durable_function:true` tag in `dynamic_value_tags`
6565
pub fn set_durable_function_tag(&mut self) {
66+
debug!("Enhanced metrics: inserting durable_function:true into dynamic_value_tags");
6667
self.dynamic_value_tags
6768
.insert(String::from("durable_function"), String::from("true"));
69+
debug!(
70+
"Enhanced metrics: dynamic_value_tags after set_durable_function_tag: {:?}",
71+
self.dynamic_value_tags
72+
);
6873
}
6974

7075
fn get_dynamic_value_tags(&self) -> Option<SortedTags> {
@@ -76,6 +81,11 @@ impl Lambda {
7681

7782
let string_tags = vec_tags.join(",");
7883

84+
debug!(
85+
"Enhanced metrics: get_dynamic_value_tags returning tag string: {:?}",
86+
string_tags
87+
);
88+
7989
SortedTags::parse(&string_tags).ok()
8090
}
8191

@@ -152,10 +162,15 @@ impl Lambda {
152162
if !self.config.enhanced_metrics {
153163
return;
154164
}
165+
debug!(
166+
"Enhanced metrics: creating metric '{}' with dynamic_value_tags: {:?}",
167+
metric_name, self.dynamic_value_tags
168+
);
169+
let tags = self.get_dynamic_value_tags();
155170
let metric = Metric::new(
156171
metric_name.into(),
157172
MetricValue::distribution(1f64),
158-
self.get_dynamic_value_tags(),
173+
tags,
159174
Some(timestamp),
160175
);
161176
if let Err(e) = self.aggr_handle.insert_batch(vec![metric]) {

0 commit comments

Comments
 (0)