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 ¶
- func SetUseGlobalServiceName(v bool)
- func SetVersion(v Version)
- func UseGlobalServiceName() bool
- type Option
- type Schema
- func New(vSchema VersionSupportSchema) *Schema
- func NewCacheOutboundOp(system string, opts ...Option) *Schema
- func NewCassandraOutboundOp(opts ...Option) *Schema
- func NewClientOutboundOp(system string, opts ...Option) *Schema
- func NewDBOutboundOp(system string, opts ...Option) *Schema
- func NewDefaultServiceName(fallbackName string, opts ...Option) *Schema
- func NewElasticsearchOutboundOp(opts ...Option) *Schema
- func NewGCPPubsubInboundOp(opts ...Option) *Schema
- func NewGCPPubsubOutboundOp(opts ...Option) *Schema
- func NewGRPCClientOp(opts ...Option) *Schema
- func NewGRPCServerOp(opts ...Option) *Schema
- func NewGraphqlServerOp(opts ...Option) *Schema
- func NewHTTPClientOp(opts ...Option) *Schema
- func NewHTTPServerOp(opts ...Option) *Schema
- func NewKafkaInboundOp(opts ...Option) *Schema
- func NewKafkaOutboundOp(opts ...Option) *Schema
- func NewMemcachedOutboundOp(opts ...Option) *Schema
- func NewMessagingInboundOp(system string, opts ...Option) *Schema
- func NewMessagingOutboundOp(system string, opts ...Option) *Schema
- func NewMongoDBOutboundOp(opts ...Option) *Schema
- func NewRedisOutboundOp(opts ...Option) *Schema
- func NewServerInboundOp(system string, opts ...Option) *Schema
- type Version
- type VersionSupportSchema
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
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 NewCacheOutboundOp ¶
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
NewCassandraOutboundOp creates a new schema for Cassandra (db) outbound operations.
func NewClientOutboundOp ¶
NewClientOutboundOp creates a new naming schema for client outbound operations.
func NewDBOutboundOp ¶
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
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 ¶
NewElasticsearchOutboundOp creates a new schema for Elasticsearch (db) outbound operations.
func NewGCPPubsubInboundOp ¶ added in v1.51.0
NewGCPPubsubInboundOp creates a new schema for GCP Pubsub (messaging) inbound operations.
func NewGCPPubsubOutboundOp ¶ added in v1.51.0
NewGCPPubsubOutboundOp creates a new schema for GCP Pubsub (messaging) outbound operations.
func NewGRPCClientOp ¶
NewGRPCClientOp creates a new schema for gRPC client outbound operations.
func NewGRPCServerOp ¶
NewGRPCServerOp creates a new schema for gRPC server inbound operations.
func NewGraphqlServerOp ¶ added in v1.51.0
NewGraphqlServerOp creates a new schema for GraphQL server inbound operations.
func NewHTTPClientOp ¶
NewHTTPClientOp creates a new schema for HTTP client outbound operations.
func NewHTTPServerOp ¶
NewHTTPServerOp creates a new schema for HTTP server inbound operations.
func NewKafkaInboundOp ¶
NewKafkaInboundOp creates a new schema for Kafka (messaging) inbound operations.
func NewKafkaOutboundOp ¶
NewKafkaOutboundOp creates a new schema for Kafka (messaging) outbound operations.
func NewMemcachedOutboundOp ¶
NewMemcachedOutboundOp creates a new schema for Memcached (cache) outbound operations.
func NewMessagingInboundOp ¶
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 ¶
NewMessagingOutboundOp creates a new naming schema for outbound operations from messaging systems.
func NewMongoDBOutboundOp ¶ added in v1.51.0
NewMongoDBOutboundOp creates a new schema for MongoDB (db) outbound operations.
func NewRedisOutboundOp ¶ added in v1.51.0
NewRedisOutboundOp creates a new schema for Redis (cache) outbound operations.
func NewServerInboundOp ¶
NewServerInboundOp creates a new naming schema for server inbound operations.
type Version ¶
type Version int
Version represents the available naming schema versions.
func GetVersion ¶
func GetVersion() Version
GetVersion returns the global naming schema version used for this application.
func ParseVersion ¶
ParseVersion attempts to parse the version string.
func SetDefaultVersion ¶
func SetDefaultVersion() Version
SetDefaultVersion sets the default global naming schema version.
type VersionSupportSchema ¶
VersionSupportSchema is an interface that ensures all the available naming schema versions are implemented by the caller.