{"slug": "pixeltable-observability-monitoring-with-opentelemetry", "title": "Pixeltable Observability & Monitoring with OpenTelemetry", "summary": "Pixeltable released an OpenTelemetry bridge, opentelemetry-instrumentation-pixeltable 0.2.0, that emits one trace per table operation and exports it to SigNoz, with per-row and per-UDF spans enabled by setting span_level='debug'. The integration, tested with pixeltable 0.7.23, Python 3.11 and openinference-instrumentation-openai 0.1.69, attaches attributes such as pxt.udf_path, pxt.column, pxt.resource_pool and pxt.retries to UDF spans, while LLM child spans carry gen_ai.* attributes that SigNoz AI Observability reads for model name, prompt, completion and token counts. Developers initialize it once per process with pxt_otel.init(), pointing the OTLP/HTTP exporter at the SigNoz base endpoint so traces and token metrics reach /v1/traces and /v1/metrics.", "body_md": "## What is Pixeltable Observability?\n\nPixeltable is declarative data infrastructure for multimodal AI apps. Images, video, audio, documents, and model calls live in tables, and a computed column runs its transform on insert and update. Pixeltable observability records that work with [OpenTelemetry](https://opentelemetry.io/) and sends it to SigNoz.\n\nThe [Pixeltable OpenTelemetry bridge](https://github.com/pixeltable/pixeltable/tree/v0.7.23/packages/opentelemetry-instrumentation-pixeltable) emits one trace per table operation. With `span_level='debug'` the trace contains the rows, each UDF call, and, when you add an LLM instrumentor, a child span for the model request:\n\n```\npixeltable.insert\n└─ pixeltable.store.insert_rows\n   ├─ pixeltable.row\n   ├─ pixeltable.udf.chat_completions\n   │  └─ ChatCompletion\n   └─ pixeltable.sa.insert_rows\n```\n\nUDF spans carry `pxt.udf_path`, `pxt.column`, `pxt.resource_pool`, and `pxt.retries`. `pixeltable.store.write_column` spans carry `pxt.column`. The model name, prompt, completion, and token counts are attributes of the LLM child span. SigNoz [AI Observability](https://signoz.io/docs/ai-observability/) reads the `gen_ai.*` attributes on that child span.\n\n## Prerequisites\n\n- A [SigNoz Cloud account](https://signoz.io/teams/) with an active ingestion key, or a[self-hosted SigNoz](https://signoz.io/docs/install/self-host/) instance\n- Python 3.11 or later\n- An OpenAI API key if you run the example below (`OPENAI_API_KEY` )\n\nTested with Python 3.11, `pixeltable` 0.7.23, `opentelemetry-instrumentation-pixeltable` 0.2.0, and `openinference-instrumentation-openai` 0.1.69.\n\n## Monitor Pixeltable with OpenTelemetry\n\nCall `pxt_otel.init()` once per process, before the first Pixeltable operation. It builds an OTLP/HTTP exporter and instruments Pixeltable. Add `OpenAIInstrumentor` so each `openai.chat_completions` cell gets a child span. For the Pixeltable API, see the [Pixeltable documentation](https://docs.pixeltable.com).\n\n### Step 1: Install the packages\n\nInstall Pixeltable with the OpenTelemetry extra, the `openai` client, and the OpenAI instrumentor.\n\n```\npip install 'pixeltable[otel]' openai openinference-instrumentation-openai\n```\n\n`pixeltable[otel]` installs `opentelemetry-instrumentation-pixeltable` together with the OpenTelemetry SDK and the OTLP exporters. Neither Pixeltable nor the instrumentor installs `openai`, which `chat_completions()` calls.\n\n### Step 2: Point the exporter at SigNoz\n\nSet the endpoint with environment variables, or pass it to `init()` in code. `init()` appends `/v1/traces` and `/v1/metrics` to the endpoint, so pass the base URL without a path.\n\n`init()` reads these variables when you omit the matching arguments. `OTEL_SPAN_LEVEL=debug` keeps per-row and per-UDF spans. The default `info` keeps the operation span and the catalog, store, and SQL spans that belong to it.\n\n```\nexport OTEL_SERVICE_NAME=pixeltable-app\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_SPAN_LEVEL=debug\nexport OPENAI_API_KEY=<your-openai-api-key>\n```\n\n**Verify these values:**\n\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-openai-api-key>` : The API key for the provider your computed columns call.\n\nPass the SigNoz endpoint to `init()`. Leave `metrics` at its default so token counters are exported to `/v1/metrics`.\n\n```\npxt_otel.init(\n    endpoint='https://ingest.<region>.signoz.cloud:443',\n    headers='signoz-ingestion-key=<your-ingestion-key>',\n    service_name='pixeltable-app',\n    span_level='debug',\n)\n```\n\n**Verify these values:**\n\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\n`headers` uses the `OTEL_EXPORTER_OTLP_HEADERS` form: comma-separated `key=value` pairs. For Self-Hosted SigNoz, call `pxt_otel.init(endpoint='http://<signoz-host>:4318', service_name='pixeltable-app', span_level='debug')` and omit `headers`. Replace `<signoz-host>` with the address of your SigNoz collector. Set `OPENAI_API_KEY` in the environment before you run the insert.\n\n### Step 3: Initialize the bridge and insert a row\n\nInitialize the bridge, instrument OpenAI, and insert a row. If you used the **Code** tab in Step 2, replace `pxt_otel.init()` with your `init()` call.\n\n``` python\nimport opentelemetry.instrumentation.pixeltable as pxt_otel\nfrom openinference.instrumentation.openai import OpenAIInstrumentor\nfrom opentelemetry import trace\n \npxt_otel.init()\nOpenAIInstrumentor().instrument()\n \nimport pixeltable as pxt\nfrom pixeltable.functions import openai\n \ntable = pxt.create_table('articles', {'id': pxt.Int, 'body': pxt.String}, if_exists='replace')\ntable.add_computed_column(\n    summary=openai.chat_completions(\n        messages=[{'role': 'user', 'content': 'Summarize in one sentence: ' + table.body}],\n        model='gpt-4o-mini',\n    ).choices[0].message.content\n)\ntable.insert([{'id': 1, 'body': 'Pixeltable is declarative data infrastructure for multimodal AI apps.'}])\ntrace.get_tracer_provider().force_flush()\n```\n\n`force_flush()` sends the batched spans right away. Without it, the SDK sends them when the process exits normally. Metrics go out on a periodic reader, about once a minute. To send them right away, flush the meter provider as well:\n\n``` python\nfrom opentelemetry import metrics\n \nmetrics.get_meter_provider().force_flush()\n```\n\n`init()` reuses a tracer provider that your application already registered.\n\nOpenInference sets `llm.model_name`, `llm.provider`, and `llm.token_count.*` on the `ChatCompletion` span. The default `gen_ai.llm` group in [Attribute Mapping](https://signoz.io/docs/ai-observability-attribute-mapping/) copies them to the `gen_ai.*` attributes that [AI Observability](https://signoz.io/docs/ai-observability-telemetry-requirements/) reads. To emit `gen_ai.*` from the process, set `OPENINFERENCE_ENABLE_GENAI_SEMCONV=true`.\n\n## Validate\n\nOpen the [Traces Explorer](https://signoz.io/docs/userguide/traces/) and filter on the service name and the operation:\n\n```\nservice.name = 'pixeltable-app' AND name = 'pixeltable.insert'\n```\n\nOpen the trace. The waterfall shows `pixeltable.udf.chat_completions` under `pixeltable.store.insert_rows`, and `ChatCompletion` under the UDF span. The prompt and completion are attributes on `ChatCompletion`.\n\nPixeltable also exports metrics when an endpoint is set. In the [Metrics Explorer](https://signoz.io/docs/metrics-management/metrics-explorer/), query:\n\n- `pixeltable.udf.input_tokens` and`pixeltable.udf.output_tokens` , with attribute`pxt.model` (and`pxt.udf_path` )\n- `pixeltable.udf.calls` and`pixeltable.udf.latency`\n- `pixeltable.rows.written` , with attribute`pxt.table`\n\nThe metric scope name is `pixeltable`. The same insert recorded input and output tokens on `pxt.model=gpt-4o-mini`.\n\n`collect()` writes a `pixeltable.collect` trace and does not call the model again. Computed values are stored. New LLM spans appear on `insert`, on `update`, and when `add_computed_column` backfills rows that already exist.\n\n## View in AI Observability\n\n[AI Observability](https://signoz.io/docs/ai-observability/) shows the cost, token usage, latency, and errors of the LLM calls that Pixeltable computed columns make. In SigNoz, open **AI Observability**, and select your service in the **service_name** filter.\n\nAI Observability counts the `ChatCompletion` span as an LLM call. After one insert, it shows 1 LLM call for `gpt-4o-mini-2024-07-18`, the model name that OpenAI returns, with its input and output tokens. SigNoz calculates the cost from its built-in price for that model. One call costs a fraction of a cent, so the **Total cost** tile rounds it to $0, and the **Cost breakdown** panel shows the input and output split. For a model without a price, cost reads $0 until you add a [model pricing](https://signoz.io/docs/ai-observability-model-pricing/) rule for the model name. Time to first token reads 0s for a non-streaming call.\n\nTo query single traces, open the **Explorer** tab. **Trace View** shows one row for each trace, with totals such as tokens, cost, and call counts. You can filter, aggregate, and sort by these totals, for example `trace.total_tokens > 1000`. For details, see [AI Observability Explorer](https://signoz.io/docs/ai-observability-explorer/).\n\nIf the panels stay empty, make sure that your spans carry the attributes in [Telemetry Requirements](https://signoz.io/docs/ai-observability-telemetry-requirements/). To map other attribute names, use [Attribute Mapping](https://signoz.io/docs/ai-observability-attribute-mapping/).\n\n## Limitations\n\n- Every operation is a trace. `create_table` ,`drop_table` ,`add_computed_column` , and`collect` each start their own trace.`span_level='debug'` adds per-row spans, per-UDF spans, and finer catalog and store spans such as`pixeltable.catalog.*` . At`info` , those per-row and per-UDF spans are dropped, and the LLM span stays in the insert trace without a`pixeltable.udf.chat_completions` parent.\n- `ChatCompletion` carries the prompt and the completion, so both leave the process. Pixeltable log export stays off unless you pass`logs=True` . It then exports the records of the`pixeltable` loggers, such as catalog and scheduler messages. An OpenAI error record shows the API key masked, except for its last 4 characters.\n\n## ## Troubleshooting Pixeltable Observability\n\n### No traces in SigNoz\n\nThe insert returned a row, and the Traces Explorer is empty for `service.name = 'pixeltable-app'`.\n\n- `pxt_otel.init()` ran with no endpoint and stayed inert. Restart the process and call`init()` with the endpoint.\n- The process was killed before it exited normally, so the SDK did not send the batched spans. Call `trace.get_tracer_provider().force_flush()` after the operations you want to see.\n- The `<region>` in the endpoint does not match the SigNoz Cloud account that owns the ingestion key.\n- Wait 10-30 seconds. The exporter and SigNoz both batch.\n\n### The operation span is there, and the LLM span is missing\n\n`pixeltable.insert` is visible, and `ChatCompletion` is not.\n\n- `OpenAIInstrumentor().instrument()` did not run, or it logged a dependency conflict because`openai` is not installed. Install`openai` and restart the process.\n- `span_level` is`info` , so there is no UDF span. The LLM span should still be in the insert trace. Search the trace for`ChatCompletion` before assuming the call was dropped.\n- `collect()` does not re-run computed columns. Insert or update a row to produce a new model call.\n- The OpenAI client returned an error. The `insert` call raises`RequestError` with the OpenAI error message, and the`pixeltable.insert` ,`pixeltable.udf.chat_completions` , and`ChatCompletion` spans are marked as errors. Filter on`has_error = true` to find them.\n\n### Auth errors (401 / 403)\n\nThe exporter logs this line when SigNoz rejects the ingestion key:\n\n```\nFailed to export spans batch code: 401, reason: Unauthorized\n```\n\nThe `signoz-ingestion-key` header must be the key from **Settings > Ingestion** in SigNoz, with no extra spaces or quotes. `headers` is a single string, `signoz-ingestion-key=<your-ingestion-key>`, not a Python dict. A dict fails in `init()` with `TypeError: expected string or bytes-like object, got 'dict'`.\n\n### Endpoint issues\n\nUse `https://ingest.<region>.signoz.cloud:443` for SigNoz Cloud and `http://<signoz-host>:4318` for Self-Hosted SigNoz. Use `localhost` only when the collector runs on the same host and in the same network namespace as the application. `init()` appends `/v1/traces` and `/v1/metrics` to the endpoint. Pass the base URL. An endpoint ending in `/v1/traces` still exports traces, but metrics fail with `Failed to export metrics batch code: 404, reason: Not Found`. Do not send OTLP/HTTP to the gRPC port `4317`.\n\nSetting only `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` does not start an exporter. Set `OTEL_EXPORTER_OTLP_ENDPOINT` or pass `endpoint` to `init()`.\n\n### AttributeError: 'ProxyTracerProvider' object has no attribute 'force_flush'\n\n`init()` found no endpoint, so it did not register a tracer provider. This happens when no endpoint is set, when only `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is set, or when `opentelemetry-instrument` runs without `opentelemetry-distro`. Set `OTEL_EXPORTER_OTLP_ENDPOINT` or pass `endpoint` to `init()`.\n\n### Instrumentation is already initialized\n\nA second `init()` in the same process raises `RequestError: pixeltable OpenTelemetry instrumentation is already initialized`. In a notebook, this happens when you run the `init()` cell again. To change the `init()` arguments, restart the kernel or the process.\n\n### Too many spans\n\n`span_level='debug'` records per-row, per-UDF, and finer catalog and store spans as well as the insert. Set `OTEL_SPAN_LEVEL=info` or `span_level='info'` to drop those finer spans. Filter the Explorer with `name = 'pixeltable.insert'` while you are on `debug`.\n\n## ## Setup OpenTelemetry Collector (Optional)\n\n### What is the OpenTelemetry Collector?\n\nThe OpenTelemetry Collector sits between your app and SigNoz. The application sends OTLP to the Collector, and the Collector forwards it to SigNoz.\n\n### Why use it?\n\n- Cleaning up data: Drop noisy catalog spans, or remove prompt attributes before they leave your network.\n- Keeping your app lightweight: The Collector handles batching, retries, and compression.\n- Adding context: The Collector can add the Kubernetes pod or cloud region.\n- More than one backend: You can fan out later without changing the Pixeltable process.\n\nSee [Switch from direct export to Collector](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/switch-to-collector/) for the steps. For more detail, see [Why use the OpenTelemetry Collector?](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/why-to-use-collector/) and the [Collector configuration guide](https://signoz.io/docs/opentelemetry-collection-agents/opentelemetry-collector/configuration/).\n\n## Related integrations\n\n- [DSPy observability with OpenTelemetry](https://signoz.io/docs/dspy-observability/) for module, chain, and tool spans from DSPy programs\n- [OpenAI monitoring](https://signoz.io/docs/openai-monitoring/) for OpenAI API calls outside Pixeltable\n- [LangChain and LangGraph observability](https://signoz.io/docs/langchain-observability/) for chains, agents, and tool calls\n- [LlamaIndex observability](https://signoz.io/docs/llamaindex-observability/) for RAG queries and retrievers\n- [AI Observability telemetry requirements](https://signoz.io/docs/ai-observability-telemetry-requirements/) for the`gen_ai.*` attributes the dashboards read\n\nBrowse [all LLM observability integrations](https://signoz.io/docs/llm-observability/) to instrument the rest of the stack.", "url": "https://wpnews.pro/news/pixeltable-observability-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/pixeltable-observability", "published_at": "2026-11-27 00:00:00+00:00", "updated_at": "2026-11-30 11:14:25.536539+00:00", "lang": "en", "topics": ["artificial-intelligence", "mlops", "ai-agents", "developer-tools"], "entities": ["Pixeltable", "OpenTelemetry", "SigNoz", "OpenAI", "opentelemetry-instrumentation-pixeltable", "openinference-instrumentation-openai", "Python"], "also_reported_by": [], "takeaway": "Call pxt_otel.init() once per process before the first Pixeltable operation and set OTEL_SPAN_LEVEL=debug to get per-row and per-UDF spans, with LLM child spans carrying gen_ai.* attributes for SigNoz AI Observability.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/pixeltable-observability-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/pixeltable-observability-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/pixeltable-observability-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/pixeltable-observability-monitoring-with-opentelemetry.jsonld"}}