-
Notifications
You must be signed in to change notification settings - Fork 329
feat(observability): added section for using global tags across SDKs #5270
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
Changes from all commits
36aa973
cee2a07
92f94ae
46428a0
d1e5d0c
f2060da
06799f0
16dc0b8
fa10303
f7a5475
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| id: observability | ||
| title: Observability - .NET SDK | ||
| title: Observability | ||
| sidebar_label: Observability | ||
| description: Explore Temporal SDK observability features for Metrics, Tracing, Logging, and Visibility. Track Workflow Executions, set up Prometheus endpoints, customize metrics, configure tracing, and more. | ||
| toc_max_heading_level: 4 | ||
|
|
@@ -74,6 +74,71 @@ var runtime = new TemporalRuntime(new() | |
| var client = await Temporalio.ConnectAsync(new("localhost:7233") { Runtime = runtime }); | ||
| ``` | ||
|
|
||
| ### Attach global tags to metrics | ||
|
|
||
| SDK metrics arrive tagged with Temporal information such as `namespace` and `task_queue`. | ||
| Global tags add your organization's information next to them, so a dashboard can group Workers by the team, service, or environment that owns them. | ||
|
|
||
| Set [`GlobalTags`](https://dotnet.temporal.io/api/Temporalio.Runtime.MetricsOptions.html#Temporalio_Runtime_MetricsOptions_GlobalTags) on the [`Metrics` telemetry options](https://dotnet.temporal.io/api/Temporalio.Runtime.MetricsOptions.html) to add the same key-value pairs to every metric the runtime emits, from both the Client and the Worker. | ||
|
|
||
| ```csharp | ||
| using Temporalio.Client; | ||
| using Temporalio.Runtime; | ||
|
|
||
| var runtime = new TemporalRuntime(new() | ||
| { | ||
| Telemetry = new() | ||
| { | ||
| Metrics = new() | ||
| { | ||
| Prometheus = new("0.0.0.0:9000"), | ||
| GlobalTags = new Dictionary<string, string> | ||
| { | ||
| ["team"] = "content-platform", | ||
| ["service"] = "checkout", | ||
| ["cost_center"] = "cc-1042", | ||
| ["environment"] = "production", | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
| var client = await TemporalClient.ConnectAsync(new("localhost:7233") { Runtime = runtime }); | ||
| ``` | ||
|
|
||
| #### Choose a tag set | ||
|
|
||
| Tags are most useful when standardized across the organization, so that every Worker emits the same keys. | ||
| Decide on the set before teams adopt it. | ||
| These five suit most organizations: | ||
|
|
||
| | Tag | Example | Question it answers | | ||
| | ------------- | ------------------ | --------------------------------------------------------- | | ||
| | `team` | `content-platform` | Who owns the Workers behind this Namespace or Task Queue? | | ||
| | `service` | `checkout` | Which application emits these metrics? | | ||
| | `cost_center` | `cc-1042` | Which budget does this Worker fleet belong to? | | ||
| | `environment` | `production` | Is this production traffic, or staging or test? | | ||
| | `region` | `us-east-2` | Where does the Worker fleet run? | | ||
|
|
||
| The built-in tags identify where a metric came from inside Temporal. | ||
| `namespace` and `task_queue` do not record which team runs the Workers behind them, so a dashboard grouped only by those tags cannot answer an ownership question. | ||
|
|
||
| That gap costs you time during an incident. | ||
| When several Namespaces degrade at once, what you need first is the name of the team that owns the affected Workers, so you can ask whether they deployed recently. | ||
| Standardized tags put that name on the dashboard, which turns a broad question about the Temporal Service into a direct message to one team. | ||
|
Comment on lines
+125
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In each of the six copies, this incident passage spends three sentences describing an abstract gap before telling the reader what to do. Rewrite it as direct triage steps—group by AGENTS.md reference: AGENTS.md:L266-L268 Useful? React with 👍 / 👎. |
||
|
|
||
| Grouping by `team` also tells you which case you are looking at: | ||
|
|
||
| - The affected Workers share one `team` value. Check that team's recent deploys first, because a deploy that restarts a Worker fleet causes a short disturbance in its metrics. | ||
| - The affected Workers span several `team` values. A single team's deploy no longer explains the pattern, so you can rule it out and look for a shared cause. | ||
|
|
||
| The same grouping answers questions outside incidents. | ||
| A `cost_center` tag shows which budget owner drives Workflow and Activity volume. | ||
| SDK metrics count what your Workers and Clients do, which is not the same as the [Actions](/cloud/pricing#action) Temporal Cloud bills for, so use them to compare teams rather than to reconcile a bill. | ||
|
|
||
| Keep tag values low cardinality. | ||
| Your metrics backend stores one series per distinct combination of tag values, so a value that changes per Workflow Execution, such as a Workflow Id or a customer identifier, multiplies what it stores. | ||
| Ownership and deployment identifiers avoid this because they stay fixed for the life of the process. | ||
|
|
||
| ## Setup Tracing {/* #tracing */} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 [vale] <Temporal.Headings> reported by reviewdog 🐶 |
||
|
|
||
| Tracing allows you to view the call graph of a Workflow along with its Activities, Nexus Operations, and any Child Workflows. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire “Choose a tag set” block is language-neutral organizational policy and is duplicated across all six modified observability pages: .NET, Go, Java, Python, Ruby, and TypeScript. This turns SDK how-to pages into repeated best-practice guidance that can drift independently; move the shared policy to one language-neutral Best Practices page and keep only a link plus the SDK-specific configuration here.
AGENTS.md reference: AGENTS.md:L247-L253
Useful? React with 👍 / 👎.