Closed che-wf closed 6 years ago
It's most likely that the thing and property ids are controlled by the source of the thing (i.e. the adapter). If you can console.log in the safeMetricId
function it'll likely point to the source of the problems. I'm guessing that I missed sanitizing a prometheus-unsafe character
It's spitting out 70:ee:50:22:c7:de_Temperature
and 70:ee:50:22:c7:de_CO2
. I'm guessing it's the colon since you are appending the underscore.
Thanks! It's almost definitely the colon, so I just pushed a commit for adding it to the list of sanitized characters
Oh, no, it's unfortunately the fact that it starts with a number, I'll push a better fix out
https://github.com/hobinjk/gateway-prometheus-translator/commit/73acc079c57f310c69251f2f0cbd0c245e854714 now properly resolves this
I am using prom-client in nodejs and while giving name name of histogram I used '-'(hyphen) instead of '_' underscore.
instead of this:
const responseTimeHistogram = new promClient.Histogram({
name: "api-customer_response_time_duration_seconds",
help: "REST API time in second",
labelNames: ["method", "route", "status_code"]
})
do this:
const responseTimeHistogram = new promClient.Histogram({
name: "api_customer_response_time_duration_seconds",
help: "REST API time in second",
labelNames: ["method", "route", "status_code"]
})
I'm getting an error when I run
node translator.js [url] [token]
.It looks like it is being thrown by the Prometheus client and doesn't like my metric name. Is there anything on my end that would help resolve the error? It looks like the ID is generated by the
thingId
and thepropId
. Do I control either of those?