Skip to content

Make OpenAITelemetryPlugin record report metrics only if 'recording' is on #1440

Description

@bartizan

The OpenAITelemetryPlugin should only record some report metrics when the 'recording' state is active.
Currently, all records are collected and compiled into a report after recoding is stopped.

Activity

  1. waldekmastykarz commented on Nov 13, 2025

    @waldekmastykarz
    Collaborator

    We chose to send metrics without recording because we're sending them live, as we're intercepting requests. Is there a reason why you'd want to capture metrics only while recording?

  2. changed the title [-]Make OpenAITelemetryPlugin record metrics only if 'recording' is on[/-] [+]Make OpenAITelemetryPlugin record report metrics only if 'recording' is on[/+] on Nov 13, 2025
  3. bartizan commented on Nov 13, 2025

    @bartizan
    ContributorAuthor

    @waldekmastykarz

    We chose to send metrics without recording because we're sending them live, as we're intercepting requests. Is there a reason why you'd want to capture metrics only while recording?

    This concern is unrelated to OTel metrics exporting.

    The plugin generates reports using data collected over the entire period between its startup and the moment the recording is stopped. If a user generates a metrics report after the plugin has been running for a substantial period, they may be surprised by the unexpectedly large amount of historical data. This behavior is confusing.

    Alternatively, we could implement a fix assuming the goal is to continuously collect all metrics data while the plugin is running. This approach would require removing the step that resets the collected data when a recording session is stopped. The generated report would then reflect the entire history of collected metrics.

  4. waldekmastykarz commented on Nov 14, 2025

    @waldekmastykarz
    Collaborator

    Ah, understood. Yeah, that makes sense. Rather than recording the usage for the report as we're intercepting requests, we could do it only based on the requests we recorded. You're right. Thanks for pointing it out.

  5. bartizan commented on Nov 14, 2025

    @bartizan
    ContributorAuthor

    I'm on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions