Documentation
¶
Index ¶
- Constants
- Variables
- func AddConfigProperties(props properties.Properties)
- func GetCacheDirPath() string
- func GetDataDirPath() string
- func GetMaxRetries() int
- func GetReportsDirPath() string
- func IsHTTPTransport() bool
- func NewEventBatch(events []event.Event) event.Batch
- func SetDataDirPath(path string)
- func SetOutputEventProcessor(eventProcessor OutputEventProcessor)
- func ShouldIgnoreEvent(uriRaw string) bool
- type Backoff
- type Client
- func (client *Client) Close() error
- func (client *Client) Connect() error
- func (client *Client) Publish(ctx context.Context, batch event.Batch) error
- func (client *Client) SetLogger(logger log.FieldLogger)
- func (client *Client) SetTransportClient(outputClient NetworkClient)
- func (client *Client) String() string
- type Config
- type Connection
- type HTTPClient
- type HTTPClientSettings
- type NetworkClient
- type OutputEventProcessor
- type ProxyConfig
- type TLSConfig
Constants ¶
const ( // TransactionFlow - the transaction flow used for events TransactionFlow = "api-central-v8" // FlowHeader - the header key for the flow value FlowHeader = "axway-target-flow" )
const (
HealthCheckEndpoint = traceabilityStr
)
Variables ¶
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
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
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 ¶
ShouldIgnoreEvent - check to see if the uri exists in exception list
Types ¶
type Client ¶
Client - struct
func NewClient ¶ added in v1.2.0
NewClient replaces the libbeat outputs.RegisterType("traceability", makeTraceabilityAgent) factory-registration mechanism.
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
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 FinishConfig ¶ added in v1.2.0
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
ValidateCfg - validates the config does not use the removed tcp/lumberjack transport
type Connection ¶
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) 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) 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 ¶
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.