mysql-net / MySqlConnector

MySQL Connector for .NET
https://mysqlconnector.net
MIT License
1.39k stars 336 forks source link

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

Open Tobbeman opened 20 hours ago

Tobbeman commented 20 hours ago

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 commented 3 hours ago

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.