-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add context to metrics reporting of buffer-full events #1566
Changes from 3 commits
ee810ca
fec17cf
03fb66c
dfab14e
452f96a
bc427b7
68fe040
6a3c754
6b17880
40e5e89
e5166d2
ae04ce1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ def on_finish(span) | |
n = spans.size + 1 - max_queue_size | ||
if n.positive? | ||
spans.shift(n) | ||
report_dropped_spans(n, reason: 'buffer-full') | ||
report_dropped_spans(n, reason => 'buffer-full', OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => 'on_finish') | ||
end | ||
spans << span | ||
@condition.signal if spans.size > batch_size | ||
|
@@ -123,7 +123,7 @@ def force_flush(timeout: nil) # rubocop:disable Metrics/MethodLength | |
n = spans.size + snapshot.size - max_queue_size | ||
if n.positive? | ||
snapshot.shift(n) | ||
report_dropped_spans(n, reason: 'buffer-full') | ||
report_dropped_spans(n, reason => 'buffer-full', OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => 'force_flush') | ||
end | ||
spans.unshift(snapshot) unless snapshot.empty? | ||
@condition.signal if spans.size > max_queue_size / 2 | ||
|
@@ -204,8 +204,8 @@ def report_result(result_code, batch) | |
end | ||
end | ||
|
||
def report_dropped_spans(count, reason:) | ||
@metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: count, labels: { 'reason' => reason }) | ||
def report_dropped_spans(count, labels = {}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although I changed the method signature, we do not need to change other call sites for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'd rather we used named arguments consistently, and Strings for keys and values in the labels. I.e. I'd prefer: def report_dropped_spans(count, labels: nil) ... end
report_dropped_spans(n, labels: { 'reason' => 'buffer-full', 'code.function' => 'force_flush' }) or: def report_dropped_spans(count, reason:, function: nil)
@metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: count, labels: { 'reason' => reason, 'code.function' => function }.compact)
end
report_dropped_spans(n, reason: 'buffer-full', function: 'force_flush') I prefer the latter, since it is cleaner for callers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, let's do the latter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
@metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: count, labels: labels) | ||
end | ||
|
||
def fetch_batch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to use hash rocket syntax to have constant as key (afaik)