Skip to content

Commit 3e0b902

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9c13d07 commit 3e0b902

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/workflows/recipe/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def unwrap_recipe(header, message):
101101

102102
if recipe_id:
103103
log_extra["recipe_id"] = recipe_id
104-
104+
105105
if log_extender and rw.environment and rw.environment.get("ID"):
106106
with log_extender("recipe_ID", rw.environment["ID"]):
107107
return callback(rw, header, message.get("payload"))

src/workflows/services/common_service.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,19 @@ def start_transport(self):
192192
self.transport.subscription_callback_set_intercept(
193193
self._transport_interceptor
194194
)
195-
195+
196196
# Configure OTELTracing if configuration is available
197-
otel_config = OTEL.config if hasattr(OTEL, 'config') and OTEL.config else None
198-
197+
otel_config = (
198+
OTEL.config if hasattr(OTEL, "config") and OTEL.config else None
199+
)
200+
199201
if otel_config:
200202
# Configure OTELTracing
201-
resource = Resource.create({
202-
SERVICE_NAME: self._service_name,
203-
})
203+
resource = Resource.create(
204+
{
205+
SERVICE_NAME: self._service_name,
206+
}
207+
)
204208

205209
self.log.debug("Configuring OTELTracing")
206210
provider = TracerProvider(resource=resource)
@@ -209,7 +213,7 @@ def start_transport(self):
209213
# Configure BatchProcessor and OTLPSpanExporter using config values
210214
otlp_exporter = OTLPSpanExporter(
211215
endpoint=otel_config["endpoint"],
212-
timeout=otel_config.get("timeout", 10)
216+
timeout=otel_config.get("timeout", 10),
213217
)
214218
span_processor = BatchSpanProcessor(otlp_exporter)
215219
provider.add_span_processor(span_processor)
@@ -221,7 +225,6 @@ def start_transport(self):
221225
)
222226
self._transport.add_middleware(otel_middleware)
223227

224-
225228
metrics = self._environment.get("metrics")
226229
if metrics:
227230
import prometheus_client

src/workflows/util/zocalo/configuration.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from workflows.transport.pika_transport import PikaTransport
88
from workflows.transport.stomp_transport import StompTransport
99

10+
1011
class OTEL:
1112
"""A Zocalo configuration plugin to pre-populate OTELTracing config defaults"""
1213

@@ -23,10 +24,12 @@ class Schema(PluginSchema):
2324
def activate(configuration):
2425
# Build the full endpoint URL if not provided
2526
if "endpoint" not in configuration:
26-
endpoint = f"https://{configuration['host']}:{configuration['port']}/v1/traces"
27+
endpoint = (
28+
f"https://{configuration['host']}:{configuration['port']}/v1/traces"
29+
)
2730
else:
2831
endpoint = configuration["endpoint"]
29-
32+
3033
OTEL.config["endpoint"] = endpoint
3134
OTEL.config["timeout"] = configuration.get("timeout", 10)
3235

0 commit comments

Comments
 (0)