> ## Documentation Index
> Fetch the complete documentation index at: https://medlogprotocol.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Telemetry standards

> Emitting MedLog records as OpenTelemetry telemetry with a MedLog semantic convention.

For operational telemetry, [OpenTelemetry](https://opentelemetry.io/) provides consistent schemas and
collectors to transport and store event data across languages and platforms.

A MedLog **semantic convention** can be defined as a custom OpenTelemetry registry using
[OpenTelemetry Weaver](https://github.com/open-telemetry/weaver), reusing existing OpenTelemetry
attributes where their semantics match and defining `medlog.*` attributes for concepts specific to
medical AI.

## Reusing Gen AI conventions

When logging generative AI models, existing OpenTelemetry
[Gen AI semantic conventions](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/)
can be reused.

| MedLog field | OpenTelemetry attribute |
| - | - |
| `run_id` in the [Header](/specification/header) | [`gen_ai.conversation.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-conversation-id) |
| [Model instance](/specification/model-instance) | [`gen_ai.request.model`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-request-model) |
| Prompts in [Inputs](/specification/inputs) | [`gen_ai.input.messages`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-input-messages), [`gen_ai.system_instructions`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-system-instructions) |
| Responses in [Outputs](/specification/outputs) | [`gen_ai.output.messages`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-output-messages) |
| Tool and retrieval operations in [Internal artifacts](/specification/internal-artifacts) | [`gen_ai.tool.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-name), `gen_ai.retrieval.documents` |
| Evaluation of output in [User feedback](/specification/user-feedback) | [`gen_ai.evaluation`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-evaluation-name) |

Users and sessions can also be represented with existing
[User](https://opentelemetry.io/docs/specs/semconv/registry/attributes/user/) and
[Session](https://opentelemetry.io/docs/specs/semconv/registry/attributes/session/) semantic conventions
such as `user.id` and `user.name`.

## Emitting and collecting records

MedLog records can then be emitted as OpenTelemetry telemetry, and an **OpenTelemetry Collector** can
receive, process, and export these records to observability platforms. This approach enables integration
of MedLog with existing tracing, logging, and monitoring infrastructure.

<Frame>
  ```mermaid theme={null}
  flowchart LR
    APP["Instrumented model<br/>call or gateway"] -- "medlog.* + gen_ai.* attributes" --> COL["OpenTelemetry<br/>Collector"]
    COL --> OBS["Observability<br/>platform"]
    COL --> STORE["MedLog record<br/>store"]
  ```
</Frame>

<Warning>
  Derived OpenTelemetry attributes **do not replace** the canonical MedLog payload. Populate trace and
  span identifiers only when genuine tracing context exists, and reuse an attribute only when its
  semantics actually match the MedLog field.
</Warning>
