-
Notifications
You must be signed in to change notification settings - Fork 772
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
Otlp Retry Part1 - Refactor ExportClients #5335
Otlp Retry Part1 - Refactor ExportClients #5335
Conversation
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.
LGTM
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.
LGTM.
Tests are missing for few of the properties in ExportClientResponse
. Are you planning to cover in the follow up PRs?
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5335 +/- ##
==========================================
- Coverage 83.38% 82.87% -0.51%
==========================================
Files 297 276 -21
Lines 12531 12003 -528
==========================================
- Hits 10449 9948 -501
+ Misses 2082 2055 -27
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
👍
{ | ||
DateTime deadline = DateTime.UtcNow.AddMilliseconds(this.HttpClient.Timeout.TotalMilliseconds); |
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.
Why does this not use the timeout value from the OtlpExporterOptions?
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.
good point - It is because user can override it with their own HttpClient instance via HttpClientFactory. So using the timeout value from the client itself and not options.
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.
Do we have a way to detect if the user actually configured timeout through OtlpExporter options?
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.
No - even if they are not using custom client. We initialize default client using timeout value set via options.
opentelemetry-dotnet/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpExporterOptions.cs
Lines 82 to 88 in e4b08ac
this.HttpClientFactory = this.DefaultHttpClientFactory = () => | |
{ | |
return new HttpClient | |
{ | |
Timeout = TimeSpan.FromMilliseconds(this.TimeoutMilliseconds), | |
}; | |
}; |
So in both the cases we will have the correct deadline here.
Edit: In case of custom client, the timeout set within the client will take precedence over timeout set in options.
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.
It would be good to add this as a comment.
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.
Sure, I can add it in my next PR if thats ok.
Towards #1779 #4791
Design discussion issue #
Changes
This PR is part1 of multiple PRs which will bring retry functionality to otlp exporters in case of transient errors.
IExportClient
interface definition to return a custom response object. Response object will be either of typeExportClientHttpResponse
orExportClientGrpcResponse
based on the protocol used to send data i.e. http protobuf or grpc.OtlpExporterTransmissionHandler
class that was added in Add base class for implementing retry strategies in otlp exporter #4872. I plan to add an updated version of this in upcoming PRs.NOTE This PR does not change the existing functionality of otlp exporters. For further details on what will be upcoming changes, take a look at this POC #5311
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes