Skip to content

Commit

Permalink
v1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Apr 8, 2024
1 parent 3a0c2fd commit 71fead7
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 15 deletions.
4 changes: 2 additions & 2 deletions example/otlp-logs/requirements.txt
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
4 changes: 2 additions & 2 deletions example/otlp-metrics/requirements.txt
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
2 changes: 2 additions & 0 deletions example/otlp-traces-http/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
./main.py
49 changes: 49 additions & 0 deletions example/otlp-traces-http/main.py
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()
3 changes: 3 additions & 0 deletions example/otlp-traces-http/requirements.txt
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
4 changes: 2 additions & 2 deletions example/otlp-traces/requirements.txt
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
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ packages=find_namespace:
zip_safe = False
include_package_data = True
install_requires =
opentelemetry-api~=1.22
opentelemetry-sdk~=1.22
opentelemetry-exporter-otlp~=1.22
opentelemetry-instrumentation~=0.43b0
opentelemetry-api~=1.24
opentelemetry-sdk~=1.24
opentelemetry-exporter-otlp~=1.24
opentelemetry-instrumentation~=0.45b0

[options.packages.find]
where = src
Expand Down
4 changes: 1 addition & 3 deletions src/uptrace/dsn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from urllib.parse import urlparse, parse_qs

from .util import remove_prefix
from urllib.parse import parse_qs, urlparse


class DSN:
Expand Down
4 changes: 3 additions & 1 deletion src/uptrace/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
AggregationTemporality,
PeriodicExportingMetricReader,
)
from opentelemetry.sdk.metrics.view import ExponentialBucketHistogramAggregation
from opentelemetry.sdk.metrics.view import (
ExponentialBucketHistogramAggregation,
)
from opentelemetry.sdk.resources import Resource

from .dsn import DSN
Expand Down
2 changes: 1 addition & 1 deletion src/uptrace/version.py
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"

0 comments on commit 71fead7

Please sign in to comment.