Skip to main content
Glama
agarwalvivek29

OpenTelemetry MCP Server

list_labels

Discover available label names in Prometheus metrics to identify filtering options for data analysis and troubleshooting.

Instructions

Get all label names available in Prometheus. Use this to discover what labels you can filter by.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricNoOptional metric name to get labels for

Implementation Reference

  • The actual implementation of the 'list_labels' tool, which queries Prometheus for label names.
    async def list_labels(
        client: PrometheusClient,
        metric: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Get all label names in Prometheus.
        
        Args:
            client: Prometheus client
            metric: Optional metric to get labels for
            
        Returns:
            List of label names
        """
        try:
            match = [f"{{{metric}}}"] if metric else None
            result = await client.labels(match)
            
            if result.get("status") == "success":
                labels = result.get("data", [])
                return {
                    "success": True,
                    "count": len(labels),
                    "labels": labels
                }
            else:
                return {
                    "success": False,
                    "error": "Failed to fetch labels"
                }
        except Exception as e:
            logger.error(f"Error listing labels: {e}")
            return {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agarwalvivek29/opentelemetry-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server