Repository navigation
Add temporalNamespace tag to tracing spans - #1
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Jeffrey Liu <jeffrey.liu@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements temporalio/features#592 for Python. Every span created by
temporalio.contrib.opentelemetrynow has atemporalNamespaceattribute, next to the existingtemporalWorkflowID/temporalRunID. This applies to bothTracingInterceptorand the experimentalOpenTelemetryInterceptor/OpenTelemetryPlugin(add_temporal_spans=True). The same change is going into the other SDKs in parallel.Where the value comes from:
StartWorkflow,SignalWithStartWorkflow,QueryWorkflow,SignalWorkflow,StartWorkflowUpdate,StartUpdateWithStartWorkflow,StartActivity(standalone)Client.namespaceRunWorkflow,HandleSignal,HandleQuery,ValidateUpdate,HandleUpdate,CompleteWorkflow,StartActivity(incl. local),StartChildWorkflow,SignalChildWorkflow,SignalExternalWorkflow,StartNexusOperation,SignalWithStartWorkflow, plusworkflow.completed_span(...)workflow.info().namespaceRunActivityactivity.info().namespaceRunStartNexusOperationHandler,RunCancelNexusOperationHandlernexus.info().namespaceClient outbound interceptors are never handed the
Client. So_client_namespace(next)walks thenextchain down to the SDK's terminal_ClientImpland readsclient.namespaceonce, at interceptor construction. Interceptors layered under the tracing one still work, and the test covers that case. If no client is found, the attribute is left off and nothing errors.SignalExternalWorkflowgets the workflow's own namespace, notinput.namespace(the target's). That keeps the rule "the namespace the operation runs in" the same for every span.Python tag names are hardcoded literals with no configuration option, so this PR adds no new option. The changelog fragment is
changelog/added/namespace-tagged-breadcrumbs.md.Validation
poe test -s tests/contrib/opentelemetry→ 93 passedpoe test -s tests/contrib/opentelemetry --workflow-environment time-skipping-v2→ 93 passedpoe lint(ruff import check,ruff format --check, pyright, mypy, basedpyright, pydocstyle) → all passedNew and extended tests:
assert_namespace_on_spanshelper, now asserted intest_opentelemetry_tracing,test_opentelemetry_tracing_update_with_start,test_opentelemetry_tracing_nexus,test_opentelemetry_standalone_activity_tracingand the plugin'stest_opentelemetry_comprehensive_tracing(only spans created by the interceptor; user-created spans are untouched).test_opentelemetry_client_span_namespace_from_client[tracing|otel]uses a non-default client namespace with a passthrough client interceptor underneath. It checks that the client span carries that namespace. The namespace doesn't exist, so the RPC fails after the span is recorded and no namespace has to be registered.Not run: the time-skipping-v1 (Java test server) environment, and the full repo test suite outside
tests/contrib/opentelemetry.Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/c98adab36c654fad81d542846271b694
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/c98adab36c654fad81d542846271b694?variant=devin
Requested by: @freyatcog
🟢 Devin Review found nothing to fix · View findings