Documentation
¶
Overview ¶
Package e2e provides end-to-end testing utilities for the OpenTelemetry Go Auto instrumentation probes.
Index ¶
- Variables
- func AssertSpanID(t *testing.T, spanID pcommon.SpanID, msgAndArgs ...any) bool
- func AssertTraceID(t *testing.T, traceID pcommon.TraceID, msgAndArgs ...any) bool
- func AttributesMap(attrs pcommon.Map) map[string]pcommon.Value
- func EventByName(span ptrace.Span, name string) (ptrace.SpanEvent, error)
- func LinkByTraceAndSpanID(span ptrace.Span, traceID, spanID string) (ptrace.SpanLink, error)
- func NewTestLogger(t *testing.T) *slog.Logger
- func ResourceAttribute(td ptrace.Traces, key string) (pcommon.Value, error)
- func ResourceSpans(td ptrace.Traces) []ptrace.ResourceSpans
- func RunInstrumentation(t *testing.T, mainDir string) ptrace.Traces
- func ScopeSpansByName(td ptrace.Traces, name string) []ptrace.ScopeSpans
- func SelectSpan(scopeSpans []ptrace.ScopeSpans, selector func(ptrace.Span) bool) (ptrace.Span, error)
- func SpanByName(scopeSpans []ptrace.ScopeSpans, name string) (ptrace.Span, error)
- func TestIntegration(t *testing.T, mainDir string, batsDir string)
Constants ¶
This section is empty.
Variables ¶
var PortRE = regexp.MustCompile(`^[1-9]\d{1,4}$`)
PortRE is a regular expression that matches valid port numbers.
Functions ¶
func AssertTraceID ¶
func AttributesMap ¶
AttributesMap converts the given attribute map to a native Go map.
func EventByName ¶
EventByName finds the first event in the span matching the given name.
func LinkByTraceAndSpanID ¶
LinkByTraceAndSpanID locates a link in the span matching the given trace and span ID.
func NewTestLogger ¶
NewTestLogger returns an *slog.Logger that logs to testing.T.
func ResourceAttribute ¶
ResourceAttribute returns the value of a specific resource attribute if found.
func ResourceSpans ¶
func ResourceSpans(td ptrace.Traces) []ptrace.ResourceSpans
ResourceSpans returns all resource spans in the given trace data.
func RunInstrumentation ¶
RunInstrumentation runs the auto-instrumentation for an end-to-end test. It compiles and runs the target binary located in the mainDir. It then runs the auto-instrumentation targeting the running binary. The traces generated are returned.
The compiled binary is expected to be located in the mainDir directory. It is expected to wait for a SIGCONT signal before starting the main function. The signal is sent to the binary after the auto-instrumentation is loaded, thus ensuring all operations are instrumented correctly.
All setup needed for the correct operation of the binary (i.e. message queues, databases) must be done by the binary itself.
The function is skipped if the memory limit cannot be removed due to insufficient permissions.
func ScopeSpansByName ¶
func ScopeSpansByName(td ptrace.Traces, name string) []ptrace.ScopeSpans
ScopeSpansByName filters scope spans matching the provided scope name.
func SelectSpan ¶
func SelectSpan( scopeSpans []ptrace.ScopeSpans, selector func(ptrace.Span) bool, ) (ptrace.Span, error)
SelectSpan returns the first span matching the selector from a set of scope spans.
func SpanByName ¶
SpanByName returns the first span with the specified name from a set of scope spans.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
autosdk
module
|
|
cmd
Package autosdk is a testing application for the go.opentelemetry.io/auto/sdk package.
|
Package autosdk is a testing application for the go.opentelemetry.io/auto/sdk package. |
databasesql
module
|
|
cmd
Package databasesql is a testing application for the database/sql package.
|
Package databasesql is a testing application for the database/sql package. |
gin
module
|
|
cmd
Package gin is a testing application for the github.com/gin-gonic/gin package.
|
Package gin is a testing application for the github.com/gin-gonic/gin package. |
gorillamux
module
|
|
grpc
module
|
|
cmd
Package grpc is a testing application for the google.golang.org/grpc package.
|
Package grpc is a testing application for the google.golang.org/grpc package. |
kafka-go
module
|
|
cmd
Package kafka-go is a testing application for the github.com/segmentio/kafka-go package.
|
Package kafka-go is a testing application for the github.com/segmentio/kafka-go package. |
nethttp
module
|
|
cmd
Package nethttp is a testing application for the net/http package.
|
Package nethttp is a testing application for the net/http package. |
nethttp_custom
|
|
cmd
Package nethttp_custom is a testing application for the net/http package.
|
Package nethttp_custom is a testing application for the net/http package. |
nonrecording
|
|
cmd
Package nonrecording is a testing application for the go.opentelemetry.io/otel/trace package.
|
Package nonrecording is a testing application for the go.opentelemetry.io/otel/trace package. |
otelglobal
module
|
|
cmd
Package otelglobal is a testing application for the go.opentelemetry.io/otel package.
|
Package otelglobal is a testing application for the go.opentelemetry.io/otel package. |