Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Use EscapeMetricName from statsd-exporter for sanitize #17

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

bakins
Copy link
Contributor

@bakins bakins commented Mar 18, 2020

See https://github.com/prometheus/statsd_exporter/blob/master/pkg/mapper/escape.go

EscapeMetricName is highly optimized for this use case.

Metric names in benchmark are from https://godoc.org/go.opencensus.io/plugin/ocgrpc

Benchmark comparison:

$ benchcmp /tmp/a.txt /tmp/b.txt
benchmark                old ns/op     new ns/op     delta
BenchmarkSanitize-12     2861          1304          -54.42%

benchmark                old allocs     new allocs     delta
BenchmarkSanitize-12     13             13             +0.00%

benchmark                old bytes     new bytes     delta
BenchmarkSanitize-12     624           544           -12.82%

@songy23 songy23 merged commit 2b9ada2 into census-ecosystem:master Jun 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants