Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions docs/core/diagnostics/observability-prgrja-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Example: Use OpenTelemetry with Prometheus, Grafana, and Jaeger"
description: A walkthrough of how to use OpenTelemetry in .NET to export telemetry to Prometheus, Grafana, and Jaeger
ms.date: 6/14/2023
ms.topic: how-to
ai-usage: ai-assisted
---

# Example: Use OpenTelemetry with Prometheus, Grafana, and Jaeger
Expand All @@ -19,7 +20,7 @@ dotnet new web

## 2. Add metrics and activity definitions

The following code defines a new metric (`greetings.count`) for the number of times the API has been called, and a new activity source (`OtPrGrYa.Example`).
The following code defines a new metric (`greetings.count`) for the number of times the API has been called, and a new activity source (`OtPrGrYa.Example`). The code sets `Counts the number of greetings` as the metric description, and Prometheus exposes this counter as `greetings_count`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should greetings_count be greetings_count_total? For example, does /metrics output the following?

# TYPE greetings_count_total counter
# HELP greetings_count_total Counts the number of greetings
greetings_count_total{...} 1


:::code language="csharp" source="snippets/OTel-Prometheus-Grafana-Jaeger/csharp/Program.cs" id="Snippet_CustomMetrics":::

Expand Down Expand Up @@ -173,16 +174,12 @@ info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5212
```

Modify the Prometheus YAML configuration file to specify the port for your HTTP scraping endpoint and set a lower scraping interval. For example:
Modify the Prometheus YAML configuration file and add a scrape job for your app endpoint. Keep the existing `prometheus` job unchanged. For example:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current text states that we should keep the existing prometheus job, but the YAML shows a new top-level scrape_configs section without that job. I suggest showing both jobs or showing only the new - job_name entry and explicitly state add it beneath the existing scrape_configs: key.


```yaml
scrape_configs:
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"

# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.

- job_name: "OpenTelemetryTest"
scrape_interval: 1s # poll very quickly for a more responsive demo
static_configs:
- targets: ["localhost:5212"]
Expand Down