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
-
.configure ⇒ Object
Configure OpenCensus Tags.
-
.tag_map_context ⇒ TagMap?
Returns the current thread-local TagMap object.
-
.tag_map_context=(context) ⇒ Object
Sets the current thread-local TagMap, which used in Stats data recording.
-
.unset_tag_map_context ⇒ Object
Unsets the current thread-local TagMap context.
Class Method Details
.configure ⇒ Object
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:
-
binary_formatterThe tags context propagation formatter to use. Must be a formatter, an object withserialize,deserialize, methods. See OpenCensus::Tags::Formatters::Binary.
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_context ⇒ TagMap?
Returns the current thread-local TagMap object.
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.
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_context ⇒ Object
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 |