-
Notifications
You must be signed in to change notification settings - Fork 231
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
Record stats for serialization time #1628
Changes from 1 commit
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 |
---|---|---|
|
@@ -382,6 +382,17 @@ | |
_(result).must_equal(SUCCESS) | ||
end | ||
|
||
it 'records metrics' do | ||
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. Instead of mocking the metrics reporter, we could move |
||
metrics_reporter = Minitest::Mock.new | ||
exporter = OpenTelemetry::Exporter::OTLP::Exporter.new(metrics_reporter: metrics_reporter) | ||
stub_request(:post, 'http://localhost:4318/v1/traces').to_timeout.then.to_return(status: 200) | ||
metrics_reporter.expect(:record_value, nil) { |m, _, _| m == 'otel.otlp_exporter.encode_duration' } | ||
metrics_reporter.expect(:record_value, nil) { |m, _, _| m == 'otel.otlp_exporter.message.uncompressed_size' } | ||
metrics_reporter.expect(:record_value, nil) { |m, _, _| m == 'otel.otlp_exporter.message.compressed_size' } | ||
metrics_reporter.expect(:add_to_counter, nil) { |m, _, _| m == 'otel.otlp_exporter.failure' } | ||
exporter.export([OpenTelemetry::TestHelpers.create_span_data]) | ||
end | ||
|
||
it 'retries on timeout' do | ||
stub_request(:post, 'http://localhost:4318/v1/traces').to_timeout.then.to_return(status: 200) | ||
span_data = OpenTelemetry::TestHelpers.create_span_data | ||
|
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.
How would y'all feel about adding a helper that accepts a block:
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.
If we do this one more time, it's worth a refactor. I am not super keen on the block-based approach if all our callsites are full methods. I think I'd prefer:
over:
simply because it avoids deeper indentation as we add instrumentation to existing methods. The latter is better for measurements of small chunks of code within a larger method.