namingschema

package
v1.59.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package namingschema provides functionality to create naming schemas used by integrations to set different service and span/operation names based on the value of the DD_TRACE_SPAN_ATTRIBUTE_SCHEMA environment variable. It also provides some already implemented schemas for common use cases (client-server, db, messaging, etc.).

How to use this package: 1. Implement the VersionSupportSchema interface containing the correct name for each version. 2. Create a new Schema using the New function. 3. Call Schema.GetName to get the correct name based on the user configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUseGlobalServiceName added in v1.52.0

func SetUseGlobalServiceName(v bool)

SetUseGlobalServiceName sets the value of the useGlobalServiceName setting used for this application.

func SetVersion

func SetVersion(v Version)

SetVersion sets the global naming schema version used for this application.

func UseGlobalServiceName added in v1.52.0

func UseGlobalServiceName() bool

UseGlobalServiceName returns the value of the useGlobalServiceName setting for this application.

Types

type Option

type Option func(cfg *config)

Option represents an option that can be passed to some naming schemas provided in this package.

func WithOverrideV0 added in v1.52.0

func WithOverrideV0(value string) Option

WithOverrideV0 allows to override the value returned for V0 in the given Schema.

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema allows to select the proper name to use based on the given VersionSupportSchema.

func New

func New(vSchema VersionSupportSchema) *Schema

New initializes a new Schema.

func NewCacheOutboundOp

func NewCacheOutboundOp(system string, opts ...Option) *Schema

NewCacheOutboundOp creates a new naming schema for outbound operations from caching systems. The V0 implementation defaults to the v1 and is meant to be overwritten if needed, since (generally) it does not follow any pattern among cache integrations.

func NewCassandraOutboundOp added in v1.51.0

func NewCassandraOutboundOp(opts ...Option) *Schema

NewCassandraOutboundOp creates a new schema for Cassandra (db) outbound operations.

func NewClientOutboundOp

func NewClientOutboundOp(system string, opts ...Option) *Schema

NewClientOutboundOp creates a new naming schema for client outbound operations.

func NewDBOutboundOp

func NewDBOutboundOp(system string, opts ...Option) *Schema

NewDBOutboundOp creates a new naming schema for db outbound operations. The V0 implementation defaults to the v1 and is meant to be overwritten if needed, since (generally) it does not follow any pattern among db integrations.

func NewDefaultServiceName added in v1.52.0

func NewDefaultServiceName(fallbackName string, opts ...Option) *Schema

NewDefaultServiceName returns a Schema with the standard logic to be used for contrib span service names (in-code override > DD_SERVICE environment variable > integration default name). If you need to support older versions not following this logic, you can use WithV0Override option to override this behavior.

func NewElasticsearchOutboundOp

func NewElasticsearchOutboundOp(opts ...Option) *Schema

NewElasticsearchOutboundOp creates a new schema for Elasticsearch (db) outbound operations.

func NewGCPPubsubInboundOp added in v1.51.0

func NewGCPPubsubInboundOp(opts ...Option) *Schema

NewGCPPubsubInboundOp creates a new schema for GCP Pubsub (messaging) inbound operations.

func NewGCPPubsubOutboundOp added in v1.51.0

func NewGCPPubsubOutboundOp(opts ...Option) *Schema

NewGCPPubsubOutboundOp creates a new schema for GCP Pubsub (messaging) outbound operations.

func NewGRPCClientOp

func NewGRPCClientOp(opts ...Option) *Schema

NewGRPCClientOp creates a new schema for gRPC client outbound operations.

func NewGRPCServerOp

func NewGRPCServerOp(opts ...Option) *Schema

NewGRPCServerOp creates a new schema for gRPC server inbound operations.

func NewGraphqlServerOp added in v1.51.0

func NewGraphqlServerOp(opts ...Option) *Schema

NewGraphqlServerOp creates a new schema for GraphQL server inbound operations.

func NewHTTPClientOp

func NewHTTPClientOp(opts ...Option) *Schema

NewHTTPClientOp creates a new schema for HTTP client outbound operations.

func NewHTTPServerOp

func NewHTTPServerOp(opts ...Option) *Schema

NewHTTPServerOp creates a new schema for HTTP server inbound operations.

func NewKafkaInboundOp

func NewKafkaInboundOp(opts ...Option) *Schema

NewKafkaInboundOp creates a new schema for Kafka (messaging) inbound operations.

func NewKafkaOutboundOp

func NewKafkaOutboundOp(opts ...Option) *Schema

NewKafkaOutboundOp creates a new schema for Kafka (messaging) outbound operations.

func NewMemcachedOutboundOp

func NewMemcachedOutboundOp(opts ...Option) *Schema

NewMemcachedOutboundOp creates a new schema for Memcached (cache) outbound operations.

func NewMessagingInboundOp

func NewMessagingInboundOp(system string, opts ...Option) *Schema

NewMessagingInboundOp creates a new schema for messaging systems inbound operations. The V0 implementation defaults to the v1 and is meant to be overwritten if needed, since (generally) it does not follow any pattern among messaging integrations.

func NewMessagingOutboundOp

func NewMessagingOutboundOp(system string, opts ...Option) *Schema

NewMessagingOutboundOp creates a new naming schema for outbound operations from messaging systems.

func NewMongoDBOutboundOp added in v1.51.0

func NewMongoDBOutboundOp(opts ...Option) *Schema

NewMongoDBOutboundOp creates a new schema for MongoDB (db) outbound operations.

func NewRedisOutboundOp added in v1.51.0

func NewRedisOutboundOp(opts ...Option) *Schema

NewRedisOutboundOp creates a new schema for Redis (cache) outbound operations.

func NewServerInboundOp

func NewServerInboundOp(system string, opts ...Option) *Schema

NewServerInboundOp creates a new naming schema for server inbound operations.

func (*Schema) GetName

func (s *Schema) GetName() string

GetName returns the proper name for this Schema for the user selected version.

type Version

type Version int

Version represents the available naming schema versions.

const (
	// SchemaV0 represents naming schema v0.
	SchemaV0 Version = iota
	// SchemaV1 represents naming schema v1.
	SchemaV1
)

func GetVersion

func GetVersion() Version

GetVersion returns the global naming schema version used for this application.

func ParseVersion

func ParseVersion(v string) (Version, bool)

ParseVersion attempts to parse the version string.

func SetDefaultVersion

func SetDefaultVersion() Version

SetDefaultVersion sets the default global naming schema version.

type VersionSupportSchema

type VersionSupportSchema interface {
	V0() string
	V1() string
}

VersionSupportSchema is an interface that ensures all the available naming schema versions are implemented by the caller.

Jump to

Keyboard shortcuts

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