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

Pass IServiceProvider to the applicationInsights lambda in order to make it more effective #290

Open
ysmoradi opened this issue Apr 6, 2024 · 0 comments · May be fixed by #296
Open

Pass IServiceProvider to the applicationInsights lambda in order to make it more effective #290

ysmoradi opened this issue Apr 6, 2024 · 0 comments · May be fixed by #296
Labels
enhancement New feature or request

Comments

@ysmoradi
Copy link

ysmoradi commented Apr 6, 2024

Instead of

builder.Services.AddBlazorApplicationInsights(config =>
    {
        config.ConnectionString = "{Insert Connection String}";
    },
    async applicationInsights =>
    {
        var telemetryItem = new TelemetryItem()
        {
            Tags = new Dictionary<string, object?>()
            {
                { "ai.cloud.role", "SPA" },
                { "ai.cloud.roleInstance", "Blazor Wasm" },
            }
        };

        await applicationInsights.AddTelemetryInitializer(telemetryItem);
    });

We could have:

builder.Services.AddBlazorApplicationInsights(config =>
    {
        config.ConnectionString = "{Insert Connection String}";
    },
    async (serviceProvider, applicationInsights) =>
    {
        var telemetryItem = new TelemetryItem()
        {
            Tags = new Dictionary<string, object?>()
            {
                { "ai.cloud.role", "SPA" },
                { "ai.cloud.roleInstance", "Blazor Wasm" },
            }
        };

        await applicationInsights.AddTelemetryInitializer(telemetryItem);
    });
@jacobjmarks jacobjmarks linked a pull request May 12, 2024 that will close this issue
@IvanJosipovic IvanJosipovic added the enhancement New feature or request label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants