instrumentation

package
v2.0.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 13 Imported by: 51

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, info PackageInfo) error

Types

type Component

type Component int
const (
	ComponentDefault Component = iota
	ComponentServer
	ComponentClient
	ComponentProducer
	ComponentConsumer
)

type HeaderTags

type HeaderTags interface {
	Iter(f func(header string, tag string))
}

func NewHeaderTags

func NewHeaderTags(headers []string) HeaderTags

type Instrumentation

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

Instrumentation represents instrumentation for a package.

func Load

func Load(pkg Package) *Instrumentation

Load attempts to load the requested package instrumentation. It panics if the package has not been registered.

func (*Instrumentation) AnalyticsRate

func (i *Instrumentation) AnalyticsRate(defaultGlobal bool) float64

func (*Instrumentation) AppSecEnabled

func (i *Instrumentation) AppSecEnabled() bool

func (*Instrumentation) AppSecRASPEnabled

func (i *Instrumentation) AppSecRASPEnabled() bool

func (*Instrumentation) DataStreamsEnabled

func (i *Instrumentation) DataStreamsEnabled() bool

func (*Instrumentation) GlobalAnalyticsRate

func (i *Instrumentation) GlobalAnalyticsRate() float64

func (*Instrumentation) HTTPHeadersAsTags

func (i *Instrumentation) HTTPHeadersAsTags() HeaderTags

func (*Instrumentation) Logger

func (i *Instrumentation) Logger() Logger

func (*Instrumentation) OperationName

func (i *Instrumentation) OperationName(component Component, opCtx OperationContext) string

OperationName returns the operation name to be set for the given instrumentation component.

func (*Instrumentation) ServiceName

func (i *Instrumentation) ServiceName(component Component, opCtx OperationContext) string

ServiceName returns the default service name to be set for the given instrumentation component.

func (*Instrumentation) StatsdClient

func (i *Instrumentation) StatsdClient(extraTags []string) (StatsdClient, error)

func (*Instrumentation) TracerInitialized

func (i *Instrumentation) TracerInitialized() bool

TracerInitialized returns whether the global tracer has been initialized or not.

func (*Instrumentation) WithExecutionTraced

func (i *Instrumentation) WithExecutionTraced(ctx context.Context) context.Context

WithExecutionTraced marks ctx as being associated with an execution trace task. It is assumed that ctx already contains a trace task. The caller is responsible for ending the task.

This is intended for a specific case where the database/sql contrib package only creates spans *after* an operation, in case the operation was unavailable, and thus execution trace tasks tied to the span only capture the very end. This function enables creating a task *before* creating a span, and communicating to the APM tracer that it does not need to create a task. In general, APM instrumentation should prefer creating tasks around the operation rather than after the fact, if possible.

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Info(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
}

type OperationContext

type OperationContext map[string]string

OperationContext holds metadata about an instrumentation operation.

type Package

type Package string
const (
	Package99DesignsGQLGen      Package = "99designs/gqlgen"
	PackageAWSSDKGo             Package = "aws/aws-sdk-go"
	PackageAWSSDKGoV2           Package = "aws/aws-sdk-go-v2"
	PackageBradfitzGoMemcache   Package = "bradfitz/gomemcache"
	PackageGCPPubsub            Package = "cloud.google.com/go/pubsub.v1"
	PackageConfluentKafkaGo     Package = "confluentinc/confluent-kafka-go/kafka"
	PackageConfluentKafkaGoV2   Package = "confluentinc/confluent-kafka-go/kafka.v2"
	PackageDatabaseSQL          Package = "database/sql"
	PackageDimfeldHTTPTreeMuxV5 Package = "dimfeld/httptreemux.v5"
	PackageGoElasticSearchV6    Package = "elastic/go-elasticsearch.v6"
	PackageEmickleiGoRestfulV3  Package = "emicklei/go-restful.v3"
	PackageGin                  Package = "gin-gonic/gin"
	PackageGlobalsignMgo        Package = "globalsign/mgo"
	PackageMongoDriver          Package = "go.mongodb.org/mongo-driver"
	PackageChi                  Package = "go-chi/chi"
	PackageChiV5                Package = "go-chi/chi.v5"
	PackageGoPGV10              Package = "go-pg/pg.v10"
	PackageGoRedis              Package = "go-redis/redis"
	PackageGoRedisV7            Package = "go-redis/redis.v7"
	PackageGoRedisV8            Package = "go-redis/redis.v8"
	PackageGoCQL                Package = "gocql/gocql"
	PackageGoFiberV2            Package = "gofiber/fiber.v2"
	PackageRedigo               Package = "gomodule/redigo"
	PackageGoogleAPI            Package = "google.golang.org/api"
	PackageGRPC                 Package = "google.golang.org/grpc"

	PackageNetHTTP   Package = "net/http"
	PackageIBMSarama Package = "IBM/sarama"

	PackageValyalaFastHTTP         Package = "valyala/fasthttp"
	PackageUrfaveNegroni           Package = "urfave/negroni"
	PackageTwitchTVTwirp           Package = "twitchtv/twirp"
	PackageTidwallBuntDB           Package = "tidwall/buntdb"
	PackageSyndtrGoLevelDB         Package = "syndtr/goleveldb/leveldb"
	PackageSirupsenLogrus          Package = "sirupsen/logrus"
	PackageShopifySarama           Package = "Shopify/sarama"
	PackageSegmentioKafkaGo        Package = "segmentio/kafka-go"
	PackageRedisGoRedisV9          Package = "redis/go-redis.v9"
	PackageOlivereElasticV5        Package = "olivere/elastic"
	PackageMiekgDNS                Package = "miekg/dns"
	PackageLabstackEchoV4          Package = "labstack/echo.v4"
	PackageK8SClientGo             Package = "k8s.io/client-go/kubernetes"
	PackageJulienschmidtHTTPRouter Package = "julienschmidt/httprouter"
	PackageJmoironSQLx             Package = "jmoiron/sqlx"
	PackageJackcPGXV5              Package = "jackc/pgx.v5"
	PackageHashicorpConsulAPI      Package = "hashicorp/consul"
	PackageHashicorpVaultAPI       Package = "hashicorp/vault"
	PackageGraphQLGoGraphQL        Package = "graphql-go/graphql"
	PackageGraphGophersGraphQLGo   Package = "graph-gophers/graphql-go"
	PackageGormIOGormV1            Package = "gorm.io/gorm.v1"
	PackageGorillaMux              Package = "gorilla/mux"
	PackageUptraceBun              Package = "uptrace/bun"
	PackageLogSlog                 Package = "slog/log"

	// V1 contribs (deprecated in v2)
	PackageEmickleiGoRestful Package = "emicklei/go-restful"
	PackageGaryburdRedigo    Package = "garyburd/redigo"
	PackageLabstackEcho      Package = "labstack/echo"
	PackageGopkgJinzhuGormV1 Package = "gopkg.in/jinzhu/gorm.v1"
	PackageJinzhuGorm        Package = "jinzhu/gorm"
	PackageGojiV1Web         Package = "zenazn/goji.v1/web"
)

type PackageInfo

type PackageInfo struct {
	TracedPackage string
	EnvVarPrefix  string
	// contains filtered or unexported fields
}

type StatsdClient

type StatsdClient = internal.StatsdClient

Directories

Path Synopsis
appsec
dyngo
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
emitter
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
emitter/graphqlsec
Package graphqlsec is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
Package graphqlsec is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
emitter/grpcsec
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
emitter/httpsec
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
Package httpmem provides an in-memory HTTP server and client, for testing
Package httpmem provides an in-memory HTTP server and client, for testing
Package httptrace provides functionalities to trace HTTP requests that are commonly required and used across contrib/** integrations.
Package httptrace provides functionalities to trace HTTP requests that are commonly required and used across contrib/** integrations.
internal
sql

Jump to

Keyboard shortcuts

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