Skip to content

Commit

Permalink
remove unused metric, add tag support to readme
Browse files Browse the repository at this point in the history
Signed-off-by: glightfoot <[email protected]>
  • Loading branch information
glightfoot committed Jul 21, 2020
1 parent c28a558 commit 2487dcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Metrics will be available on [http://localhost:9108/metrics](http://localhost:91
To avoid using unbounded memory, metrics will be garbage collected five minutes after
they are last pushed to. This is configurable with the `--graphite.sample-expiry` flag.

## Graphite Tags
The graphite_exporter accepts metrics in the [tagged carbon format](https://graphite.readthedocs.io/en/latest/tags.html). Labels specified in the mapping configuration take precedence over tags in the metric. In the case where there are valid and invalid tags supplied in one metric, the invalid tags will be dropped and the `graphite_tag_parse_failures` counter will be incremented. The exporter accepts inconsistent label sets, but this may cause issues querying the data in Prometheus.

## Metric Mapping and Configuration

**Please note there has been a breaking change in configuration after version 0.2.0. The YAML style config from [statsd_exporter](https://github.com/prometheus/statsd_exporter) is now used. See conversion instructions below**
Expand Down
8 changes: 1 addition & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ var (
Name: "graphite_tag_parse_failures",
Help: "Total count of samples with invalid tags",
})
invalidMetrics = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "graphite_invalid_metrics",
Help: "Total count of metrics dropped due to mismatched label keys",
})
invalidMetricChars = regexp.MustCompile("[^a-zA-Z0-9_:]")
)

Expand Down Expand Up @@ -176,7 +171,7 @@ func (c *graphiteCollector) processLine(line string) {

parsedName, labels, err := parseMetricNameAndTags(originalName)
if err != nil {
level.Info(c.logger).Log("msg", "Invalid tags", "line", line, "err", err.Error())
level.Debug(c.logger).Log("msg", "Invalid tags", "line", line, "err", err.Error())
}

mapping, mappingLabels, mappingPresent := c.mapper.GetMapping(parsedName, mapper.MetricTypeGauge)
Expand Down Expand Up @@ -305,7 +300,6 @@ func main() {

prometheus.MustRegister(sampleExpiryMetric)
prometheus.MustRegister(tagParseFailures)
prometheus.MustRegister(invalidMetrics)
sampleExpiryMetric.Set(sampleExpiry.Seconds())

level.Info(logger).Log("msg", "Starting graphite_exporter", "version_info", version.Info())
Expand Down

0 comments on commit 2487dcb

Please sign in to comment.