Skip to content

Commit

Permalink
chore: Add comment, replace view with advice
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Aug 19, 2024
1 parent d952137 commit 36854b8
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def untraced_request?(env)
false
end

# TODO: This one is long because I wanted to keep the stable semantic
# conventions, and (for now) emit attributes that matched the span
def record_http_server_request_duration_metric(span)
return unless metrics_enabled? && http_server_duration_histogram

Expand All @@ -169,7 +171,7 @@ def record_http_server_request_duration_metric(span)
attrs = {}
# pattern below goes
# stable convention
# current span convention
# attribute that matches rack spans (old convention)

# attrs['http.request.method']
attrs['http.method'] = span.attributes['http.method']
Expand Down Expand Up @@ -298,14 +300,8 @@ def meter
end

def http_server_duration_histogram
# only want to make the view and the histogram once
# OpenTelemetry.meter_provider.add_view(
# 'http.server.request.duration',
# aggregation: OpenTelemetry::SDK::Metrics::Aggregation::ExplicitBucketHistogram.new(
# boundaries: [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10]
# )
# )
# Meter might be nil if metrics API isn't installed or isn't configured to send data
# Only want to make the histogram once
# Need to implement advice so we can update the buckets to match seconds instead of ms
return @http_server_duration_histogram if defined?(@http_server_duration_histogram)

@http_server_duration_histogram = nil unless meter
Expand Down

0 comments on commit 36854b8

Please sign in to comment.