Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStatic typing of metric values #185
Comments
ghost
assigned
bernerdschaefer
Apr 25, 2013
This comment has been minimized.
This comment has been minimized.
|
@streadway For the new schema version, I've refactored the processor to use explicit typing. Note -- this was not a change to the schema itself, which uses type and value keys. In theory, I would prefer |
This comment has been minimized.
This comment has been minimized.
|
#195 looks better as a stricter context sensitive parse of union types. I think the transfer format can be simplified even more to forego the union type (type="counter|histogram|whatever") and without needing an out-of-band version specifier. I'll open a new issue when the thoughts are a little clearer, but the idea follows these guidelines: Using a top level container with the version and data fields so that export versions can be negotiated when exported over a Unix domain socket: And the data field containing a list of single metric type - a labeled numeric (float64) scalar with a merge strategy (3 fields). This means that a metric can be streamed because it doesn't depend on the container and is independent of the client specific typing like Counter, Gauge or Histogram (Histogram being a class of Gauge grouping). |
This comment has been minimized.
This comment has been minimized.
|
A few notes: Metric type specification for human readability is an explicit design The need to handle content negotiation out-of-band is an annoyance, I will I would much rather see time spent in building an optional Anyway, this is getting off topic for the PR at-hand. Please keep this in As a side note, I generally like the Google styleguides, for they compactly
|
This comment has been minimized.
This comment has been minimized.
|
JSON format 0.0.1, I think we are over it. |
fabxc
closed this
Sep 21, 2015
simonpasquier
pushed a commit
to simonpasquier/prometheus
that referenced
this issue
Oct 12, 2017
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
streadway commentedApr 25, 2013
https://github.com/prometheus/prometheus/blob/master/retrieval/format/processor0_0_1.go#L56
Is a context sensitive union type that can produce runtime errors when the "type" key does not match the expected type of the value of the "value" key. Consider using a key name for the type rather than a "type" key with the metric type as a value. Like:
[ {"metric": {"labels":[], "count": 1} }, {"metric": {"labels":[], "histogram": { "0.01": 15, "0.1": 20 } ]This means that collectors ignore metrics they don't know how to join. If you want to be explicit, keep the "type" key as the tag for the union of possible metric types. Then the schema can use static typing for possible metric values.
TL;DR: Do not use interface{} types inside in the schema definition for significant fields.