Skip to content
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

Spammed by 'read-result-set-header' traces in application insights #1524

Open
Tobbeman opened this issue Nov 22, 2024 · 9 comments
Open

Spammed by 'read-result-set-header' traces in application insights #1524

Tobbeman opened this issue Nov 22, 2024 · 9 comments

Comments

@Tobbeman
Copy link

Is your feature request related to a problem? Please describe.
Disclaimer; Still learning how to use OpenTelemetry

We recently added OpenTelemetry to our application as well as MySqlConnector as source
Sadly, we are spammed by traces with the message "read-result-set-header".

These seem to be created here

As a result our application insights are filled:
image

Note that all the "traces" are the message in question.

I have not found anyway to filter these, though I might simply be overlooking something

Describe the solution you'd like
These traces add little value as far as I can tell, I would like to be able to turn them off.
Perhaps we can add a option to do so?

I'm happy to take a crack at it.

Note: If it is possible to filter these, that would also help me. Currently our filter looks like this and I am unable to change the Events associated with the activity ( read only ):

internal class FilterProcessor : BaseProcessor<Activity>
{
    public override void OnStart(Activity activity)
    {
        FilterPomeloMySqlConnector(activity);
    }

    void FilterPomeloMySqlConnector(Activity activity) 
    {
        if (activity.Source.Name != "MySqlConnector") {
            return;
        }

        if (activity.DisplayName == "Open")
        {
            activity.IsAllDataRequested = false;
        }
    }
}
@bgrainger
Copy link
Member

How are you feeding the Activity events into Application Insights?

"Trace" is supposed to be used for logs; see the data model documentation: https://learn.microsoft.com/en-us/azure/azure-monitor/app/data-model-complete

MySqlConnector is calling Activity.AddEvent for this telemetry. That seems like it would be better modeled as an "Event" in Application Insights (or just dropped). I would look into how and why your code is converting events into traces.

@vanbukin
Copy link

I see something similar.

MySqlConnector 2.4.0
.NET SDK 8.0.404
.NET Runtime 8.0.11
OpenTelemetry 1.10.0
Jaeger 2.0.0
screencapture-localhost-16686-trace-af868dd767c81485f8ab3f43c20c9ff7-2024-11-25-02_31_56

@Tobbeman
Copy link
Author

Tobbeman commented Nov 25, 2024

@bgrainger

How are you feeding the Activity events into Application Insights?

"Trace" is supposed to be used for logs; see the data model documentation: https://learn.microsoft.com/en-us/azure/azure-monitor/app/data-model-complete

MySqlConnector is calling Activity.AddEvent for this telemetry. That seems like it would be better modeled as an "Event" in Application Insights (or just dropped). I would look into how and why your code is converting events into traces.

That makes sense to me, but as far as I can tell I don't do anything special

 builder.Services.AddOpenTelemetry()
            .UseAzureMonitor(options =>
            {
                options.ConnectionString = config.ConnectionString;
                options.SamplingRatio = config.SamplingRate;
            })
            // TL: Enable telemetry for Pomelo. Pomelo uses MySqlConnector: https://mysqlconnector.net/diagnostics/tracing/
            // Do not be fooled by MySql.Data
            .WithTracing(b => b.AddSource("MySqlConnector")
            );

That said, this could very much be a configuration issue outside of MySqlConnector scope

Using
Azure.Monitor.OpenTelemetry.AspNetCore 1.0.0
.NET SDK 6.0.400
.NET Runtime 6.0.8

@bgrainger
Copy link
Member

@Tobbeman
Copy link
Author

@bgrainger Indeed

As I mentioned I'm happy to make a PR that allow it to be optional.
But if maintainers don't think that makes sense ( which is reasonable ) I'll look elsewhere.

@bgrainger
Copy link
Member

Note: If it is possible to filter these, that would also help me.

https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/trace/extending-the-sdk/README.md#filtering-processor says to "toggle the Activity.Recorded flag." Have you tried that?

@Tobbeman
Copy link
Author

@bgrainger

Sadly the filtering seems to apply to the entire scope of the activity rather than only the events. Shame the events are read only.

I tried to use a TelemetryFilter for application insights directly but looks like the opentelemetry implementation use another client
https://github.com/Azure/azure-sdk-for-net/blob/e986729b7f6d1367ceba27e8dd31a685d9ad65a8/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/AzureMonitorTransmitter.cs

In a similar case they implemented at the core, not sure the project is comparable though
open-telemetry/opentelemetry-dotnet-contrib#416

@bgrainger
Copy link
Member

Npgsql recently added the ability to suppress their activity events: npgsql/npgsql#5853.

@Tobbeman
Copy link
Author

Tobbeman commented Jan 2, 2025

Made a basic PR, It would be very nice if we could configure this in some way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants