tag

package
Version: v0.456.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package tag provides support for telemetry tagging.

Package tag provides support for telemetry tagging. This package is a thin shim over contexts with the main addition being the the ability to observe when contexts get tagged with new values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, keys ...interface{}) telemetry.TagList

Get collects a set of values from the context and returns them as a tag list.

func Of

func Of(key interface{}, value interface{}) telemetry.Tag

Of returns a Tag for a key and value. This is a trivial helper that makes common logging easier to read.

func With

func With(ctx context.Context, tags ...telemetry.Tag) context.Context

With delivers the tag list to the telemetry exporter.

Types

type Key

type Key string

Key represents the key for a context tag. It is a helper to make use of context tagging slightly easier to read, it is not strictly needed to use it at all. It is intended that your common tagging keys are declared as constants of this type, and then you can use the methods of this type to apply and find those values in the context.

func (Key) Of

func (k Key) Of(v interface{}) telemetry.Tag

Of creates a new Tag with this key and the supplied value. You can use this when building a tag list.

func (Key) Tag

func (k Key) Tag(ctx context.Context) telemetry.Tag

Tag can be used to get a tag for the key from a context. It makes Key conform to the Tagger interface.

func (Key) With

func (k Key) With(ctx context.Context, v interface{}) context.Context

With applies sets this key to the supplied value on the context and returns the new context generated. It uses the With package level function so that observers are also notified.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL