Skip to content

getlantern/semconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

semconv

Standard and custom semantic conventions for creating consistent, comparable attribute.Keys across services.

usage

Import semconv and use it exclusively for defining attribute keys in telemetry.

import (
	"github.com/getlantern/semconv"
	"go.opentelemetry.io/otel/attribute"
)

Example attribute map:

attrs := map[attribute.Key]attribute.Value{
	semconv.GeoCountryISOCodeKey: attribute.StringValue("US"),
	semconv.HostNameKey:          attribute.StringValue("phost-abcd"),
	semconv.TrackNameKey:         attribute.StringValue("nidoran"),
	semconv.ProxyProtocolKey:     attribute.StringValue("HTTPS"),
}

Example attribute slice:

attrs := []attribute.KeyValue{
	{
		Key:   semconv.GeoCountryISOCodeKey,
		Value: attribute.StringValue("US"),
	},
	{
		Key:   semconv.HostNameKey,
		Value: attribute.StringValue("phost-abcd"),
	},
	{
		Key:   semconv.TrackNameKey,
		Value: attribute.StringValue("nidoran"),
	},
	{
		Key:   semconv.ProxyProtocolKey,
		Value: attribute.StringValue("HTTPS"),
	},
}

reference

standard

custom

About

semantic conventions for telemetry

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages