open-telemetry / open-telemetry/opentelemetry-python-contrib

Proposal: allow instrumentations to record individual multimodal data

Open
#4,097 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

This proposal is inspired by the design of the completion_hook in the current opentelemetry-util-genai package. It allows for the entire input/output messages to be uploaded to external storage when an LLM span ends, while saving a reference to that storage within the span attributes. Effectively, this gives us three options for persisting messages: recording them as span attributes, recording them as span events, or packaging and uploading them to external storage. This is a highly flexible and valuable design.

While OpenTelemetry provides a broad range of implementation possibilities, I believe most vendors will only recommend one or two of these approaches—and we are no exception. Our users consistently prefer using span attributes to record all messages, as it is more intuitive and convenient for immediate viewing.

However, when multimodal data is included in these messages, its display and consumption become problematic. If the data is raw, it is typically encoded as Base64 strings embedded directly within the json of messages. This bulky Base64 data is difficult to store and even harder to consume (for instance, for visualization or building vector indices).

Therefore, we propose adding an optional mode to opentelemetry-util-genai that allows for reporting multimodal data independently. In this mode, all raw multimodal data would be uploaded to a designated file system and referenced via a URI path, as illustrated in the bottom half of the image below:

Image

There're a prototype implementation in our distro repo, which is used by many customers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review opentelemetry-util-genai/src/opentelemetry/util/genai/completion_hook.py and the prototype in _multimodal_processing.py, especially lines 137-176. Determine how an optional mode should upload raw multimodal data to a designated filesystem and reference it by URI instead of embedding Base64 data. Done means the proposed behavior is implemented with appropriate coverage for multimodal messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.