testutils

package
v2.11.0-dev Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBMBaseHash

func DBMBaseHash(service, containerTagsHash string) string

DBMBaseHash computes the expected DBM base hash for the given inputs, matching the value injected as ddsh in SQL comments and as _dd.propagated_hash on spans. It mirrors computeBaseHash by returning "" when process tags are unavailable.

func DecodeV1Traces added in v2.9.0

func DecodeV1Traces(t *testing.T, buf []byte) map[string]any

DecodeV1Traces decodes a msgpack-encoded v1 payload (e.g. bytes read from req.Body of an agent intake request) and returns its top-level fields keyed by their numeric proto field IDs (as strings). Fields absent from the payload (zero value after decode) are omitted from the result.

func DiscardLogger

func DiscardLogger() tracer.Logger

func FlushTelemetry added in v2.4.0

func FlushTelemetry()

FlushTelemetry flushes any pending telemetry data.

func SetContainerTagsHash

func SetContainerTagsHash(t *testing.T, hash string)

SetContainerTagsHash sets the container tags hash for the duration of the test.

func SetGlobalAnalyticsRate

func SetGlobalAnalyticsRate(t *testing.T, val float64)

func SetGlobalDogstatsdAddr

func SetGlobalDogstatsdAddr(t *testing.T, val string)

func SetGlobalHeaderTags

func SetGlobalHeaderTags(t *testing.T, headers ...string)

func SetGlobalServiceName

func SetGlobalServiceName(t *testing.T, val string)

func SetPropagatingTag

func SetPropagatingTag(t testing.TB, ctx *tracer.SpanContext, k, v string)

SetPropagatingTag sets a tag on the given span context. It assumes it comes from a span, so it has a trace attached to it.

func StartAppSec

func StartAppSec(t *testing.T, opts ...config.StartOption)

func StartAppSecBench

func StartAppSecBench(b *testing.B)

func StartTelemetryRecorder added in v2.7.0

func StartTelemetryRecorder(t *testing.T) *telemetrytest.RecordClient

StartTelemetryRecorder starts a new telemetry mock client and returns it.

Types

type MockStatsdClient

type MockStatsdClient = statsdtest.TestStatsdClient

func NewMockStatsdClient

func NewMockStatsdClient() *MockStatsdClient

Directories

Path Synopsis
Package testtracer provides a wrapper over the ddtrace/tracer package with a mocked transport that allows to inspect traces while keeping the rest of the tracer logic the same.
Package testtracer provides a wrapper over the ddtrace/tracer package with a mocked transport that allows to inspect traces while keeping the rest of the tracer logic the same.

Jump to

Keyboard shortcuts

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