Documentation ¶
Index ¶
- Constants
- Variables
- type Agent
- func (a *Agent) Close() error
- func (a *Agent) Decorate(rt http.RoundTripper) http.RoundTripper
- func (a *Agent) DecorateClientTransports(clients ...*http.Client)
- func (a *Agent) DefaultTransport() http.RoundTripper
- func (a *Agent) Error() error
- func (a *Agent) LogError(msg string, fields map[string]interface{})
- func (a *Agent) LogTrace(msg string, fields map[string]interface{})
- func (a *Agent) LogWarn(msg string, fields map[string]interface{})
- func (a *Agent) Logger() *zerolog.Logger
- func (*Agent) Provider(e events.Event) []events.Listener
- func (a *Agent) SetLogger(w io.Writer) *Agent
- type Config
- func (c *Config) DataCollectionRules() []*interception.DataCollectionRule
- func (c *Config) DisableRemote()
- func (c *Config) Environment() string
- func (c *Config) IsDisabled() bool
- func (c *Config) SecretKey() string
- func (c *Config) SensitiveKeys() []*regexp.Regexp
- func (c *Config) SensitiveRegexps() []*regexp.Regexp
- func (c *Config) UpdateFromDescription(description *config.Description)
- type Option
Constants ¶
const ( // ExampleWellFormedInvalidKey is a well-formed key known to be invalid. It may // be used for integration test scenarios. ExampleWellFormedInvalidKey = `app_12345678901234567890123456789012345678901234567890` // SecretKeyName is the environment variable used to hold the Bearer secret key, // specific to each client. Fetching the secret key from the environment is a // best practice in 12-factor application development. SecretKeyName = `BEARER_SECRET_KEY` // Version is the semantic agent version. Version = `1.0.2` )
Variables ¶
var BearerSHA = "ea6465ac2a5df90ad7fdf8f3ae8af25b6014f0ad"
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { SecretKey string // contains filtered or unexported fields }
Agent is the type of the Bearer entry point for your programs.
func New ¶
New constructs a new Agent and returns it.
In most usage scenarios, you will only use a single Agent in a given application, and pass a config.WithLogger(some *io.Writer) config.Option.
func (*Agent) Decorate ¶
func (a *Agent) Decorate(rt http.RoundTripper) http.RoundTripper
Decorate wraps a http.RoundTripper with Bearer instrumentation.
func (*Agent) DecorateClientTransports ¶
DecorateClientTransports wraps the http.RoundTripper transports in all passed clients with Bearer instrumentation.
func (*Agent) DefaultTransport ¶
func (a *Agent) DefaultTransport() http.RoundTripper
DefaultTransport returns the original implementation of the http.DefaultTransport, even if it was overridden by the Agent in the meantime.
func (*Agent) Error ¶
Error returns any error that has cause the agent to shutdown. If there has been no error then it returns nil
func (*Agent) LogTrace ¶
LogTrace logs a trace-level debug event with the specified message and fields.
func (*Agent) Provider ¶
Provider provides the default agent listeners:
- TopicConnect: RFCListener, validating URL under RFC grammars.
- TopicRequest, TopicResponse, TopicBodies: no.
type Config ¶
type Config struct { Rules []interface{} // XXX Agent spec defines the field but no use for it. ReportEndpoint string ReportOutstanding uint *zerolog.Logger sync.Mutex // contains filtered or unexported fields }
Config represents the Agent configuration.
func NewConfig ¶
func NewConfig(secretKey string, transport http.RoundTripper, version string, opts ...Option) (*Config, error)
NewConfig is the default Config constructor: it builds a configuration from the builtin agent defaults, the environment, the Bearer platform configuration and any optional Option values passed by the caller.
func (*Config) DataCollectionRules ¶
func (c *Config) DataCollectionRules() []*interception.DataCollectionRule
DataCollectionRules returns the active DataCollectionRule instances.
func (*Config) DisableRemote ¶
func (c *Config) DisableRemote()
DisableRemote stops the goroutine updating the Agent configuration periodically.
func (*Config) Environment ¶
Environment is a getter for runtimeEnvironmentType.
func (*Config) IsDisabled ¶
IsDisabled is a getter for isDisabled, also checking whether the key is plausible.
func (*Config) SensitiveKeys ¶
SensitiveKeys is a getter for sensitiveKeys.
func (*Config) SensitiveRegexps ¶
SensitiveRegexps is a getter for sensitiveRegexps.
func (*Config) UpdateFromDescription ¶
func (c *Config) UpdateFromDescription(description *config.Description)
UpdateFromDescription overrides the Config with configuration generated from a configuration Description.
type Option ¶
Option is the type use by functional options for configuration.
func WithDisabled ¶
WithDisabled is a functional Option to disable the agent
func WithEndpoints ¶
WithEndpoints is an undocumented functional Option used for development purposes.
func WithEnvironment ¶
WithEnvironment is a functional Option configuring the runtime environment type.
The environment type is a free-form tag for clients, allowing them to report which type of environment they are running in, like "development", "staging" or "production", for reporting in the Bearer UI.
It allows clients to avoid the issues associated with having development and production metrics grouped together although they have different use profiles.
func WithLogger ¶
WithLogger is a functional Option for the logger.
func WithSensitiveKeys ¶
WithSensitiveKeys is a functional Option configuring the sensitive regexps.
It will return an error if any key is empty. Duplicate regexps will be reduced to unique values to limit filtering costs.
func WithSensitiveRegexps ¶
WithSensitiveRegexps is a functional Option configuring the sensitive regular expressions.
It will cause an error if any of the regular expressions is invalid.
Directories ¶
Path | Synopsis |
---|---|
Package events contains an event dispatcher loosely inspired by the PSR-14 specification, published under the MIT license by the PHP-FIG.
|
Package events contains an event dispatcher loosely inspired by the PSR-14 specification, published under the MIT license by the PHP-FIG. |
Package proxy handles the transmission of ReportLog collected data to the Bearer platform.
|
Package proxy handles the transmission of ReportLog collected data to the Bearer platform. |