Skip to content
Discussion options

You must be logged in to vote

The existing reply covers the Prometheus-layer approach well, but there are several native Collector-side options worth knowing about before building anything custom.

Option 1 transform processor to emit a heartbeat gauge

The simplest Collector-side solution is to use the transform processor to add a last_seen_timestamp metric on every batch that passes through. This keeps the series alive as long as the agent is sending:

  processors:
    transform/heartbeat:
      metric_statements:
        - context: datapoint
          statements:
            - set(attributes["last_seen_epoch_s"], Double(UnixNano(Now())) / 1e9)

This doesn't solve the stale series problem on its own because once the a…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aswath-anand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants