Creates OpenTelemetry histogram metrics to track MCP client and server operation and session durations.
# Source: https://github.com/open-telemetry/opentelemetry-python | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
from typing import Final
from opentelemetry.metrics import Histogram, Meter
MCP_CLIENT_OPERATION_DURATION: Final = "mcp.client.operation.duration"
"""
Deprecated: Moved to the [OpenTelemetry GenAI semantic conventions repository](https://github.com/open-telemetry/semantic-conventions-genai).
"""
def create_mcp_client_operation_duration(meter: Meter) -> Histogram:
"""The duration of the MCP request or notification as observed on the sender from the time it was sent until the response or
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key