spotify / ffwd

a flexible metric forwarding agent
https://spotify.github.io/ffwd/
Apache License 2.0
79 stars 33 forks source link

Add tag refreshing functionality #223

Closed davidxia closed 3 years ago

davidxia commented 3 years ago

PR is WIP. Please make any edits or suggestions.

/Users/dxia/Downloads/work-notes/labels.yaml looks like

cluster="test-cluster1"
rack="rack-22"
tugboat.spotify.com/stage="canary"
zone="us-est-coast"

Running this locally with the automatically enabled DebugPluginSink and the command

cat metric.json

{
  "points": [
    {
      "key": "test_key",
       "tags": {
         "what": "error-rate"
       },
       "resource": {},
       "value": 1234.0,
       "timestamp":11111
    }
  ]
}

cat metric.json | http POST http://localhost:8080/v1/batch 'Content-Type:application/json'

I get

19:32:35.447 [main] INFO  com.spotify.ffwd.AgentCore - Started!

19:33:57.723 [ffwd-scheduler-0] INFO  com.spotify.ffwd.debug.DebugPluginSink -
B#0: Batch(commonTags={cluster="test-cluster1", rack="rack-22",
tugboat.spotify.com/stage="canary", zone="us-est-coast", foo=bar, env=prod},
commonResource={}, points=[Batch.Point(key=test_key, tags={what=error-rate},
resource={}, value=1234.0, timestamp=11111)])

Then I change the contents of labels.yaml to have tugboat.spotify.com/stage="production" and run the same command and get

19:34:40.382 [ffwd-scheduler-1] INFO  com.spotify.ffwd.debug.DebugPluginSink -
B#1: Batch(commonTags={cluster="test-cluster1", rack="rack-22",
tugboat.spotify.com/stage="production", zone="us-est-coast", foo=bar,
env=prod}, commonResource={}, points=[Batch.Point(key=test_key,
tags={what=error-rate}, resource={}, value=1234.0, timestamp=11111)])

This shows the tag is being refreshed.

davidxia commented 3 years ago

Please link to any docs I should update. I saw the docs dir, but it didn't seem to have much.

davidxia commented 3 years ago

Lmk how to move this PR along. I'm happy to walk through it or answer questions over hangouts.

davidxia commented 3 years ago

Good question. Before merging this, I can build the JAR locally, build the ffwd-java-shim Docker image locally. Run those on a test cluster to confirm it all works. Then we can merge this PR. Does that sound OK?

malish8632 commented 3 years ago

That would be great! Sorry for delay in responses.

davidxia commented 3 years ago

If no objections, I'll merge EOD today?