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:
73
73
tracing : Optional [TracingConfig ]
74
74
logging : Optional [LoggingConfig ]
75
75
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 {
30
30
tracing : Option < TracingConfig > ,
31
31
logging : Option < LoggingConfig > ,
32
32
metrics : Option < MetricsConfig > ,
33
+ global_tags : Option < HashMap < String , String > >
33
34
}
34
35
35
36
#[ derive( FromPyObject ) ]
@@ -129,6 +130,9 @@ impl TryFrom<TelemetryConfig> for TelemetryOptions {
129
130
) ) ;
130
131
} ) ;
131
132
}
133
+ if let Some ( v) = conf. global_tags {
134
+ build. global_tags ( v) ;
135
+ }
132
136
build
133
137
. build ( )
134
138
. map_err ( |err| PyValueError :: new_err ( format ! ( "Invalid telemetry config: {}" , err) ) )
Original file line number Diff line number Diff line change 5
5
6
6
from __future__ import annotations
7
7
8
- from dataclasses import dataclass
8
+ from dataclasses import dataclass , field
9
9
from datetime import timedelta
10
10
from typing import ClassVar , Mapping , Optional , Union
11
11
@@ -175,6 +175,9 @@ class TelemetryConfig:
175
175
metrics : Optional [Union [OpenTelemetryConfig , PrometheusConfig ]] = None
176
176
"""Metrics configuration."""
177
177
178
+ global_tags : Mapping [str , str ] = field (default_factory = dict )
179
+ """OTel resource tags to be applied to all metrics and traces"""
180
+
178
181
def _to_bridge_config (self ) -> temporalio .bridge .runtime .TelemetryConfig :
179
182
return temporalio .bridge .runtime .TelemetryConfig (
180
183
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:
189
192
if not isinstance (self .metrics , PrometheusConfig )
190
193
else self .metrics ._to_bridge_config (),
191
194
),
195
+ global_tags = self .global_tags ,
192
196
)
You can’t perform that action at this time.
0 commit comments