diff --git a/CHANGELOG.md b/CHANGELOG.md index ba18328..d6e5dae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +### v0.11 +##### September 19, 2021 + +#### :tada: Features + +- Added metrics cleanup TTLS for cleaning up metrics from memory +- Support existing secret in helm chart +- Added support for extra environment variables + +#### :beetle: Bug Fixes + +- Fixed metrics overriding issue +- Helm testing is optional now + ### v0.10 ##### April 12, 2021 diff --git a/listener/druid_endpoint.go b/listener/druid_endpoint.go index b3f2c87..29ad86d 100644 --- a/listener/druid_endpoint.go +++ b/listener/druid_endpoint.go @@ -20,6 +20,7 @@ func DruidHTTPEndpoint(metricsCleanupTTL int, disableHistogram bool, histogram * gaugeCleaner := newCleaner(gauge, metricsCleanupTTL) return func(w http.ResponseWriter, req *http.Request) { var druidData []map[string]interface{} + var id string reqHeader, _ := header.ParseValueAndParams(req.Header, "Content-Type") if req.Method == "POST" && reqHeader == "application/json" { output, err := ioutil.ReadAll(req.Body) @@ -45,9 +46,13 @@ func DruidHTTPEndpoint(metricsCleanupTTL int, disableHistogram bool, histogram * service := fmt.Sprintf("%v", data["service"]) hostname := fmt.Sprintf("%v", data["host"]) datasource := data["dataSource"] - id := fmt.Sprintf("%v", data["id"]) value, _ := strconv.ParseFloat(fmt.Sprintf("%v", data["value"]), 64) + if data["id"] != nil { + id = fmt.Sprintf("%v", data["id"]) + } else { + id = "" + } // Reverse DNS Lookup // Mutates dnsCache hostValue := strings.Split(hostname, ":")[0] @@ -62,7 +67,7 @@ func DruidHTTPEndpoint(metricsCleanupTTL int, disableHistogram bool, histogram * logrus.Tracef(" hostname => (%s -> %s)", hostname, host) logrus.Tracef(" datasource => %v", datasource) logrus.Tracef(" value => %v", value) - logrus.Tracef(" id => %v", id) + logrus.Tracef(" id => %v", id) } if data["dataSource"] != nil { diff --git a/main.go b/main.go index 60e2bf9..d0241a6 100644 --- a/main.go +++ b/main.go @@ -40,13 +40,13 @@ var ( prometheus.HistogramOpts{ Name: "druid_emitted_metrics_histogram", Help: "Druid emitted metrics from druid emitter", - }, []string{"host", "metric_name", "service", "datasource"}, + }, []string{"host", "metric_name", "service", "datasource", "id"}, ) druidEmittedDataGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "druid_emitted_metrics", Help: "Druid emitted metrics from druid emitter", - }, []string{"host", "metric_name", "service", "datasource"}, + }, []string{"host", "metric_name", "service", "datasource", "id"}, ) )