-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
openetelemetry_info
to user_params
This will be a dictionary containing, `otel_url` and `traceparent`. There are used in tekton tasks to initialize opentelementry and send traces to opentelemetry collector * MMENG-3834 Signed-off-by: Harsh Modi <hmodi@redhat.com>
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
Copyright (c) 2023 Red Hat, Inc | ||
All rights reserved. | ||
This software may be modified and distributed under the terms | ||
of the BSD license. See the LICENSE file for details. | ||
""" | ||
from opentelemetry import trace | ||
from opentelemetry.trace import format_trace_id, format_span_id | ||
|
||
|
||
def get_current_traceparent(): | ||
tracecontext = trace.get_current_span().get_span_context() | ||
traceparent = (f'00-{format_trace_id(tracecontext.trace_id)}-' | ||
f'{format_span_id(tracecontext.span_id)}-01') | ||
return traceparent |
This file contains 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