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
registryRegistry The underlying registry.
-
parameter
nameSymbol 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
nameSymbol 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
nameSymbol 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