Skip to content

Add gen_ai.request.stop_sequences attribute #5813

@ericapisani

Description

@ericapisani

Problem

OTel GenAI semconv recommends capturing gen_ai.request.stop_sequences (string[]). Google's GenerateContentConfig has a stop_sequences parameter, but it is not captured by the integration.

Context

Other config parameters (temperature, top_p, top_k, max_output_tokens, presence_penalty, frequency_penalty, seed) are already captured in the param loop at utils.py:834-846. Adding stop_sequences follows the same pattern.

Files

  • sentry_sdk/integrations/google_genai/utils.pyset_span_data_for_request()
  • sentry_sdk/consts.py — may need a new SPANDATA constant if one doesn't exist

Acceptance Criteria

  • stop_sequences from GenerateContentConfig is captured on the span
  • Test added to verify the attribute is set when stop_sequences is provided

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions