stackdriver-tools icon indicating copy to clipboard operation
stackdriver-tools copied to clipboard

Investigate metric functions

Open mattysweeps opened this issue 7 years ago • 1 comments

Some of the metric functions look a little interesting.

https://github.com/cloudfoundry-community/stackdriver-tools/blob/master/src/stackdriver-nozzle/messages/metric.go#L55

metric.go has no tests. It should have some.

metric.go: might be better to have a mapping from envelope type to stackdriver metrics type.

https://github.com/cloudfoundry-community/stackdriver-tools/blob/master/src/stackdriver-nozzle/nozzle/unit_parser.go

Maybe there is a library which could do part of this?

mattysweeps avatar Jan 28 '19 23:01 mattysweeps

In the long run we kind-of wanted to move to using SD metric protos throughout the Nozzle, for consistency. Since then OpenCensus has turned up and it's approximately the "blessed" way of getting metrics into Stackdriver, so instead it might well be worth looking into that as a replacement for all this proto-creation code.

I suspect there are no tests because all this code does is assemble proto structs from a Metric struct. These are going to end up being change-detector tests, IMO: every time anything in this package changes the tests will need to be rewritten too. They won't add much value because there's no complex logic to test. Perhaps the only behavioural test would be for "Flatten" ...

On Mon, 28 Jan 2019 at 23:01, Matthew Broomfield [email protected] wrote:

Some of the metric functions look a little interesting.

https://github.com/cloudfoundry-community/stackdriver-tools/blob/master/src/stackdriver-nozzle/messages/metric.go#L55

metric.go has no tests. It should have some.

metric.go: might be better to have a mapping from envelope type to stackdriver metrics type.

https://github.com/cloudfoundry-community/stackdriver-tools/blob/master/src/stackdriver-nozzle/nozzle/unit_parser.go

Maybe there is a library which could do part of this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry-community/stackdriver-tools/issues/249, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKUky3_ID8x98AGOvXS-NtRo2VTnye7ks5vH4E4gaJpZM4aW87Q .

fluffle avatar Jan 29 '19 09:01 fluffle