Module: Stoplight::Statsd
- Defined in:
- lib/stoplight/statsd.rb,
lib/stoplight/statsd/version.rb,
lib/stoplight/statsd/subscription_group.rb,
sig/stoplight/statsd.rbs
Defined Under Namespace
Classes: Error, SubscriptionGroup
Constant Summary collapse
- VERSION =
"0.0.0"
Class Method Summary collapse
- .envelope_tags(envelope) ⇒ Object
- .subscribe(telemetry, statsd:, sample_rate: 1.0) ⇒ SubscriptionGroup
Class Method Details
.envelope_tags(envelope) ⇒ Object
26 27 28 |
# File 'lib/stoplight/statsd.rb', line 26 def self.(envelope) ["system_name:#{envelope.system_name}", "light_name:#{envelope.light_name}"] end |
.subscribe(telemetry, statsd:, sample_rate: 1.0) ⇒ SubscriptionGroup
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/stoplight/statsd.rb', line 15 def self.subscribe(telemetry, statsd:, sample_rate: 1.0) unless (0.0..1.0).cover?(sample_rate) raise Error, "sample_rate must be between 0.0 and 1.0, got #{sample_rate.inspect}" end subscriptions = [subscribe_run_completed(telemetry, statsd: statsd, sample_rate:), subscribe_recovery_probe_completed(telemetry, statsd: statsd), subscribe_state_transitioned(telemetry, statsd: statsd), subscribe_light_registered(telemetry, statsd: statsd)] SubscriptionGroup.new(telemetry:, subscriptions:) end |