-
Notifications
You must be signed in to change notification settings - Fork 146
feat(trace-exporter): handle exceptions when creating Trace Exporter in TracerManager #6925
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
base: ganeshnj/feature/datapipeline-bindings
Are you sure you want to change the base?
feat(trace-exporter): handle exceptions when creating Trace Exporter in TracerManager #6925
Conversation
# Conflicts: # tracer/build/_build/Build.Steps.cs
…y service parameter
… and update Hostname assignment
# Conflicts: # tracer/test/Datadog.Trace.IntegrationTests/ContainerTaggingTests.cs
…tapipeline-bindings
* Updated the `libdatadog` package reference in both `Console.csproj` and `Datadog.Trace.csproj`. * Added the new package `libdatadog.60141209.0.0.nupkg`.
…or trace exporter
## Summary of changes I noticed that from the benchmark runs, there no telemetry events are being produced. We want to pass the same telemetry configs as we have in the Tracer to native side to be able to produce telemetry events. ## Reason for change There is no telemetry currently being produced for trace exporter. ## Implementation details * Introduced `TelemetryClientConfiguration` struct for telemetry settings. * Updated `TraceExporterConfiguration` to include telemetry configuration. * Added P/Invoke method `EnableTelemetry` in `NativeInterop` for enabling telemetry. ## Test coverage None ## Other details <!-- Fixes #{issue} --> <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
a496c90
to
603d4f4
Compare
603d4f4
to
d4e5171
Compare
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!
@@ -415,7 +415,7 @@ _ when x.ToBoolean() is { } boolean => boolean, | |||
|
|||
DataPipelineEnabled = config | |||
.WithKeys(ConfigurationKeys.TraceDataPipelineEnabled) | |||
.AsBool(defaultValue: true); | |||
.AsBool(defaultValue: false); |
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 you want to leave this as true
just for now, so that we keep testing the datapipeline-binding
branch with this enabled everywhere by default? I'm happy if you want to disable this now, but maybe it makes sense to move that to a separate tiny PR that we just merge at the last moment?
if (!error.IsInvalid) | ||
{ | ||
var ex = error.ToException(); | ||
_log.Error(ex, "An error occurred while sending data to the agent. Error Code: {ErrorCode}, message: {Message}", ex.ErrorCode, ex.Message); |
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 realise it's not a change from this PR, but I'm wondering if we should make a slight tweak here so that the ErrorCode
is properly embedded in the string instead of using structured logging 🤔 That way we will see the error code in telemetry (otherwise we will only see that an error did occur, not what it was). Given that we know the error code is just a number, it's "safe" to do
e.g. something like this:
_log.Error(ex, "An error occurred while sending data to the agent. Error Code: {ErrorCode}, message: {Message}", ex.ErrorCode, ex.Message); | |
_log.Error(ex, "An error occurred while sending data to the agent. Error Code: " + ex.ErrorCode.ToString(CultureInfo.InvariantCulture) + ", message: {Message}", ex.Message); |
We'd have to add a #pragma
to disable the linting rule that prevents you doing that, but might be worth it. WDYT?
_log.Error(ex, "An error occurred while sending data to the agent. Error Code: {ErrorCode}, message: {Message}", ex.ErrorCode, ex.Message); | ||
throw ex; | ||
using var error = NativeInterop.Exporter.Send(this, tracesSlice, (UIntPtr)numberOfTraces, ref responsePtr); | ||
if (!error.IsInvalid) |
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 still find this so confusing 😅 error.IsInvalid
means there wasn't an error?!
15af3ce
to
34cbacb
Compare
34cbacb
to
89bc0ec
Compare
/// <param name="str">The string to copy into memory.</param> | ||
internal CharSlice(string? str) | ||
{ | ||
if (str == null) |
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 (str == null) | |
if (string.IsNullOrEmpty(str)) |
Summary of changes
Guard against library API or load failures.
Reason for change
We don't want to just fail but fallback on managed trace exporter.
Implementation details
Test coverage
Other details