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

Adding filters should not force initialization of Agent. #2418

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

Mpdreamz
Copy link
Member

Instead if the agent is not yet setup we simply buffer the filters until the agent gets constructed.

This allows you to add filters before initializing the static agent.

This manifested itself in the hosted service integrations (.NET Core) where the agent get's constructed slightly delayed.

And calling

Agent.AddFilter((ISpan span) =>
{
    return span;
});

Would win the race for Agent.Instance over the ASP.NET core integrations.

Instead if the agent is not yet setup we simply buffer the filters until the agent gets constructed.

This allows you to add filters before initializing the static agent.

This manifested itself in the hosted service integrations (.NET Core) where the agent get's constructed slightly delayed.

And calling

```
Agent.AddFilter((ISpan span) =>
{
    return span;
});
```

Would win the race for `Agent.Instance` over the ASP.NET core integrations.
stevejgordon
stevejgordon previously approved these changes Aug 15, 2024
Copy link
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Copy link
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@Mpdreamz Mpdreamz merged commit 8e99d01 into main Aug 15, 2024
15 checks passed
@Mpdreamz Mpdreamz deleted the fix/add-agent-filters branch August 15, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] APM Agent stops working when using AddFilter
2 participants