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

Web analytics and diagnostics #5461

Closed
3 tasks
danroth27 opened this issue Jan 25, 2018 · 25 comments
Closed
3 tasks

Web analytics and diagnostics #5461

danroth27 opened this issue Jan 25, 2018 · 25 comments
Assignees
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-analytics Pillar: Cloud Integration severity-major This label is used by an internal tool

Comments

@danroth27
Copy link
Member

danroth27 commented Jan 25, 2018

@benhysell
Copy link

Does Serilog "just work" for something like this?
https://github.com/serilog/serilog/wiki/Provided-Sinks

@danroth27
Copy link
Member Author

In general, .NET Standard 2.0 libraries should work from a Blazor app. Which sinks are most interesting to you?

@benhysell
Copy link

Azure Application Insights and Seq, https://getseq.net, are the two I use most often.

@kant2002
Copy link
Contributor

I playing with setting up Application Insights inside Blazor. That seems trivial task if I just copy paste JS initialization code inside index.hml. Then I could interop using JS api At the same time this does not allow me to set Instrumentation Key. Same question if I attempt to run AI inside Blazor's .NET code. I need somehow pass Instrumentation Key for configuration purposes. Any ideas how this could be done right now ?

@danroth27
Copy link
Member Author

At the same time this does not allow me to set Instrumentation Key.

Why not? Isn't the instrumentation key typically embedded in the JS code? https://docs.microsoft.com/en-us/azure/application-insights/app-insights-javascript#add-the-sdk-script-to-your-app-or-web-pages

@kant2002
Copy link
Contributor

I have project which will use different AI accounts for staging and for production. (Assuming that Blazor will take off). Also I use same AI key for API and for Blazor application, which require me to sync them, or worse - ask customer to manually replace AI key in two places.
In the ASP.NET Core (and regular ASP.NET and just AI SDK) I without problem could change AI key using appsettings.json. Would be good to have this in the Blazor as well.

Since Blazor use index.html for serving application, and at the same time there no way to pass command line parameters when I embed Blazor in ASP.NET Core website (no parameters here app.UseBlazor<BlazorApp1.Program>();). It may be not about AI itself, but rather ability to pass configuration from the application hosting Blazor.

@aspnet-hello aspnet-hello transferred this issue from dotnet/blazor Dec 17, 2018
@aspnet-hello aspnet-hello added this to the Backlog milestone Dec 17, 2018
@aspnet-hello aspnet-hello added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one area-blazor Includes: Blazor, Razor Components labels Dec 17, 2018
@isc30
Copy link

isc30 commented Apr 18, 2019

Hi, I just created a Google Analytics extension for Blazor. I think it could be relevant to this ticket.
https://github.com/isc30/blazor-analytics

This library can be extended for multiple analytics providers easily (+add TrackingService for complex operations)

@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@robdavey555
Copy link

Hi, I just created a Google Analytics extension for Blazor. I think it could be relevant to this ticket.
https://github.com/isc30/blazor-analytics

This library can be extended for multiple analytics providers easily (+add TrackingService for complex operations)

I hope you don't mind but I have used your library for inspiration to implement as you suggest.
https://github.com/robdavey555/Blazor.ApplicationInsights

@martinfletcher-w2
Copy link

Is there any update on this?

I would prefer to use dotnet rather than js to send telemetry events, as this would allow for easily consuming existing logging code in a wasm app.

@mehmettahameral
Copy link

mehmettahameral commented Jul 11, 2020

Hi all,

I also would prefer registering AI instance into IoC container on the program.cs, like HttpClient, and then inject telemetry client each .razor pages. Otherwise, we can't track C# exceptions in a proper way.

Many Thanks

@IvanJosipovic
Copy link

I just released https://github.com/IvanJosipovic/BlazorApplicationInsights
It hooks all logging to App Insights and supports App Insights Apis like Track Event etc.

@ElanHasson
Copy link
Contributor

ElanHasson commented Jun 6, 2021

@kant2002

In the ASP.NET Core (and regular ASP.NET and just AI SDK) I without problem could change AI key using appsettings.json. Would be good to have this in the Blazor as well.

Check out https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamentals/configuration?view=aspnetcore-5.0#app-settings-configuration

Specifically this section (no direct link available)
image

Since different environments typically have different configurations (i.e. Instrumentation Key), your deployment process should be responsible for putting the correct file (i.e. $"{environment}.json") in the deployed application. Then in your Startup class use builder.HostEnvironment.Environment to interpolate the filename if you need it in your Blazor app.

You can also load this file in index.html and set it with the AI JS SDK.

This should enable the functionality you require.

@Liero
Copy link

Liero commented Jun 11, 2021

Might be related to #30972

@indcoder
Copy link

@danroth27 Is there an ETA for this? This issue has been languishing for over 4 years now; almost two years after @SteveSandersonMS has labelled it as a major severity. We had expected this to be ready with .net 6 release. The implication is that it is creating strong headwinds against us convincing folks #BlazorWASM has critical mass and is production ready.

@CoryKoehler
Copy link

@danroth27 Is there an ETA for this? This issue has been languishing for over 4 years now; almost two years after @SteveSandersonMS has labelled it as a major severity. We had expected this to be ready with .net 6 release. The implication is that it is creating strong headwinds against us convincing folks #BlazorWASM has critical mass and is production ready.

You can use the javascript appinsights sdk -> same with google analytics.

In my production app we use the following packages
https://github.com/IvanJosipovic/BlazorApplicationInsights
https://github.com/isc30/blazor-analytics

both are working very well without much work to setup

@indcoder
Copy link

@CoryKoehler We are aware of the two packages [they have cropped up earlier in this thread years back ]. But the recent log4j scare has completely changed the landscape; especially in the enterprise sector. Mind you, they are official AppInsights plugins for react and angular; we are demanding parity for BlazorWASM and we solicit your support in this regard.

@hkusulja
Copy link

hkusulja commented Jan 26, 2022

Hello, I am coming from - microsoft/ApplicationInsights-dotnet#2143 that has referenced this issue.
Also alternative - https://feedback.azure.com/d365community/idea/4f959530-1425-ec11-b6e6-000d3a4f09d0

Please inform us about plan and status for supporting Application insights in .NET 6 SDK via dotnet new blazorwasm

Thank you

@ss-proc
Copy link

ss-proc commented Jul 27, 2022

For folks considering jumping from react to blazor, please add native blazor wasm support for Azure AI

@Postlagerkarte
Copy link

Postlagerkarte commented Sep 21, 2022

I can confirm that this is causing headwinds for the same reasons @indcoder pointed out. Enterprise sentiment has shifted negatively towards third-party logging providers and having native support for Azure AI is definitely crucial. A similar discussion can be found at microsoft/ApplicationInsights-dotnet#2143
@danroth27 is native Azure AI support something that the Blazor Team would even consider doing or is the SDK Team solely responsible for that? Their current status is 'this is not being actively worked on by anyone in the SDK team' - so hopefully not a ping-pong problem.

@Liero
Copy link

Liero commented Sep 23, 2022

After 4 years I still haven't been able to associate logs with username or current url in Blazor Server. How this cannot be prioritized is beyond my understanding

@hkusulja
Copy link

@Liero I think that this should be resolved under Application Insights team and their SDK which should support Blazor WASM here is feature request - microsoft/ApplicationInsights-dotnet#2143

@kzu
Copy link

kzu commented Apr 25, 2023

Hey @danroth27 I totally think a third party solution like @IvanJosipovic shouldn't be necessary to get all the stuff working OOB for such a key component of ASP.NET as Blazor webassembly.

Seems like the two teams should sit down and figure out what's missing on either end. It might just be that the AI team needs to get some pressure from the ASP.NET team 😉

@ghost
Copy link

ghost commented Dec 22, 2023

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@hkusulja
Copy link

Since no progress here for a years.
Application Insights is moving to Open Telemetry protocol and NuGets.
So in current situation, this is solution could be OpenTelemetry. NET
https://opentelemetry.io/docs/instrumentation/net/

@danroth27
Copy link
Member Author

I've split this issue down in to three sub-issues that we are tracking separately. Since this issue is no longer tracking anything on its own, I'm going to go ahead and close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-analytics Pillar: Cloud Integration severity-major This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests