diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90d0afa..c058019 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} @@ -24,7 +24,7 @@ jobs: images: ghcr.io/${{ github.repository }} - name: Login to ghcr - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml index 5df44e6..ed72395 100644 --- a/.github/workflows/tester.yml +++ b/.github/workflows/tester.yml @@ -16,14 +16,14 @@ jobs: python-version: [3.11.0] steps: - name: Checkout the repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Create environment variables run: | echo "PYTHONPATH=$PWD" >> $GITHUB_ENV - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/requirements.txt b/requirements.txt index 42f2acc..0ea61f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,9 +16,9 @@ redis~=3.5.3 requests==2.28.1 uvicorn==0.17.6 uvloop==0.19.0 -opentelemetry-sdk==1.16.0 -opentelemetry-instrumentation-fastapi==0.37b0 -opentelemetry-exporter-jaeger==1.16.0 -opentelemetry-instrumentation-httpx==0.37b0 +opentelemetry-sdk==1.27.0 +opentelemetry-instrumentation-fastapi==0.48b0 +opentelemetry-exporter-otlp-proto-grpc==1.27.0 +opentelemetry-instrumentation-httpx==0.48b0 fakeredis<=2.10.2 networkx==3.2.1 diff --git a/src/otel_config.py b/src/otel_config.py index a55cc7c..059a6f8 100644 --- a/src/otel_config.py +++ b/src/otel_config.py @@ -8,7 +8,7 @@ def configure_otel(service_name, APP): from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor from opentelemetry import trace - from opentelemetry.exporter.jaeger.thrift import JaegerExporter + from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import SERVICE_NAME as telemetery_service_name_key, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor @@ -19,20 +19,14 @@ def configure_otel(service_name, APP): # these supresses such warnings. logging.captureWarnings(capture=True) warnings.filterwarnings("ignore",category=ResourceWarning) - jaeger_host = os.environ.get('JAEGER_HOST', 'jaeger-otel-agent') - jaeger_port = int(os.environ.get('JAEGER_PORT', '6831')) - trace.set_tracer_provider( - TracerProvider( - resource=Resource.create({telemetery_service_name_key: service_name}) - ) + jaeger_host = os.environ.get('JAEGER_HOST', 'http://localhost/').rstrip('/') + jaeger_port = int(os.environ.get('JAEGER_PORT', '4317')) + jaeger_endpoint = f'{jaeger_host}:{jaeger_port}' + otlp_exporter = OTLPSpanExporter(endpoint=jaeger_endpoint) + tracer_provider = TracerProvider( + resource=Resource.create({telemetery_service_name_key: service_name}) ) - jaeger_exporter = JaegerExporter( - agent_host_name=jaeger_host, - agent_port=jaeger_port, - ) - trace.get_tracer_provider().add_span_processor( - BatchSpanProcessor(jaeger_exporter) - ) - tracer = trace.get_tracer(__name__) - FastAPIInstrumentor.instrument_app(APP, tracer_provider=trace, excluded_urls="docs,openapi.json") + tracer_provider.add_span_processor(BatchSpanProcessor(otlp_exporter)) + trace.set_tracer_provider(tracer_provider) + FastAPIInstrumentor.instrument_app(APP, tracer_provider=tracer_provider, excluded_urls="docs,openapi.json") HTTPXClientInstrumentor().instrument()