File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,4 @@ class TelemetryConfig:
7373 tracing : Optional [TracingConfig ]
7474 logging : Optional [LoggingConfig ]
7575 metrics : Optional [MetricsConfig ]
76+ global_tags : Mapping [str , str ]
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ pub struct TelemetryConfig {
3030 tracing : Option < TracingConfig > ,
3131 logging : Option < LoggingConfig > ,
3232 metrics : Option < MetricsConfig > ,
33+ global_tags : Option < HashMap < String , String > >
3334}
3435
3536#[ derive( FromPyObject ) ]
@@ -129,6 +130,9 @@ impl TryFrom<TelemetryConfig> for TelemetryOptions {
129130 ) ) ;
130131 } ) ;
131132 }
133+ if let Some ( v) = conf. global_tags {
134+ build. global_tags ( v) ;
135+ }
132136 build
133137 . build ( )
134138 . map_err ( |err| PyValueError :: new_err ( format ! ( "Invalid telemetry config: {}" , err) ) )
Original file line number Diff line number Diff line change 55
66from __future__ import annotations
77
8- from dataclasses import dataclass
8+ from dataclasses import dataclass , field
99from datetime import timedelta
1010from typing import ClassVar , Mapping , Optional , Union
1111
@@ -175,6 +175,9 @@ class TelemetryConfig:
175175 metrics : Optional [Union [OpenTelemetryConfig , PrometheusConfig ]] = None
176176 """Metrics configuration."""
177177
178+ global_tags : Mapping [str , str ] = field (default_factory = dict )
179+ """OTel resource tags to be applied to all metrics and traces"""
180+
178181 def _to_bridge_config (self ) -> temporalio .bridge .runtime .TelemetryConfig :
179182 return temporalio .bridge .runtime .TelemetryConfig (
180183 tracing = None if not self .tracing else self .tracing ._to_bridge_config (),
@@ -189,4 +192,5 @@ def _to_bridge_config(self) -> temporalio.bridge.runtime.TelemetryConfig:
189192 if not isinstance (self .metrics , PrometheusConfig )
190193 else self .metrics ._to_bridge_config (),
191194 ),
195+ global_tags = self .global_tags ,
192196 )
You can’t perform that action at this time.
0 commit comments