Skip to content

[feature]: Prometheus/OpenTelemetry metrics for queue #1037

Closed

Description

@gustavclausen

Is your feature request related to a problem? Please describe.

Hi!

Thanks for this great project.

I see that some Prometheus metrics was once collected and exposed (#4) but I don't see this feature included anymore.

Describe the solution you would like

I'm particularly interested in monitoring the queue - more specifically:

  • Count of read & write events
  • Queue depth
  • Count of delayed/requeue events

Is this something that can be implemented in the default TimedEntityQueue implementation? Or is the suggestion to implement a custom queue (as per these docs) that collects the metrics?

I would be happy to contribute with any changes in this regard.

Additional Context

No response

Activity

  1. added
    enhancement
    on Feb 3, 2026
  2. kimpenhaus commented on Feb 4, 2026

    @kimpenhaus
    Collaborator

    Hey @gustavclausen

    thanks for reaching out - this seems to be long time gone 😄 hadn't had an idea it was existing.

    from my perspective open telemetry metrics should be the way to go and therefore needs to have an HTTP pull endpoint as mentioned in the docs on top of collecting the data - maybe you have more experience with that and can elaborate a little on this?

    generally I think there is still some design issue in the operator-sdk, unfortunately, as the queue is not in front of the reconciler itself but the watcher and the queue call the reconciler side-by-side. this leads to a potentially race condition #977 and limits the parallelisation of the reconciler (which could be more efficient when reconciling same kinds in parallel - but not same uid's) - see discussion #656

    that said collecting metrics inside the queue would currently be just a partial overview.

    I think integrating otel metrics in the queue is a good first way to get started - keeping in mind that it doesn't give the total picture. I guess this should be implemented in the operator, so it doesn't needs to be implemented as a custom behaviour over and over again - maybe configurable by the operator settings.

    @buehler, @gustavclausen - what's your opinion on this?

  3. gustavclausen commented on Feb 4, 2026

    @gustavclausen
    ContributorAuthor

    Thanks for providing the additional context @kimpenhaus. I wasn't aware of this.

    therefore needs to have an HTTP pull endpoint as mentioned in the docs on top of collecting the data - maybe you have more experience with that and can elaborate a little on this?

    Yes, a HTTP endpoint for scraping the metrics would be the way to go. There are some examples in the official OTEL docs for reference (example of custom counter and example in ASP.NET Core).

    I would be happy to build the OTEL foundation and support queue metrics for starters.

  4. kimpenhaus commented on Jun 14, 2026

    @kimpenhaus
    Collaborator

    @gustavclausen I have tried to add basic otel support. It's currently on a pull request only available. (see #1152)

    da you have a chance to test that version prior to releasing it? that would help a lot.

  5. gustavclausen commented on Jun 14, 2026

    @gustavclausen
    ContributorAuthor

    That's awesome @kimpenhaus! Will test it out in the next couple of days and get back to you

  6. gustavclausen commented on Jun 15, 2026

    @gustavclausen
    ContributorAuthor

    @kimpenhaus I just tested it out in one of the example projects (following the new docs), and it looks to be working fine.

    One thing that I would recommend is to prefix the metrics with "kubeops" (or whatever you prefer), according to the naming conventions (see General naming considerations, Recommendations for application developers and System-specific naming sections).

    I think this serves as a really good starting point, and we can get some value out of it already. Good job on this, highly appreciated.

  7. kimpenhaus commented on Jun 15, 2026

    @kimpenhaus
    Collaborator

    @gustavclausen thanks for the fast feedback - I tried to implement your recommendations (metrics and attributes should be proper prefixed now) and tweaked the usage a little - as it felt a little redundant in the usage. I've also added and example.

    If you like to - you could get it another shot?

  8. gustavclausen commented on Jun 17, 2026

    @gustavclausen
    ContributorAuthor

    @kimpenhaus Looks great! Both the OTLP and Prometheus exporter works as expected

  9. kimpenhaus commented on Jun 18, 2026

    @kimpenhaus
    Collaborator

    @gustavclausen that is great news - thanks for testing out. I am going to merge the feature then. official release will be on Tuesday. thanks again

  10. added a commit that references this issue on Jun 18, 2026
    b652e87
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions