Skip to content
Discussion options

You must be logged in to vote

Update:

Did some more digging. Looks like that lua transform runs sequentially and is able to retain state between runs. Here is a non-racy configuration that should work for your use case:

  sources:
    receive_metrics:
      type: vector
      address: 127.0.0.1:6000

  transforms:
    keep_every_third_scrape:
      type: lua
      version: "2"
      inputs: [receive_metrics]
      hooks:
        process: |
          function (event, emit)
            -- Scrape boundary: one scrape carries N metric events sharing a
            -- timestamp. Increment only when the timestamp changes.
            -- The key truncates sub-seconds: a real prometheus scrape stamps
            -- the whole b…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@thomasqueirozb
Comment options

Answer selected by thomasqueirozb
Comment options

You must be logged in to vote
3 replies
@thomasqueirozb
Comment options

@ilinas
Comment options

@thomasqueirozb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants