Documentation
Overview ¶
Package otelmongo instruments go.mongodb.org/mongo-driver/mongo.
This package is compatable with v0.2.0 of go.mongodb.org/mongo-driver/mongo.
`NewMonitor` will return an event.CommandMonitor which is used to trace requests.
This code was originally based on the following: - https://github.com/DataDog/dd-trace-go/tree/02f0449efa3cb382d499fadc873957385dcb2192/contrib/go.mongodb.org/mongo-driver/mongo - https://github.com/DataDog/dd-trace-go/tree/v1.23.3/ddtrace/ext
Index ¶
- Constants
- func DBApplication(dbApplication string) label.KeyValue
- func DBInstance(dbInstance string) label.KeyValue
- func DBName(dbName string) label.KeyValue
- func DBOperation(operation string) label.KeyValue
- func DBStatement(dbStatement string) label.KeyValue
- func DBSystem(dbType string) label.KeyValue
- func DBUser(dbUser string) label.KeyValue
- func Error(err bool) label.KeyValue
- func ErrorMsg(errorMsg string) label.KeyValue
- func NewMonitor(serviceName string, opts ...Option) *event.CommandMonitor
- func PeerHostname(peerHostname string) label.KeyValue
- func PeerPort(peerport string) label.KeyValue
- func ServiceName(serviceName string) label.KeyValue
- func TargetHost(targetHost string) label.KeyValue
- func TargetPort(targetPort string) label.KeyValue
- type Option
Examples ¶
Constants ¶
const ( DBApplicationKey = label.Key("db.application") DBNameKey = label.Key("db.name") DBSystemKey = label.Key("db.system") DBInstanceKey = label.Key("db.instance") DBUserKey = label.Key("db.user") DBStatementKey = label.Key("db.statement") )
const ( // PeerHostname records the host name of the peer. PeerHostnameKey = label.Key("peer.hostname") // PeerPort records the port number of the peer. PeerPortKey = label.Key("peer.port") )
Variables ¶
Functions ¶
func DBApplication ¶
DBApplication indicates the application using the database.
func DBInstance ¶
DBInstance indicates the instance name of Database.
func DBOperation ¶
DBOperation defines the name of the operation.
func DBStatement ¶
DBStatement records a database statement for the given database type.
func NewMonitor ¶
func NewMonitor(serviceName string, opts ...Option) *event.CommandMonitor
NewMonitor creates a new mongodb event CommandMonitor.
func PeerHostname ¶
PeerHostname records the host name of the peer.
func ServiceName ¶
ServiceName defines the Service name for this Span.
func TargetHost ¶
TargetHost sets the target host address.
func TargetPort ¶
TargetPort sets the target host port.
Types ¶
type Option ¶
type Option func(*config)
Option specifies instrumentation configuration options.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.