-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a0c2fd
commit 71fead7
Showing
10 changed files
with
69 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
opentelemetry-sdk==1.17.0 | ||
opentelemetry-exporter-otlp==1.17.0 | ||
opentelemetry-sdk==1.24.0 | ||
opentelemetry-exporter-otlp==1.24.0 |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
opentelemetry-sdk==1.17.0 | ||
opentelemetry-exporter-otlp==1.17.0 | ||
opentelemetry-sdk==1.24.0 | ||
opentelemetry-exporter-otlp==1.24.0 |
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,2 @@ | ||
all: | ||
./main.py |
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,49 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
from opentelemetry import trace | ||
from opentelemetry.sdk.resources import Resource | ||
from opentelemetry.sdk.trace import TracerProvider | ||
from opentelemetry.sdk.trace.export import BatchSpanProcessor | ||
from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( | ||
OTLPSpanExporter, | ||
) | ||
from opentelemetry.exporter.otlp.proto.http import Compression | ||
from opentelemetry.sdk.extension.aws.trace import AwsXRayIdGenerator | ||
|
||
dsn = os.environ.get("UPTRACE_DSN") | ||
print("using DSN:", dsn) | ||
|
||
resource = Resource( | ||
attributes={"service.name": "myservice", "service.version": "1.0.0"} | ||
) | ||
tracer_provider = TracerProvider( | ||
resource=resource, | ||
id_generator=AwsXRayIdGenerator(), | ||
) | ||
trace.set_tracer_provider(tracer_provider) | ||
|
||
exporter = OTLPSpanExporter( | ||
endpoint="https://otlp.uptrace.dev/v1/traces", | ||
# Set the Uptrace dsn here or use UPTRACE_DSN env var. | ||
headers=(("uptrace-dsn", dsn),), | ||
timeout=10, | ||
compression=Compression.Gzip, | ||
) | ||
|
||
span_processor = BatchSpanProcessor( | ||
exporter, | ||
max_queue_size=1000, | ||
max_export_batch_size=1000, | ||
) | ||
tracer_provider.add_span_processor(span_processor) | ||
|
||
tracer = trace.get_tracer("app_or_package_name", "1.0.0") | ||
|
||
with tracer.start_as_current_span("main") as span: | ||
trace_id = span.get_span_context().trace_id | ||
print(f"trace id: {trace_id:0{32}x}") | ||
|
||
# Send buffered spans. | ||
trace.get_tracer_provider().shutdown() |
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,3 @@ | ||
opentelemetry-sdk==1.24.0 | ||
opentelemetry-exporter-otlp==1.24.0 | ||
opentelemetry-sdk-extension-aws==2.0.1 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
opentelemetry-sdk==1.17.0 | ||
opentelemetry-exporter-otlp==1.17.0 | ||
opentelemetry-sdk==1.24.0 | ||
opentelemetry-exporter-otlp==1.24.0 | ||
opentelemetry-sdk-extension-aws==2.0.1 |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Uptrace distro version""" | ||
|
||
__version__ = "1.22.0" | ||
__version__ = "1.24.0" |