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 SetVersion(v Version)
- type Option
- type Schema
- func New(vSchema VersionSupportSchema) *Schema
- func NewCacheOutboundOp(system string, opts ...Option) *Schema
- func NewClientOutboundOp(system string, opts ...Option) *Schema
- func NewDBOutboundOp(system string, opts ...Option) *Schema
- func NewElasticsearchOutboundOp(opts ...Option) *Schema
- func NewGRPCClientOp(opts ...Option) *Schema
- func NewGRPCServerOp(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 NewServerInboundOp(system string, opts ...Option) *Schema
- func NewServiceNameSchema(userOverride, defaultName string, opts ...Option) *Schema
- type Version
- type VersionSupportSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetVersion ¶
func SetVersion(v Version)
SetVersion sets the global naming schema version used 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 WithVersionOverride ¶
WithVersionOverride allows to override the behavior with a custom logic for the given Version.
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 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 NewElasticsearchOutboundOp ¶
NewElasticsearchOutboundOp creates a new schema for Elasticsearch (db) 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 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 NewServerInboundOp ¶
NewServerInboundOp creates a new naming schema for server inbound operations.
func NewServiceNameSchema ¶
NewServiceNameSchema 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 WithVersionOverride option to override this behavior.
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.