Class: Datadog::Statsd::Schema::SchemaBuilder::MetricBuilder Private
- Inherits:
-
Object
- Object
- Datadog::Statsd::Schema::SchemaBuilder::MetricBuilder
- Defined in:
- lib/datadog/statsd/schema/schema_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Helper class for building individual metrics with block syntax
Instance Method Summary collapse
-
#build ⇒ MetricDefinition
private
Build the final metric definition.
-
#description(desc) ⇒ void
private
Set metric description.
-
#inherit_tags(metric_path) ⇒ void
private
Set metric inheritance.
-
#initialize(metric_def) ⇒ MetricBuilder
constructor
private
Initialize with a metric definition.
-
#tags(**options) ⇒ void
private
Configure metric tags.
-
#units(unit_name) ⇒ void
private
Set metric units.
Constructor Details
#initialize(metric_def) ⇒ MetricBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize with a metric definition
336 337 338 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 336 def initialize(metric_def) @metric_def = metric_def end |
Instance Method Details
#build ⇒ MetricDefinition
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build the final metric definition
378 379 380 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 378 def build @metric_def end |
#description(desc) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Set metric description
343 344 345 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 343 def description(desc) @metric_def = @metric_def.new(description: desc) end |
#inherit_tags(metric_path) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Set metric inheritance
372 373 374 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 372 def (metric_path) @metric_def = @metric_def.new(inherit_tags: metric_path) end |
#tags(**options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Configure metric tags
352 353 354 355 356 357 358 359 360 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 352 def (**) allowed = Array([:allowed] || []).map(&:to_sym) required = Array([:required] || []).map(&:to_sym) @metric_def = @metric_def.new( allowed_tags: allowed, required_tags: required ) end |
#units(unit_name) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Set metric units
365 366 367 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 365 def units(unit_name) @metric_def = @metric_def.new(units: unit_name) end |