Skip to content

otel lint: high-cardinality GenAI attributes used as metric attributes #3042

Closed

Description

@lex00

Sub-issue 4 of #3039.

Several GenAI attributes take a new value on every request or conversation. Used as a metric attribute, each one gives a new time series per request. That is how a GenAI metrics pipeline blows up a Prometheus server. The collector accepts such a config without a warning.

The attributes: gen_ai.conversation.id, gen_ai.response.id, gen_ai.tool.call.id, gen_ai.request.previous_response.id, gen_ai.memory.record.id, and the general session.id, user.id, enduser.id. Content keys (gen_ai.input.messages and the others in GENAI_CONTENT_ATTRIBUTES) are worse still: they are unbounded, and sensitive too.

Scope

A post-synth check (next free OTEL1xx number) that reports any of these keys used as a metric attribute:

The list lives beside GENAI_ATTRIBUTES in src/genai.ts, so #3044's additions extend it. A caller who has bounded one of these keys some other way can suppress the check for it, through whatever suppression post-synth checks already support.

Acceptance

Activity

  1. added
    enhancement
    area:otel
    followup:lexicon-maturity
    area:lint
    on Sep 30, 2026
  2. lex00 commented on Oct 1, 2026

    @lex00
    ContributorAuthor

    Design notes for #3070 (OTEL116):

    • Source of the key list: GENAI_SEMCONV_PIN (semantic-conventions v1.41.1) defines gen_ai.conversation.id, gen_ai.response.id, gen_ai.tool.call.id (model/gen-ai/registry.yaml), session.id, user.id and enduser.id. gen_ai.request.previous_response.id and gen_ai.memory.record.id are not at the pin; they are on semantic-conventions-genai main (checked at b31e9e8). They stay in the list because instrumentation sets them already, and the docs table says which source each key comes from.
    • The check runs inside validateCollectorConfig, so WK8604 reports it for ConfigMap configs under OTEL116.
    • An empty or unset signaltometrics include_resource_attributes keeps all resource attributes. What those are depends on the SDK, so it is not reported. Only keys that are listed get reported.
    • servicegraph dimensions is checked as well, because it is the same kind of field.
    • Severity is warning, and the audit entry is merge-worthy with category efficiency. Suppression is lint.rules: { OTEL116: "off" }, because post-synth checks take no per-key options.
    • otel: emit gen_ai.client.operation.duration and gen_ai.client.token.usage from spans, opt-in #3041 compatibility: the v1.41.1 client metrics' attributes (operation, provider, request and response model, server address and port, error type, token type) pass, and a test asserts it. genai.test.ts runs every genAiPipeline() option set through validateCollectorConfig, so otel: emit gen_ai.client.operation.duration and gen_ai.client.token.usage from spans, opt-in #3041's option set will be checked once it is added there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintarea:otelenhancementfollowup:lexicon-maturity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions