Module: OpenCensus::Tags

Defined in:
lib/opencensus/tags.rb,
lib/opencensus/tags/config.rb,
lib/opencensus/tags/tag_map.rb,
lib/opencensus/tags/formatters.rb,
lib/opencensus/tags/formatters/binary.rb

Overview

The Tags module contains support for OpenCensus tags. Tags are key-value pairs. Tags provide additional cardinality to the OpenCensus instrumentation data.

Defined Under Namespace

Modules: Formatters Classes: TagMap

Class Method Summary collapse

Class Method Details

.configureObject

Configure OpenCensus Tags. These configuration fields include parameters formatter.

This configuration is also available as the tags subconfig under the main configuration OpenCensus.configure. If the OpenCensus Railtie is installed in a Rails application, the configuration object is also exposed as config.opencensus.tags.

Generally, you should configure this once at process initialization, but it can be modified at any time.

Supported fields are:

Examples:


OpenCensus::Tags.configure do |config|
  config.binary_formatter = OpenCensus::Tags::Formatters::Binary.new
end


59
60
61
62
63
64
65
# File 'lib/opencensus/tags/config.rb', line 59

def configure
  if block_given?
    yield @config
  else
    @config
  end
end

.tag_map_contextTagMap?

Returns the current thread-local TagMap object.

Returns:



58
59
60
# File 'lib/opencensus/tags.rb', line 58

def tag_map_context
  OpenCensus::Context.get TAG_MAP_CONTEXT_KEY
end

.tag_map_context=(context) ⇒ Object

Sets the current thread-local TagMap, which used in Stats data recording.

Parameters:



44
45
46
# File 'lib/opencensus/tags.rb', line 44

def tag_map_context= context
  OpenCensus::Context.set TAG_MAP_CONTEXT_KEY, context
end

.unset_tag_map_contextObject

Unsets the current thread-local TagMap context



50
51
52
# File 'lib/opencensus/tags.rb', line 50

def unset_tag_map_context
  OpenCensus::Context.unset TAG_MAP_CONTEXT_KEY
end