Skip to content

[receiver/k8sobjectsreceiver] Watch mode can only track new changes #41536

@krisztianfekete

Description

@krisztianfekete

Component(s)

receiver/k8sobjects

What happened?

Description

Today, most users would want to use watch mode, so they can subscribe to events happening to the objects they are watching without the cost of pulling the snapshot periodically.

However, currently you can only track changes that happen AFTER you subscribed to objects, while I feel most users would also like to get the current state of the objects. Today you can only get this by using pull mode, and using pull mode only because of this can be undesired.

We can solve this via an initial List request (which the code already does today, but only to get the current resourceVersion when it is not specified).

I am proposing

  1. sending a List request to the object/group
  2. converting this state into a log via watchObjectsToLogData in startWatch()
  3. watching from this resourceVersion as the code already does

See also the Kubernetes documentation on how to detect changes efficiently.

Note: there's also this, but requires a specific Kubernetes version: https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists

Steps to Reproduce

Configure the receiver to watch pods, add debugexporter to the pipeline.

Expected Result

The receiver should generate a log for the current state too.

Actual Result

No log events will be generated unless changes happen to pods after you have the receiver running.

Collector version

main

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions