惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 司徒正美
C
Check Point Blog
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
IT之家
IT之家
B
Blog
博客园_首页
量子位
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
J
Java Code Geeks
H
Help Net Security
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis
StatsD for .NET: DogStatsD
Elijah Andrews · 2013-08-21 · via Datadog | The Monitor blog

More love for your Microsoft stack from Datadog!

Alongside our Microsoft Event Viewer, IIS, and SQL Server integrations, you are now able to monitor custom metrics in your .NET applications with our new DogStatsD C\# client.

DogStatsD is a metrics aggregation server that is bundled with the Datadog Agent. The DogStatsD C\# client is a C\# library that sends custom metrics to the Agent’s DogStatsD server from within .NET web applications and other C\# projects. These metrics will then be sent to Datadog, where they can be graphed and analyzed in realtime. DogStatsD is based on the StatsD protocol. Check out Olivier’s blog post for more information about StatsD, and our DogStatsD guide for more information about DogStatsD.

Getting Started

In order to start using the DogStatsD C\# client in Microsoft Visual Studio 2012, you’ll need the following:

Once you’ve got these prerequisites, open the project you want to monitor in Visual Studio. Then, click on the Tools menu, hover over Library Package Manager, and select Package Manager Console.

statsd-net-visual-studio-setup

The Package Manager Console will now be displayed. Execute the following command in the console:

Install-Package DogStatsD-CSharp-Client

The output should be similar to the following:

statsd-.net-console-output

You’re now ready to start using the library!

Instrumenting an ASP .NET MVC 4 Application

Now we’ll show you how to quickly get up and running from your ASP .NET MVC 4 web application. We’ll also show some simple ways you can use the client to monitor your application.

Create a file containing a StatsdConfig class in your App_Start folder. Depending on your setup, you may need to modify how you configure the client:

Next, call StatsdConfig.Configure() in your application’s Application_Start() method in Global.asax.cs:

We’re now configured and ready to capture some custom metrics!

I’ve just deployed some new authentication logic and I want to make sure that it hasn’t significantly lengthened the time required to sign in. Here’s the controller method associated with the action:

Let’s wrap the authentication and redirect in a timer. First we have to include the library at the top of the file:

using StatsdClient;

Surround the code we want to time with a timer:

And that’s it! We’ll now start to see this metric appear in Datadog:

1
2

Now that we know how long it’s taking users to sign in, let’s check how many unique users are accessing the site. Here is the controller method that’s responsible for rendering my home page:

I’m going to use the set metric, which counts the number of unique elements in a group. In this case, our elements will be the usernames of authenticated users.

Again, we need to start by including the library at the top of the file:

using StatsdClient;

Then add the code to send the metric:

Now we’ll start seeing the unique users metric in Datadog:

3

Notice that I’ve tagged the metric with page:index. Once I start adding user.unique metrics for other pages, I’ll be able to graph unique users on specific pages, or across all pages:

4
5
6

And that’s it! More detailed documentation for the library can be found on the GitHub repository.

Click here to try Datadog for free for 14 days. Happy monitoring!