otel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package otel exports completed native Datly records in one application-owned worker. No SDK span construction or exporter call occurs in TrySubmit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLinks(ctx context.Context, links ...Link) context.Context

WithLinks adds authoritative cross-invocation links, not a parent transaction or ambient request. Callers must obtain IDs from trusted execution metadata.

Types

type Adapter

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

func New

func New(config Config) (*Adapter, error)

func (*Adapter) Shutdown

func (a *Adapter) Shutdown(ctx context.Context) error

Shutdown stops admission and drains accepted work. On deadline it cancels the worker's exporter context; exporters must honor context cancellation.

func (*Adapter) Stats

func (a *Adapter) Stats() Stats

func (*Adapter) TrySubmit

func (a *Adapter) TrySubmit(c Completion) bool

TrySubmit reserves bounded capacity before detaching native records. Overflow drops export only. Completed native records remain owned by the invocation. The caller must have joined all writers before completing this invocation.

type Completion

type Completion struct {
	Context *xexec.Context
	End     time.Time
	Failed  bool
	Links   []Link
}

type Config

type Config struct {
	Enabled                     bool
	MaxSpans                    int
	BatchSize                   int
	BatchTimeout                time.Duration
	QueueSize                   int
	ExportTimeout               time.Duration
	ServiceName, ServiceVersion string
	// IncludeSQL is opt-in because authored SQL can itself contain sensitive literals.
	// Arguments, request headers/bodies and raw error messages are never exported.
	IncludeSQL bool
	Exporter   sdktrace.SpanExporter
}

type HTTPExporter

type HTTPExporter struct {
	EndpointURL string
	Insecure    bool
	Headers     map[string]string
}

HTTPExporter configures the official OTLP/HTTP transport; it owns no queue or span mapping. The existing Adapter owns invocation batching and export lifetime.

func (HTTPExporter) New

func (HTTPExporter) Validate

func (c HTTPExporter) Validate() error
type Link struct{ TraceID, SpanID string }

Link is trusted producer trace context, e.g. persisted async submit context. It does not infer linkage from DATLY_JOBS IDs, SQL, credentials or request data.

func Links(ctx context.Context) []Link

type Stats

type Stats struct{ Accepted, Dropped, Exported, Failed uint64 }

Jump to

Keyboard shortcuts

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