Skip to content

Conversation

@davidigandan
Copy link

Added OTEL Tracing to zocalo service

message = mangle_for_receiving(message)
if header.get("workflows-recipe") in {True, "True", "true", 1}:
rw = RecipeWrapper(message=message, transport=transport_layer)
logger.debug("RecipeWrapper created: %s", rw)
Copy link
Contributor

Choose a reason for hiding this comment

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

debugging output left in


# Extract recipe_id on the current span
span = trace.get_current_span()
dcid = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we decided to move DCID handling elsewhere

Comment on lines 103 to 104
if dcid:
log_extra["dcid"] = dcid
Copy link
Contributor

Choose a reason for hiding this comment

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

also vestigial DCID handling

if recipe_id:
log_extra["recipe_id"] = recipe_id

logger.info("Processing recipe message", extra=log_extra)
Copy link
Contributor

Choose a reason for hiding this comment

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

debug output, probably don't want to keep this for deployment (certainly not at INFO level)

self._transport.add_middleware(otel_middleware)

self.log.debug("OTELTracingMiddleware added to transport layer of %s", self._service_name)
self.log.debug(
Copy link
Contributor

Choose a reason for hiding this comment

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

this debug output probably OK as at DEBUG level but maybe consider if it's truly useful to keep around (it might be!)

Comment on lines 208 to 210
otlp_exporter = OTLPSpanExporter(
endpoint="https://otel.tracing.diamond.ac.uk:4318/v1/traces", timeout=10
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines 14 to 18
"""
Initialize the OpenTelemetry Tracing Middleware.
:param tracer: An OpenTelemetry tracer instance used to create spans.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Either:

  • The declared parameters are incomplete here, and should be expanded
    or
  • This docstring is somewhat vestigial and doesn't add much. "Init on OTELTracingMiddleware initializes the OpenTelemetry Tracing Middleware" "tracer: A trace"

In any case, I believe that most of the time we use google-style docstrings e.g. https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html

endpoint=otel_config["endpoint"],
timeout=otel_config.get("timeout", 10),
)
span_processor = BatchSpanProcessor(otlp_exporter)

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable Error

Local variable 'otlp_exporter' may be used before it is initialized.
timeout=otel_config.get("timeout", 10),
)
span_processor = BatchSpanProcessor(otlp_exporter)
provider.add_span_processor(span_processor)

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable Error

Local variable 'provider' may be used before it is initialized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants