We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aiohttp has hooks that would allow this instrumentation to report spans and/or dns related metrics.
this is useful to identify dns issues or bottlenecks on cluster instances
https://docs.aiohttp.org/en/stable/tracing_reference.html
I'd like to have visibility over dns resolution for my http calls
extend the instrumentation in my own codebase
No response
None
The text was updated successfully, but these errors were encountered:
In the meantime
from types import SimpleNamespace from typing import Any import aiohttp from opentelemetry import context, trace from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor from opentelemetry.instrumentation.utils import is_instrumentation_enabled from opentelemetry.trace import SpanKind, get_tracer class AioHTTPInstrumentor(AioHttpClientInstrumentor): def _instrument(self, **kwargs: Any) -> None: tracer = get_tracer(__name__) async def on_dns_resolvehost_start( _session: aiohttp.ClientSession, trace_config_ctx: SimpleNamespace, params: aiohttp.TraceDnsResolveHostStartParams, ) -> None: if not is_instrumentation_enabled(): trace_config_ctx.span = None return trace_config_ctx.span = tracer.start_span( "dns_resolvehost", kind=SpanKind.CLIENT, attributes={"host": params.host} ) trace_config_ctx.token = context.attach( trace.set_span_in_context(trace_config_ctx.span) ) async def on_dns_resolvehost_end( _session: aiohttp.ClientSession, trace_config_ctx: SimpleNamespace, _params: aiohttp.TraceDnsResolveHostEndParams, ) -> None: if trace_config_ctx.span is None: return context.detach(trace_config_ctx.token) trace_config_ctx.span.end() trace_config = aiohttp.TraceConfig() trace_config.on_dns_resolvehost_start.append(on_dns_resolvehost_start) trace_config.on_dns_resolvehost_end.append(on_dns_resolvehost_end) super()._instrument(**kwargs, trace_configs=[trace_config])
Sorry, something went wrong.
No branches or pull requests
What problem do you want to solve?
aiohttp has hooks that would allow this instrumentation to report spans and/or dns related metrics.
this is useful to identify dns issues or bottlenecks on cluster instances
https://docs.aiohttp.org/en/stable/tracing_reference.html
Describe the solution you'd like
I'd like to have visibility over dns resolution for my http calls
Describe alternatives you've considered
extend the instrumentation in my own codebase
Additional Context
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: