@@ -88,11 +88,7 @@ class MetricsConfig(BaseMetricsConfig):
8888
8989@dataclass (slots = True , frozen = True )
9090class TracingConfig :
91- """
92- Configuration class for the OpenTelemetry middleware.
93- Consult the OpenTelemetry ASGI documentation for more info about the configuration options.
94- https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/asgi/asgi.html
95- """
91+ """Configuration class for the OpenTelemetry middleware."""
9692
9793 scope_span_details_extractor : Callable [[Request ], tuple [str , dict [str , Any ]]] = _get_default_span_details
9894 """
@@ -228,6 +224,15 @@ async def get_metrics(request: Request) -> Response:
228224
229225
230226def setup_metrics (app : Application , config : MetricsConfig ) -> None :
227+ """
228+ Set up metrics for an Aiohttp application.
229+ This function adds a metrics_middleware to the Aiohttp application with the specified parameters.
230+
231+ :param Aiohttp app: The Aiohttp application instance.
232+ :param MetricsConfig config: Configuration for the metrics.
233+ :returns: None
234+ """
235+
231236 metrics = build_metrics_manager (config )
232237 metrics .add_app_info ()
233238
@@ -243,6 +248,15 @@ def setup_metrics(app: Application, config: MetricsConfig) -> None:
243248
244249
245250def setup_tracing (app : Application , config : TracingConfig ) -> None :
251+ """
252+ Set up tracing for an Aiohttp application.
253+ The function adds a tracing_middleware to the Aiohttp application based on TracingConfig.
254+
255+ :param Aiohttp app: The Aiohttp application instance.
256+ :param TracingConfig config: The OpenTelemetry config.
257+ :return: None
258+ """
259+
246260 app .middlewares .append (build_tracing_middleware (config ))
247261
248262
0 commit comments