cloudfoundry / loggregator-api

Apache License 2.0
5 stars 8 forks source link

Converting v2 Gauge to v1 ValueMetric #20

Closed evandbrown closed 6 years ago

evandbrown commented 6 years ago

I'm working to convert v2 protos to v1, and the guide in the README has been helpful. For ValueMetric, the equivalent values in the v2 envelope all mention first-key. Does this indicate that the Gauge.Metrics map will only have one item in it, and that the item's key is the ValueMetric's name?

cf-gitbot commented 6 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/159971986

The labels on this github issue will be updated when the story is started.

bradylove commented 6 years ago

@evandbrown sorry that table is not quite clear. When we convert a V2 Gauge metric into a V1 ValueMetric we actually create multiple V1 ValueMetric's. One ValueMetric for each of the Gauge metrics keys. You can see our own conversion for logic for V2 Gauges to V1 ValueMetrics here.

Out of curiosity, why would you need to convert a V2 envelope to V1?

bradylove commented 6 years ago

Created #21 to hopefully make the README more clear.

evandbrown commented 6 years ago

This is super helpful! I'm moving Google's Stackdriver nozzle to use the v2 API so we get the benefits of deterministic routing (https://github.com/cloudfoundry-community/stackdriver-tools/issues/205). Converting to v1 on receipt seems like the simplest approach but I'd love your thoughts if there's a better way! Thanks so much for the quick response.

bradylove commented 6 years ago

Cool! I think converting V2 to V1 is an acceptable approach. One thing to keep an eye on would be CPU and Memory consumption of the conversion. We have had issues in the past with our conversion being fairly expensive.

Another thing I would point out is, in your V2 request to the RLP make sure you are setting use_preferred_tags to true. #19 plans to remove the deprecated tags and requesting preferred tags will prevent future breakage.

poy commented 6 years ago

Looks like this has been resolved. Closing.