Async::UtilizationSourceAsyncUtilizationNamespace

class Namespace

A registry-like view that prefixes metric names.

Namespaces let components use generic metric names while applications decide how those names are composed in the shared registry.

Definitions

def initialize(registry, name)

Initialize a new namespace.

Signature

parameter registry Registry

The underlying registry.

parameter name Symbol

The namespace name.

Implementation

def initialize(registry, name)
	@registry = registry
	@name = name.to_sym
end

attr :registry

Signature

attribute Registry

The underlying registry.

attr :name

Signature

attribute Symbol

The namespace name.

def metric(name)

Get a metric in this namespace.

Signature

parameter name Symbol

The metric name.

returns Metric

A metric instance for the namespaced field.

Implementation

def metric(name)
	@registry.metric(metric_name(name))
end

def namespace(name)

Get a nested namespace.

Signature

parameter name Symbol

The nested namespace name.

returns Namespace

A namespace view with the composed name.

Implementation

def namespace(name)
	self.class.new(@registry, metric_name(name))
end