Comment out unneeded in default working mode logging and add changelog.

This commit is contained in:
Stanislav Nikitin 2020-12-23 15:54:51 +05:00
parent 2e8fdb194c
commit 935d5d8109
Signed by: pztrn
GPG Key ID: 1E944A0F0568B550
2 changed files with 16 additions and 8 deletions

13
CHANGELOG.md Normal file
View File

@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.0] - 2020-12-2x
Initial release.
This release is able to parse Prometheus metrics (and their TYPE and HELP lines)
in order to provide autodiscovery ability to NMSes.

View File

@ -1,7 +1,6 @@
package application
import (
"log"
"strings"
"go.dev.pztrn.name/metricator/internal/models"
@ -27,7 +26,7 @@ func (a *Application) parse(body string) map[string]models.Metric {
continue
}
log.Println("Analyzing line:", line)
// log.Println("Analyzing line:", line)
name = a.getMetricName(line)
metric, found := data[name]
@ -47,12 +46,8 @@ func (a *Application) parse(body string) map[string]models.Metric {
if strings.HasPrefix(line, "#") {
switch strings.Split(line, " ")[1] {
case "HELP":
log.Println("Got HELP line")
metric.Description = a.getMetricDescription(line)
case "TYPE":
log.Println("Got TYPE line")
metric.Type = a.getMetricType(line)
}
@ -81,12 +76,12 @@ func (a *Application) parse(body string) map[string]models.Metric {
metric.Value = a.getMetricValue(line)
log.Printf("Got metric: %+v\n", metric)
// log.Printf("Got metric: %+v\n", metric)
data[name] = metric
}
log.Printf("Data parsed: %+v\n", data)
// log.Printf("Data parsed: %+v\n", data)
return data
}