Class: Datadog::Statsd::Schema::SchemaBuilder::MetricsBuilder Private

Inherits:
Object
  • Object
show all
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 metrics within a namespace

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(metrics, transformers) ⇒ MetricsBuilder

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 metrics hash and transformers

Parameters:

  • metrics (Hash)

    Hash to store metric definitions

  • transformers (Hash)

    Available transformer functions

Since:

  • 0.1.0



249
250
251
252
253
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 249

def initialize(metrics, transformers)
  @metrics = metrics
  @transformers = transformers
  @current_namespace = nil
end

Instance Method Details

#namespace(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.

Define a nested namespace for metrics

Parameters:

  • name (Symbol)

    Namespace name

Yields:

  • Block for defining metrics within the namespace

Since:

  • 0.1.0



259
260
261
262
263
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 259

def namespace(name, &)
  @current_namespace = name.to_sym
  instance_eval(&)
  @current_namespace = nil
end