-
Notifications
You must be signed in to change notification settings - Fork 785
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
Merged
utpilla
merged 7 commits into
open-telemetry:main
from
vishweshbankwar:vibankwa/otlp-retry-part1-client-refactor
Feb 16, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
890115b
otlp export client refactor to enable retries
2b5f5f6
refactor
5fb05a6
fix
52b20b0
Merge branch 'main' into vibankwa/otlp-retry-part1-client-refactor
vishweshbankwar a5ea051
Merge branch 'main' into vibankwa/otlp-retry-part1-client-refactor
vishweshbankwar 95e16aa
Merge branch 'main' into vibankwa/otlp-retry-part1-client-refactor
vishweshbankwar 56fc828
Merge branch 'main' into vibankwa/otlp-retry-part1-client-refactor
vishweshbankwar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/ExportClientGrpcResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#nullable enable | ||
|
||
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient; | ||
|
||
internal sealed class ExportClientGrpcResponse : ExportClientResponse | ||
{ | ||
public ExportClientGrpcResponse( | ||
bool success, | ||
DateTime? deadlineUtc, | ||
Exception? exception) | ||
: base(success, deadlineUtc, exception) | ||
{ | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/ExportClientHttpResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#nullable enable | ||
|
||
using System.Net; | ||
#if NETFRAMEWORK | ||
using System.Net.Http; | ||
#endif | ||
using System.Net.Http.Headers; | ||
|
||
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient; | ||
|
||
internal sealed class ExportClientHttpResponse : ExportClientResponse | ||
{ | ||
public ExportClientHttpResponse( | ||
bool success, | ||
DateTime? deadlineUtc, | ||
HttpResponseMessage? response, | ||
Exception? exception) | ||
: base(success, deadlineUtc, exception) | ||
{ | ||
this.Headers = response?.Headers; | ||
this.StatusCode = response?.StatusCode; | ||
} | ||
|
||
public HttpResponseHeaders? Headers { get; } | ||
|
||
public HttpStatusCode? StatusCode { get; } | ||
} |
22 changes: 22 additions & 0 deletions
22
...emetry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/ExportClientResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#nullable enable | ||
|
||
namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient; | ||
|
||
internal abstract class ExportClientResponse | ||
{ | ||
protected ExportClientResponse(bool success, DateTime? deadlineUtc, Exception? exception) | ||
{ | ||
this.Success = success; | ||
this.Exception = exception; | ||
this.DeadlineUtc = deadlineUtc; | ||
} | ||
|
||
public bool Success { get; } | ||
|
||
public Exception? Exception { get; } | ||
|
||
public DateTime? DeadlineUtc { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 0 additions & 76 deletions
76
...ry.Exporter.OpenTelemetryProtocol/Implementation/Retry/OtlpExporterTransmissionHandler.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.