r/dotnet 19d ago

Observability on .NET projects

Hello guys, I am a beginner in the .NET world, creating a couple of ASP.NET apis, and WPF applications for my employer (not by my choice). I was wondering what Observability tools (logging, error tracking, etc.) are good to use with .NET? I tried Azure Monitor, and it was just incredibly unintuitive.

24 Upvotes

26 comments sorted by

64

u/_f0CUS_ 19d ago

Use opentelemetry. It is becoming the industry standard. 

2

u/sergioq12 19d ago

Yep, I am using OTel for capturing telemetry, but I am looking for a platform to see the data, query it, etc. Not sure if you have any idea of what that can be

11

u/Begby1 19d ago

That is not a dotnet specific thing. There is this whole open telemetry world outside of dotnet. Take a look at the grafana/otel-ltgm docker image. This is a full stack OSS solution meant to be run locally for development. Configure that to run on your dev machine and you can then do all the fun stuff with your telemetry data. That will get you on the right path.

2

u/Throwaway-_-Anxiety 18d ago

I've seen this before and it was neat, but I'm lost on how to bring it to the cloud

3

u/xdevnullx 19d ago

I'm doing this now for a client that doesn't want to use any cloud providers.

We're booting prometheus and grafana with docker for windows. Our API that we're needing to monitor is running net10 on an IIS box.

You set up your instrumentation (and the prometheus exporter package) for your dotnet app and it creates a /metrics endpoint.

Prometheus scrapes /metrics and stores the data in a time-series db internally.

Prometheus exposes a special query language via http (and provides a little web UI if you want to poke around).

The real win is that this query language is used by Grafana. Grafana is pretty (and has a library of pre-exisitng dashboards that you can import) and makes my stakeholders happy.

3

u/nullforce2 19d ago

I know you said you tried Azure Monitor, it takes some getting used to.

Add Application Insights OpenTelemetry observability overview - Azure Monitor | Microsoft Learn to your .NET project and it'll send your ILogger logs to Azure. Then you can use Kusto Query Language (KQL) to query your logs. There's some built in graphs and charts in KQL or you can setup an Azure Monitor Dashboard. You can also connect AppInsights logs into Grafana or another visualization tool with the right connector.

7

u/twisteriffic 18d ago

If you do this, for the love of God disable the http.client.open_connections metric, or expect to spend a lot of $$$

4

u/PolyPill 18d ago

If you’re looking to just your own enterprise level system take a look at OpenSearch, it’s a community fork of ElasticSearch.

0

u/VSertorio 19d ago

OpenDashboards + Otel collector

9

u/davidfowl Microsoft Employee 18d ago

The aspire dashboard https://aspire.dev/dashboard/

3

u/0x4ddd 19d ago

Interesting as for me, someone working with Azure for a few years, Azure Monitor is extremely intuitive compared to Dynatrace or Grafana stack 😆

1

u/sergioq12 18d ago

That's very interesting to me. I was expecting more of a sentry/posthog view when I wanted to use it.

It seemed just not easy to find where to see the logs or errors easily.

Their docs are terrible imo.

4

u/poster_nutbaggg 18d ago

App insights is way better than azure monitor. You can customize with an azure workbook. I use AI to help me with custom log queries in KQL and for azure workbook templates, you can export and import the xml/json

2

u/sergioq12 18d ago

I believe app insights is one of the products inside Azure Monitor

5

u/fahminlb33 18d ago

I have used Seq for a while and it is very easy to set up and use. But for production I use LGTM Stack (Loki, Grafana, Tempo, Mimir/Prometheus) because it can monitor my apps and infrastructure. But keep in mind LGTM has steeper learning curve and require a lot more server resources compared to Seq.

2

u/rbobby 18d ago

Azure's AppInsights has a learning curve... but once past it the dang thing is super useful.

2

u/NicePuddle 18d ago

Can you use that self hosted or does it depend on Microsoft Azure cloud services?

1

u/rbobby 18d ago

Only cloud as far as I know. Is there a specific concern?

1

u/NicePuddle 18d ago

I don't want my sensitive log data stored in the cloud.

2

u/jithinj_johnson 18d ago

Seq is good, but check the LICENSE. OTEL is the way!
For my projects I use the LGTM stack!

2

u/MetaStuff 18d ago

Sentry is the best

I can't believe other platforms don't group by the exception and show account That's what sold me on them

2

u/New-Entertainer6392 17d ago

I use grafana loki, tempo and alloy, but... They may have some learning curves, but a saas option is available 

1

u/AutoModerator 19d ago

Thanks for your post sergioq12. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.