From 53a22593fabe616f7cdaf1ca5ccf15befb829ad1 Mon Sep 17 00:00:00 2001 From: Arianna Vespri Date: Sat, 2 Dec 2023 16:14:09 +0100 Subject: [PATCH] fix comments for unit support Signed-off-by: Arianna Vespri --- expfmt/openmetrics_create.go | 9 ++++++--- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/expfmt/openmetrics_create.go b/expfmt/openmetrics_create.go index 4806db05..98039951 100644 --- a/expfmt/openmetrics_create.go +++ b/expfmt/openmetrics_create.go @@ -47,12 +47,15 @@ import ( // Prometheus to OpenMetrics or vice versa: // // - Counters are expected to have the `_total` suffix in their metric name. In -// the output, the suffix will be truncated from the `# TYPE` and `# HELP` -// line. A counter with a missing `_total` suffix is not an error. However, +// the output, the suffix will be truncated from the `# TYPE`, `# HELP` and `# UNIT` +// lines. A counter with a missing `_total` suffix is not an error. However, // its type will be set to `unknown` in that case to avoid invalid OpenMetrics // output. // -// - No support for the following (optional) features: `# UNIT` line, `_created` +// - The `# UNIT` line is optional, but if populated, the unit has to be present in the metric +// name as its suffix (see https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#unit) +// +// - No support for the following (optional) features: `_created` // line, info type, stateset type, gaugehistogram type. // // - The size of exemplar labels is not checked (i.e. it's possible to create diff --git a/go.mod b/go.mod index 8ccd84fc..bfd9149c 100644 --- a/go.mod +++ b/go.mod @@ -32,4 +32,4 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) -replace github.com/prometheus/client_model => github.com/vesari/client_model v0.0.0-20231118150741-19723af61627 +replace github.com/prometheus/client_model => github.com/vesari/client_model v0.0.0-20231202151802-003f160da988 diff --git a/go.sum b/go.sum index b8e584ef..e546b12a 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/vesari/client_model v0.0.0-20231118150741-19723af61627 h1:pJsecGZFkJIN3ipp7fS8hLDK0Dcnk2JVxXds3Dev3dQ= -github.com/vesari/client_model v0.0.0-20231118150741-19723af61627/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/vesari/client_model v0.0.0-20231202151802-003f160da988 h1:uGmTMMEergUEb2pEH90ZLVSBGvDqN16P12UsBjEQp0Y= +github.com/vesari/client_model v0.0.0-20231202151802-003f160da988/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=