Stas Yakhnenko Profile picture
Feb 11 β€’ 14 tweets β€’ 6 min read
#aspnet starter kit πŸ”­ - Observability

- If you can't measure it, you can't improve it.

Do you know how well your app is doing?
What's the average CPU usage, or what endpoints are called most often?

Metrics answers it all.
Let's see how we can achieve that easily πŸ‘‡

#dotnet
1\ Understanding the behavior and performance of your ASP.NET Core application are critical for ensuring its reliability and availability.
With the right tools, you can monitor key performance indicators, track error rates, and resource utilization.
2\ So what to measure exactly? πŸ€”
Everything. Any data can be viable and bring unique tech and business insights:
- System resources: RAM, CPU, Network, Disk, etc
- Endpoints: throughput, response time, error rate
- Status codes: 200, 500, etc
- Validation errors
3\ The industry has seen various ways of achieving that, from in-house-made solutions to AppMetrics.
Now the de-facto standard for it is OpenTelemetry.
4\ OpenTelemetry is an amazing collection of tools, APIs, and SDKs that can help you measure the performance of your web apps. With OpenTelemetry you can instrument, collect, generate, and export metrics, logs, and traces to gain valuable insights into the behavior of your code.
5\ Why OpenTelemetry is a real deal⭐
- Open-source
- Standardized
- Vendor agnostic
- Tech agnostic (use it in any programming language or framework)
- Community
6\ That might sound so cool, so how to integrate it into an existing #aspnet web application?
⭐A couple of NuGet packages
⭐Ten lines of code
Let's implement it. We're going to use OpenTelemeterty to collect metrics. Prometheus and Grafana to visualize it πŸ‘‡
7\ That's the nuggets I use for this showcase.
But eventually, if you just search for OpenTelemetry you're going to find plenty more. Different instrumentation, exporters.
The controversial stuff - the ecosystem seems to be huge, but all of the packages are still pre-release
8\ With that setup, you're able to access the new endpoint "/metrics", which has all the data we're monitoring, in the Prometheus format.
Let's see how it looks πŸ‘‡
9\ Last step - visualisation.
For it, you can use any tools you like, I'll stick to #grafana and #prometheus.
They're easy to set up with docker, and much fun to work with 😎

As for the dashboard, I found one in public dashboards: /
grafana.com/grafana/dashbo…
10\ A little bit more configuration and that's the result πŸ‘‡
All the data is on one dashboard, easy to navigate, and easy to observe.
#grafana dashboards are configurable, so you might customize them according to your needs.
11\ In conclusion, if you're looking for a powerful and flexible solution for observability in ASP.NET Core, look no further than OpenTelemetry. With its rich set of features, community support, and commitment to open standards, it's just the best choice
BTW, this thread and overall investigation about OpenTelemetery was highly inspired by @davidfowl short tweet
@davidfowl If you find this thread insightful consider liking, RT, and subscribing. I regularly write about different ASP.NET tips and techniques, so don't miss it! 🌟

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Stas Yakhnenko

Stas Yakhnenko Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @StasYakhnenko

Feb 9
#aspnet starter kit 🚨 - Monitoring

You've got health checks in place. With just one HTTP call you can check if an app is healthy.
So how do you make it automatic, so you'll be the first to know if the system goes down?

Let's explore monitoring and alerts. πŸ‘‡

#dotnet Image
1\ With the rise of distributed systems, it's increasingly important to have a robust monitoring solution in place. Health checks allow you to monitor the health of your apps and detect any issues before they escalate.
And then it has to be monitored all the time.
2\ The benefits of continuous monitoring and alerting are numerous. It allows you to detect issues early, minimize downtime, and improve user experience. It also helps you respond quickly to incidents and resolve them before they become bigger problems.
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(