Skip to content

Added OTEL tracing #196

Open
davidigandan wants to merge 44 commits intomainfrom
dev
Open

Added OTEL tracing #196
davidigandan wants to merge 44 commits intomainfrom
dev

Conversation

@davidigandan
Copy link

Added OTEL Tracing to zocalo service

# Configure the context depending on if service is emitting spans
stack.enter_context(log_extender("recipe_ID", recipe_id))
if otel_logs:
stack.enter_context(log_extender("otel_logs", otel_logs))
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, this puts a text repr of the dictionary in the log field a.k.a

Image

Span and trace ID should be passed separately.

otel_logs = {
"span_id": span_id,
"trace_id": trace_id,
"recipe_id": recipe_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

another note that this recipe_id is redundant as it is already injected onto the log message

Comment on lines +197 to +201
otel_config = (
self.config._opentelemetry
if self.config and hasattr(self.config, "_opentelemetry")
else None
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
otel_config = (
self.config._opentelemetry
if self.config and hasattr(self.config, "_opentelemetry")
else None
)
otel_config = getattr(self.config, "_opentelemetry", None)

if log_extender and rw.environment and rw.environment.get("ID"):
with log_extender("recipe_ID", rw.environment["ID"]):

if log_extender and rw.environment["ID"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be .get() - KeyError if "ID" is not in environment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suddenly forgetting what is and isn't assumed to be present

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.

2 participants