traceability

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 30 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// TransactionFlow - the transaction flow used for events
	TransactionFlow = "api-central-v8"
	// FlowHeader - the header key for the flow value
	FlowHeader = "axway-target-flow"
)
View Source
const (
	HealthCheckEndpoint = traceabilityStr
)

Variables

View Source
var (
	ErrHTTPNotConnected       = errors.New(1503, "http transport is not connected")
	ErrJSONEncodeFailed       = errors.New(1504, "failed to encode the json content")
	ErrInvalidConfig          = errors.Newf(1505, "invalid traceability config. Config error: %s")
	ErrInvalidRegex           = errors.Newf(1506, "could not compile the %s regex value (%v): %v")
	ErrTCPProtocolRemoved     = errors.New(1507, "protocol 'tcp' is no longer supported; set output.traceability.protocol to https")
	ErrPort5044Removed        = errors.Newf(1508, "host %s uses port 5044 (tcp/lumberjack), which is no longer supported. Use port 443 with protocol https")
	ErrIngestionHostRemoved   = errors.Newf(1509, "host %s uses a legacy ingestion.* address, which is no longer supported. Use the phoenix.* host for your region")
	ErrNoConnectionConfigured = errors.New(1510, "no connection configured")
	ErrNoActiveConnection     = errors.New(1511, "no active connection")
)

Config errors

View Source
var GetClient = getClient

GetClient - returns a random client from the clients array

Functions

func AddConfigProperties added in v1.2.0

func AddConfigProperties(props properties.Properties)

AddConfigProperties sets up all the traceability env vars. Call this once before ParseConfig. It's not automatic, since discovery-only agents don't need it.

func GetCacheDirPath

func GetCacheDirPath() string

GetCacheDirPath - Returns the path of the cache directory

func GetDataDirPath

func GetDataDirPath() string

GetDataDirPath - Returns the path of the data directory

func GetMaxRetries

func GetMaxRetries() int

GetMaxRetries - Returns the max retries configured for transport

func GetReportsDirPath

func GetReportsDirPath() string

GetReportsDirPath - Returns the path of the reports directory

func IsHTTPTransport

func IsHTTPTransport() bool

IsHTTPTransport - Returns true if the protocol is set to http/https

func NewEventBatch added in v1.2.0

func NewEventBatch(events []event.Event) event.Batch

NewEventBatch builds an event.Batch around a fixed slice of events, for callers of Client.Publish that don't already have their own Batch implementation.

func SetDataDirPath

func SetDataDirPath(path string)

SetDataDirPath - Sets the path of the data directory. Must be called during agent init, before GetCacheDirPath/GetReportsDirPath are used, or those will create their directories under an empty/relative path.

func SetOutputEventProcessor

func SetOutputEventProcessor(eventProcessor OutputEventProcessor)

SetOutputEventProcessor -

func ShouldIgnoreEvent

func ShouldIgnoreEvent(uriRaw string) bool

ShouldIgnoreEvent - check to see if the uri exists in exception list

Types

type Backoff

type Backoff struct {
	Init time.Duration
	Max  time.Duration
}

Backoff -

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Client - struct

func NewClient added in v1.2.0

func NewClient(cfg *Config) ([]*Client, error)

NewClient replaces the libbeat outputs.RegisterType("traceability", makeTraceabilityAgent) factory-registration mechanism.

func (*Client) Close

func (client *Client) Close() error

Close publish a single event to output.

func (*Client) Connect

func (client *Client) Connect() error

Connect establishes a connection to the clients sink.

func (*Client) Publish

func (client *Client) Publish(ctx context.Context, batch event.Batch) error

Publish sends events to the clients sink.

func (*Client) SetLogger

func (client *Client) SetLogger(logger log.FieldLogger)

SetLogger - set the logger

func (*Client) SetTransportClient

func (client *Client) SetTransportClient(outputClient NetworkClient)

SetTransportClient - set the transport client

func (*Client) String

func (client *Client) String() string

type Config

type Config struct {
	LoadBalance       bool
	BulkMaxSize       int
	SlowStart         bool
	Timeout           time.Duration
	TTL               time.Duration
	Pipelining        int
	CompressionLevel  int
	MaxRetries        int
	TLS               TLSConfig
	Proxy             ProxyConfig
	Backoff           Backoff
	EscapeHTML        bool
	Protocol          string
	Hosts             []string
	Redaction         redaction.Config
	Sampling          sampling.Sampling
	APIExceptionsList []string
}

Config -

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig -

func FinishConfig added in v1.2.0

func FinishConfig(cfg *Config) (*Config, error)

FinishConfig runs the setup shared by every Config, regardless of source - host/protocol fallback, redaction, sampling, proxy check, exception list. So v7_traceability_agent (still on YAML/go-ucfg) can reuse it instead of duplicating it.

func ParseConfig added in v1.2.0

func ParseConfig(props properties.Properties) (*Config, error)

ParseConfig reads traceability config from env vars. AddConfigProperties must be called first.

func (*Config) ValidateCfg added in v1.2.0

func (c *Config) ValidateCfg() error

ValidateCfg - validates the config does not use the removed tcp/lumberjack transport

type Connection

type Connection struct {
	sync.Mutex
	URL string
	// contains filtered or unexported fields
}

Connection struct

type HTTPClient

type HTTPClient struct {
	Connection
	// contains filtered or unexported fields
}

HTTPClient struct

func NewHTTPClient

func NewHTTPClient(s HTTPClientSettings) (*HTTPClient, error)

NewHTTPClient instantiate a client.

func (*HTTPClient) Clone

func (client *HTTPClient) Clone() *HTTPClient

Clone clones a client.

func (*HTTPClient) Close

func (client *HTTPClient) Close() error

Close publish a single event to output.

func (*HTTPClient) Connect

func (client *HTTPClient) Connect() error

Connect establishes a connection to the clients sink.

func (*HTTPClient) Publish

func (client *HTTPClient) Publish(_ context.Context, batch event.Batch) error

Publish sends events to the clients sink.

func (*HTTPClient) String

func (client *HTTPClient) String() string

type HTTPClientSettings

type HTTPClientSettings struct {
	URL              string
	Proxy            *url.URL
	TLS              config.TLSConfig
	Timeout          time.Duration
	CompressionLevel int
	Headers          map[string]string
	UserAgent        string
	IsSingleEntry    bool
}

HTTPClientSettings struct

type NetworkClient added in v1.2.0

type NetworkClient interface {
	Connect() error
	Close() error
	Publish(ctx context.Context, batch event.Batch) error
	String() string
}

NetworkClient replaces libbeat's outputs.Client/outputs.NetworkClient.

type OutputEventProcessor

type OutputEventProcessor interface {
	Process(events []event.Event) []event.Event
}

OutputEventProcessor - processes events before they are published

type ProxyConfig

type ProxyConfig struct {
	// URL of the SOCKS proxy. Scheme must be socks5. Username and password can be
	// embedded in the URL.
	URL string

	// Resolve names locally instead of on the SOCKS server.
	LocalResolve bool
}

ProxyConfig holds the configuration information required to proxy connections through a SOCKS5 proxy server.

type TLSConfig added in v1.2.0

type TLSConfig struct {
	// Enabled is accepted but not acted on: protocol already determines whether TLS
	// applies.
	Enabled          *bool    `config:"enabled"`
	VerificationMode string   `config:"verification_mode"`
	CipherSuites     []string `config:"cipher_suites"`

	SupportedProtocols     []string `config:"supported_protocols"`
	CertificateAuthorities []string `config:"certificate_authorities"`
	CurveTypes             []string `config:"curve_types"`
	Renegotiation          string   `config:"renegotiation"`
	CASha256               []string `config:"ca_sha256"`
	KeyPassphrase          string   `config:"key_passphrase"`
}

TLSConfig replaces libbeat's tlscommon.Config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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