-
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 Part2 - Introduce transmission handler #5367
Otlp Retry Part2 - Introduce transmission handler #5367
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5367 +/- ##
==========================================
- Coverage 83.38% 83.27% -0.11%
==========================================
Files 297 279 -18
Lines 12531 11961 -570
==========================================
- Hits 10449 9961 -488
+ Misses 2082 2000 -82
Flags with carried forward coverage won't be shown. Click here to find out more.
|
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpTraceExporter.cs
Outdated
Show resolved
Hide resolved
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
/// </summary> | ||
/// <param name="request">The request that was attempted to send to the server.</param> | ||
/// <returns><see cref="ExportClientResponse"/>.</returns> | ||
protected ExportClientResponse RetryRequest(TRequest request) |
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 need to be a method of its own? A transmission handler could simply override OnSubmitRequestFailure
to implement this logic.
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.
This is a common method that can be used by implementations. OnSubmitRequestFailure
would call this method along with other logic.
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.
Should we rename this TryRetryRequest
now that we have TrySubmitRequest
? Both have similar mechanics this one just returns more details.
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.
done
…rter.cs Co-authored-by: Utkarsh Umesan Pillai <66651184+utpilla@users.noreply.github.com>
...metry.Exporter.OpenTelemetryProtocol/Implementation/ExportClient/BaseOtlpHttpExportClient.cs
Outdated
Show resolved
Hide resolved
...ry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs
Outdated
Show resolved
Hide resolved
...ry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs
Outdated
Show resolved
Hide resolved
@@ -83,4 +92,13 @@ public void InvalidEnvironmentVariable(string key, string value) | |||
{ | |||
this.WriteEvent(11, key, value); | |||
} | |||
|
|||
#if NET6_0_OR_GREATER | |||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")] |
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 is this suppression only required for this event?
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.
I was discussing the same with @Yun-Ting offline. AOT compatibility test fails without this. We have this in few other places too like
opentelemetry-dotnet/src/OpenTelemetry/Internal/OpenTelemetrySdkEventSource.cs
Lines 208 to 221 in 5bcc805
#if NET6_0_OR_GREATER | |
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")] | |
#endif | |
[Event(32, Message = "'{0}' exporting to '{1}' dropped '{2}' item(s) due to buffer full.", Level = EventLevel.Warning)] | |
public void ExistsDroppedExportProcessorItems(string exportProcessorName, string exporterName, long droppedCount) | |
{ | |
this.WriteEvent(32, exportProcessorName, exporterName, droppedCount); | |
} | |
#if NET6_0_OR_GREATER | |
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")] | |
#endif | |
[Event(33, Message = "Measurements from Instrument '{0}', Meter '{1}' will be ignored. Reason: '{2}'. Suggested action: '{3}'", Level = EventLevel.Warning)] | |
public void MetricInstrumentIgnored(string instrumentName, string meterName, string reason, string fix) |
@Yun-Ting - Could you please open an issue to investigate this?
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.
The suppression is safe to remove.
The example above doing...
this.WriteEvent(32, exportProcessorName, exporterName, droppedCount);
That is calling https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.tracing.eventsource.writeevent?view=net-8.0#system-diagnostics-tracing-eventsource-writeevent(system-int32-system-diagnostics-tracing-eventsource-eventsourceprimitive()) which is decorated like this:
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
Justification = EventSourceSuppressMessage)]
protected void WriteEvent(int eventId, params EventSourcePrimitive[] args)
This method here is just going to call https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.tracing.eventsource.writeevent?view=net-8.0#system-diagnostics-tracing-eventsource-writeevent(system-int32-system-string) which should be fine.
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.
There are two methods in the example above using suppressiom. one of them does not use https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.tracing.eventsource.writeevent?view=net-8.0#system-diagnostics-tracing-eventsource-writeevent(system-int32-system-diagnostics-tracing-eventsource-eventsourceprimitive()) and that one is also decorated.
Removed: But see this from previous PR
I was able to fix it only by adding the suppression. So something has changed at runtime level.
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.
Can you link me to the one you found with UnconditionalSuppressMessage
not using that params
form of WriteEvent
? I'm looking around but not finding it. Mostly I'm just curious to try and figure out what's going on 😄
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Show resolved
Hide resolved
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
...xporter.OpenTelemetryProtocol/Implementation/Transmission/OtlpExporterTransmissionHandler.cs
Outdated
Show resolved
Hide resolved
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.
One suggestion/comment but LGTM
…thub.com/vishweshbankwar/opentelemetry-dotnet into vibankwa/otlp-retry-implementation-part2
Towards #1779 #4791
Changes
This is part2 which introduces a
OtlpExporterTransmissionHandler<T>
class. This class will be used as a base class to implement retry strategies (i.e. InMemory and PersistentStorage).NOTE This PR does not change the existing functionality of otlp exporters. Actual retry strategies will be implemented in follow up PRs, for details take a look at this POC #5311
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes