elastic / apm-agent-dotnet

https://www.elastic.co/guide/en/apm/agent/dotnet/current/index.html
Apache License 2.0
585 stars 208 forks source link

[BUG] Can't add custom filters #2421

Closed th3ragex closed 3 months ago

th3ragex commented 3 months ago

APM Agent version

The version of the Elastic.Apm nuget package used: 1.28.3

Describe the bug

After #2418 it's not possible to add custom filters anymore.

_allowFilterAdd is never set to true. It seems the only active filters are predefined filters added via internal SetUpFilters method.

https://github.com/elastic/apm-agent-dotnet/blob/eae543fb8de24d0830d83c7fffecb5af04876bca/src/Elastic.Apm/Report/PayloadSenderV2.cs#L151

To Reproduce

Call Agent.AddFilter method after Agent was initialized and expect true as return value .

Call Agent.AddFilter method before Agent gets initialized and expect the filter to be present in the filters list after Agent initialization.