From 935d5d810955c9a1f16362855fe135ddc6d0230d Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Wed, 23 Dec 2020 15:54:51 +0500 Subject: [PATCH] Comment out unneeded in default working mode logging and add changelog. --- CHANGELOG.md | 13 +++++++++++++ internal/application/parser.go | 11 +++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cb9a6ac --- /dev/null +++ b/CHANGELOG.md @@ -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. diff --git a/internal/application/parser.go b/internal/application/parser.go index 079dcb7..631d69f 100644 --- a/internal/application/parser.go +++ b/internal/application/parser.go @@ -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 }