Skip to main content
Glama
agarwalvivek29

OpenTelemetry MCP Server

list_log_label_values

Retrieve all distinct values for a specific log label to discover namespaces, jobs, or applications with available logs for investigation.

Instructions

Get all values for a specific log label. Common labels: 'namespace', 'job', 'app'. Use this to discover what namespaces/services have logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYesLabel name to get values for (e.g., 'namespace', 'job', 'app')
startNoStart time for value discovery
endNoEnd time for value discovery

Implementation Reference

  • The handler function 'list_log_label_values' that executes the request to Loki to fetch label values.
    async def list_log_label_values(
        client: LokiClient,
        label: str,
        start: Optional[str] = None,
        end: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Get all values for a specific log label.
        
        Args:
            client: Loki client
            label: Label name (e.g., 'namespace', 'job')
            start: Start time for value discovery
            end: End time for value discovery
            
        Returns:
            List of label values
        """
        try:
            # Parse time range if provided
            start_ns = None
            end_ns = None
            if start or end:
                start_dt, end_dt = parse_time_range(start, end)
                start_ns = to_loki_time(start_dt)
                end_ns = to_loki_time(end_dt)
            
            result = await client.label_values(label, start_ns, end_ns)
            
            if result.get("status") == "success":
                values = result.get("data", [])
                return {
                    "success": True,
                    "label": label,
                    "count": len(values),
                    "values": values
                }
            else:
                return {
                    "success": False,
                    "error": "Failed to fetch label values"
                }
        except Exception as e:

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