beam-telemetry / telemetry_metrics_prometheus_core

Core Prometheus Telemetry.Metrics Reporter package for telemetry_metrics_prometheus
Apache License 2.0
35 stars 30 forks source link

Allow names with digits, strip leading digits #37

Closed tobias-tress closed 3 years ago

tobias-tress commented 3 years ago

Hi,

we have problems with the auto-generated metric names as we are using them for some libraries with digits in their name and the exporter strips these digits from the names.

Our example is [:m3ua, :msg, :rx, :count] which gets converted to mua_msg_rx_count instead of m3ua_msg_rx_count.

According to prometheus naming conventions digits are allowed but not in the leading position ([a-zA-Z_][a-zA-Z0-9_]* taken from docs).

This PR changes the regex used by String.replace.

There are also two new test cases to verify the changes. All tests are passing.

Thanks in advance!

codecov-io commented 3 years ago

Codecov Report

Merging #37 (cd9dbbe) into master (16dc746) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #37   +/-   ##
=======================================
  Coverage   98.31%   98.31%           
=======================================
  Files           9        9           
  Lines         237      237           
=======================================
  Hits          233      233           
  Misses          4        4           
Flag Coverage Δ
1_10_otp21 98.31% <100.00%> (ø)
1_10_otp22 98.31% <100.00%> (ø)
1_6_otp20 98.31% <100.00%> (ø)
1_6_otp21 98.31% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/core/exporter.ex 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 16dc746...cd9dbbe. Read the comment docs.