Skip to content

Parses out metrics from different formats to Ruby hashes. Currently supports InfluxDB Line Protocol

License

Notifications You must be signed in to change notification settings

Optum/telemetry-metrics-parser

Telemetry::Metrics::Parser

A ruby gem designed to parse and process telemetry style metrics

InfluxDB Line Protocol

# weather,location=us-midwest temperature=82 1465839830100400200
#   |    -------------------- --------------  |
#   |             |             |             |
#   |             |             |             |
# +-----------+--------+-+---------+-+---------+
# |measurement|,tag_set| |field_set| |timestamp|
# +-----------+--------+-+---------+-+---------+

Example

require 'telemetry/metrics/parser'
results = Telemetry::Metrics::Parser.line_protocol('weather,location=us-midwest temperature=82 1465839830100400200')

results[:measurement] # => weather
results[:tags] # => { location: 'us-midwest' }
results[:fields] # => { temperature: 82 }
results[:timestamp] # => 1465839830100400200

Validations

Telemetry::Metrics::Parser::LineProtocol.line_is_valid?('weather,location=us-midwest temperature=82 1465839830100400200') # true
Telemetry::Metrics::Parser::LineProtocol.line_is_valid?('weather,location=us-midwest temperature=this_field_is_a_string 1465839830100400200') # false but returned as a string error

Authors

About

Parses out metrics from different formats to Ruby hashes. Currently supports InfluxDB Line Protocol

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages