normalize

package
v0.73.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package normalize contains functions for normalizing trace data.

Index

Constants

View Source
const (
	// DefaultSpanName is the default name we assign a span if it's missing and we have no reasonable fallback
	DefaultSpanName = "unnamed_operation"
	// DefaultServiceName is the default name we assign a service if it's missing and we have no reasonable fallback
	DefaultServiceName = "unnamed-service"
)
View Source
const (
	// MaxNameLen the maximum length a name can have
	MaxNameLen = 100
	// MaxServiceLen the maximum length a service can have
	MaxServiceLen = 100
	// MaxResourceLen the maximum length a resource can have
	MaxResourceLen = 5000
)

Variables

View Source
var (
	// ErrEmpty specifies that the passed input was empty.
	ErrEmpty = errors.New("empty")
	// ErrTooLong signifies that the input was too long.
	ErrTooLong = errors.New("too long")
	// ErrInvalid signifies that the input was invalid.
	ErrInvalid = errors.New("invalid")
)

Functions

func NormalizeName

func NormalizeName(name string) (string, error)

NormalizeName normalizes a span name and returns an error describing the reason (if any) why the name was modified.

func NormalizePeerService

func NormalizePeerService(svc string) (string, error)

NormalizePeerService normalizes a span's peer.service and returns an error describing the reason (if any) why the name was modified.

func NormalizeService

func NormalizeService(svc string, lang string) (string, error)

NormalizeService normalizes a span service and returns an error describing the reason (if any) why the name was modified.

func NormalizeTag

func NormalizeTag(v string) string

NormalizeTag applies some normalization to ensure the full tag_key:tag_value string matches the backend requirements.

func NormalizeTagValue

func NormalizeTagValue(v string) string

NormalizeTagValue applies some normalization to ensure the tag value matches the backend requirements. It should be used for cases where we have just the tag_value as the input (instead of tag_key:tag_value).

func TruncateUTF8

func TruncateUTF8(s string, limit int) string

TruncateUTF8 truncates the given string to make sure it uses less than limit bytes. If the last character is an utf8 character that would be splitten, it removes it entirely to make sure the resulting string is not broken.

Types

This section is empty.

Jump to

Keyboard shortcuts

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