Skip to content

Commit

Permalink
Use semantic convention for code function label
Browse files Browse the repository at this point in the history
  • Loading branch information
plantfansam committed Jan 17, 2024
1 parent fec17cf commit 03fb66c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', context: 'on_finish')
report_dropped_spans(n, reason => 'buffer-full', OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => 'on_finish')
end
spans << span
@condition.signal if spans.size > batch_size
Expand Down Expand Up @@ -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', context: 'force_flush')
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
Expand Down Expand Up @@ -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 = {})
@metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: count, labels: labels)
end

def fetch_batch
Expand Down

0 comments on commit 03fb66c

Please sign in to comment.