{"slug": "meta-muse-spark-monitoring-with-opentelemetry", "title": "Meta Muse Spark Monitoring with OpenTelemetry", "summary": "SigNoz published a guide for monitoring Meta's Muse Spark reasoning model family through the OpenAI-compatible Meta Model API using standard OpenTelemetry instrumentation, with the model muse-spark-1.3 priced at $1.25 per million input tokens, $0.15 per million cached input tokens, and $4.25 per million output tokens. The guide states that stock instrumentation drops reasoning tokens, cached input tokens, and time to first chunk, and that cached input is roughly 8x cheaper on the standard tier, causing span-derived cost to overstate real spend by three to five times. It requires Python 3.9 or later, a Meta Model API key, and a SigNoz Cloud account or self-hosted SigNoz instance, and notes that only Chat Completions is traced while the Responses API produces no span.", "body_md": "## What is Meta Muse Spark Monitoring?\n\nMeta Muse Spark is a reasoning model family served through the Meta Model API. Because the API is OpenAI compatible, you instrument it with the standard OpenTelemetry OpenAI instrumentation rather than a provider specific library, which gives you request traces, model and token usage, latency, and errors.\n\nWith full Muse Spark monitoring in SigNoz, you can attribute spend to a model and a tier, watch how much of every response is spent on reasoning the caller never sees, measure the wait before the first visible token, and catch the truncated responses that a plain error rate misses.\n\n## Prerequisites\n\n- A [SigNoz Cloud account](https://signoz.io/teams/) with an active ingestion key, or a[self-hosted SigNoz instance](https://signoz.io/docs/install/self-host/)\n- Python 3.9 or later\n- A Meta Model API key from the [Meta AI developer site](https://developer.meta.com/ai/)\n- Network access to `api.meta.ai` and to SigNoz\n\n## Monitor Meta Muse Spark with OpenTelemetry\n\nMuse Spark is reached over an OpenAI compatible endpoint, so `opentelemetry-instrument` can trace it with no changes to your application code.\n\n1. \n**Step 1:** Install the SDK, the OpenTelemetry distro, and the exporter, then let bootstrap add the matching instrumentation.\n\n```\npip install openai httpx opentelemetry-distro opentelemetry-exporter-otlp\nopentelemetry-bootstrap --action=install\n```\n\n2. \n**Step 2:** Point the OpenAI client at the Meta Model API. Only the base URL and the key change.\n\n``` python\nfrom openai import OpenAI\n \nclient = OpenAI(\n    api_key=\"<your-meta-model-api-key>\",\n    base_url=\"https://api.meta.ai/v1\",\n)\n \nresponse = client.chat.completions.create(\n    model=\"muse-spark-1.3\",\n    max_tokens=4096,\n    messages=[{\"role\": \"user\", \"content\": \"Summarize this incident report.\"}],\n)\n```\n\n3. \n**Step 3:** Configure the exporter.\n\n```\nexport OTEL_SERVICE_NAME=<service_name>\nexport OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<region>.signoz.cloud:443\nexport OTEL_EXPORTER_OTLP_HEADERS=signoz-ingestion-key=<your-ingestion-key>\nexport OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf\nexport OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT\n```\n\n **Verify these values:**\n  - `<service_name>` : A name for your application, for example`muse-chat-api` .\n  - `<region>` : Your[SigNoz Cloud region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint) .\n  - `<your-ingestion-key>` : Your SigNoz[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/) .\n  - `<your-meta-model-api-key>` : Your Meta Model API key.\n4. \n**Step 4:** Run your application under the agent.\n\n```\nopentelemetry-instrument python your_app.py\n```\n\nEach call emits a `chat <model>` span with model, finish reason, and token counts. Only Chat Completions is traced; the Responses API produces no span.\n\n## Capture Reasoning Tokens, Cache Reads, and Cost\n\nThe stock instrumentation drops reasoning tokens, cached input tokens, and time to first chunk. Cached input is roughly 8x cheaper on the standard tier, so cost derived from spans alone overstates real spend by three to five times.\n\nWrap your calls in a span that reads them off the response. Setting `gen_ai.provider.name` to `meta` separates Muse Spark from other providers on the same SDK and stops the wrapper and SDK spans double counting requests.\n\n``` python\nimport time\nfrom contextlib import contextmanager\n \nfrom opentelemetry import trace\n \ntracer = trace.get_tracer(\"muse-spark\")\n \n# USD per token: (input, cached input, output)\nPRICES = {\n    \"muse-spark-1.3\": (1.25e-6, 0.15e-6, 4.25e-6),\n    \"muse-spark-1.3-contributor\": (0.10e-6, 0.002e-6, 0.20e-6),\n}\n \n \n@contextmanager\ndef muse_call(model):\n    with tracer.start_as_current_span(f\"muse.chat {model}\") as span:\n        span.set_attribute(\"gen_ai.operation.name\", \"chat\")\n        span.set_attribute(\"gen_ai.provider.name\", \"meta\")\n        span.set_attribute(\"gen_ai.request.model\", model)\n        span.set_attribute(\"server.address\", \"api.meta.ai\")\n \n        call = {}\n        started = time.monotonic()\n        yield call\n \n        response = call.get(\"response\")\n        if response is None or response.usage is None:\n            return\n \n        usage = response.usage\n        cached = getattr(usage.prompt_tokens_details, \"cached_tokens\", 0) or 0\n        reasoning = getattr(usage.completion_tokens_details, \"reasoning_tokens\", 0) or 0\n        fresh = usage.prompt_tokens - cached\n \n        input_price, cached_price, output_price = PRICES[model]\n        cost = (fresh * input_price) + (cached * cached_price) + (usage.completion_tokens * output_price)\n \n        span.set_attribute(\"gen_ai.usage.input_tokens\", usage.prompt_tokens)\n        span.set_attribute(\"gen_ai.usage.output_tokens\", usage.completion_tokens)\n        span.set_attribute(\"gen_ai.usage.cache_read.input_tokens\", cached)\n        span.set_attribute(\"gen_ai.usage.reasoning.output_tokens\", reasoning)\n        span.set_attribute(\"gen_ai.cost.total_cost\", round(cost, 8))\n        span.set_attribute(\n            \"gen_ai.response.finish_reasons\",\n            [choice.finish_reason for choice in response.choices],\n        )\n        if call.get(\"first_chunk_at\") is not None:\n            span.set_attribute(\n                \"gen_ai.response.time_to_first_chunk\",\n                round(call[\"first_chunk_at\"] - started, 3),\n            )\n```\n\nUse it around each request:\n\n```\nwith muse_call(\"muse-spark-1.3\") as call:\n    call[\"response\"] = client.chat.completions.create(\n        model=\"muse-spark-1.3\",\n        max_tokens=4096,\n        messages=[{\"role\": \"user\", \"content\": \"Summarize this incident report.\"}],\n    )\n```\n\nFor a streaming call, record `call[\"first_chunk_at\"] = time.monotonic()` when the first content chunk arrives, and set `stream_options={\"include_usage\": True}` so the usage record is sent.\n\n## View Meta Muse Spark Traces in SigNoz\n\nFilter the Traces explorer on `gen_ai.provider.name = 'meta'` to see only Muse Spark calls.\n\nOpening a trace shows the wrapper span with the SDK span nested under it, and the full attribute set on the right.\n\n## Meta Muse Spark Monitoring Dashboard\n\nImport the [Muse Spark dashboard](https://signoz.io/docs/dashboards/dashboard-templates/muse-spark-dashboard/) to get cost, token, latency, and reliability panels without building them yourself.\n\n## ## Troubleshooting Meta Muse Spark Monitoring\n\n### No traces appear in SigNoz\n\nConfirm the application was launched with `opentelemetry-instrument`, and that `OTEL_EXPORTER_OTLP_ENDPOINT` carries your region and the ingestion key header is set. Set `OTEL_TRACES_EXPORTER=console` to see what is produced locally.\n\n### Spans named POST with no gen_ai attributes\n\nThe instrumentor was skipped because `httpx` is not installed. Run `pip install httpx` and restart.\n\n### Responses come back empty\n\n`gen_ai.response.finish_reasons` is `length`, meaning `max_tokens` was consumed by reasoning before any visible output. Raise the budget.\n\n### Errors cannot be told apart\n\nThe instrumentation sets no `error.type`, and error spans carry no usage attributes. Read the span status message for the provider error string.\n\n## ## Setup OpenTelemetry Collector (Optional)\n\nIf you already run an [OpenTelemetry Collector](https://signoz.io/docs/collection-agents/), point the application at it with `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318` and configure the Collector's OTLP exporter with your SigNoz endpoint and ingestion key.\n\n## Related integrations\n\nInstrument the other model APIs your team calls, using the same OpenTelemetry pipeline:\n\n- [Monitor the OpenAI API with OpenTelemetry](https://signoz.io/docs/openai-monitoring/) - track token usage, model latency, and error rates across every call\n- [Anthropic monitoring with OpenTelemetry](https://signoz.io/docs/anthropic-monitoring/) - trace Claude API calls, usage trends, and failures\n- [Mistral AI observability with OpenTelemetry](https://signoz.io/docs/mistral-observability/) - monitor model performance, traces, and token spend\n- [DeepSeek monitoring with OpenTelemetry](https://signoz.io/docs/deepseek-monitoring/) - track latency, error rates, and token usage\n\nBrowse [all LLM observability integrations](https://signoz.io/docs/llm-observability/) to instrument the rest of your stack.", "url": "https://wpnews.pro/news/meta-muse-spark-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/muse-spark-monitoring", "published_at": "2026-09-09 00:00:00+00:00", "updated_at": "2026-09-11 10:04:21.871371+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "mlops", "developer-tools", "ai-infrastructure"], "entities": ["Meta", "Muse Spark", "SigNoz", "OpenTelemetry", "Meta Model API", "muse-spark-1.3", "Python", "OpenAI"], "alternates": {"html": "https://wpnews.pro/news/meta-muse-spark-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/meta-muse-spark-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/meta-muse-spark-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/meta-muse-spark-monitoring-with-opentelemetry.jsonld"}}