Skip to content

Commit

Permalink
trying to fix excluded urls
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Oct 24, 2024
1 parent b6da706 commit d23f73f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Automat/automat/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ async def __call__(self, scope, receive, send):
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
from opentelemetry.util.http import ExcludeList

# from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
# would need requirement like opentelemetry-instrumentation-aiohttp-client==0.48b0

Expand All @@ -55,6 +57,10 @@ async def __call__(self, scope, receive, send):
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)

# NOTE - This is here because OpenTelemetryMiddleware excluded_urls actually expects ExcludeList and not the typical
# comma separated regex list. In the future if we upgrade OpenTelemetryMiddleware we might have to change this.
exclude_list = ExcludeList(['heartbeat', 'meta', 'openapi'])

# Enable OpenTelemetry instrumentation
app = OpenTelemetryMiddleware(app)
app = OpenTelemetryMiddleware(app, excluded_urls=exclude_list)
# AioHttpClientInstrumentor().instrument()

0 comments on commit d23f73f

Please sign in to comment.