Add tasmota_info prometheus psuedo-metric.

Exports version, image type, and build timestamp.

It's common to export something like this to show version numbers across the fleet.

For example, the golang exporter exposes version:
```
go_info{version="go1.14.4"} 1
```

And prometheus exposes:
```
prometheus_build_info{branch="HEAD",goversion="go1.14.4",revision="eba3fdcbf0d378b66600281903e3aab515732b39",version="2.19.1"} 1
```
This commit is contained in:
Mark Hansen 2020-06-27 21:21:11 +10:00
parent 1866938cbd
commit 76c61e85b3
1 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,9 @@ void HandleMetrics(void)
char parameter[FLOATSZ];
// Pseudo-metric providing metadata about the running firmware version.
WSContentSend_P(PSTR("# TYPE tasmota_info gauge\ntasmota_info{version=\"%s\",image=\"%s\",build_timestamp=\"%s\"} 1\n"),
my_version, my_image, GetBuildDateAndTime().c_str());
WSContentSend_P(PSTR("# TYPE tasmota_uptime_seconds gauge\ntasmota_uptime_seconds %d\n"), uptime);
WSContentSend_P(PSTR("# TYPE tasmota_boot_count counter\ntasmota_boot_count %d\n"), Settings.bootcount);