Documentation ¶
Index ¶
- Constants
- func CalculatePreconnectHost(license LicenseKey, overrideHost string) string
- func Compress(b []byte) (*bytes.Buffer, error)
- func CompressEncode(b []byte) (string, error)
- func GetStatusCodeMessage(StatusCode int) string
- func NewCertPool(cafile, capath string) (*x509.CertPool, error)
- func Uncompress(b []byte) ([]byte, error)
- func UncompressDecode(s string) ([]byte, error)
- type Client
- type ClientConfig
- type ClientFn
- type Collectible
- type CollectibleFunc
- type Event
- type EventConfigs
- type EventHarvestConfig
- type LicenseKey
- type RPMResponse
- type RpmCmd
- type RpmControls
- type SpanEventHarvestConfig
- type SystemCertPoolState
Constants ¶
const ( CommandMetrics string = "metric_data" CommandErrors = "error_data" CommandTraces = "transaction_sample_data" CommandSlowSQLs = "sql_trace_data" CommandCustomEvents = "custom_event_data" CommandErrorEvents = "error_event_data" CommandTxnEvents = "analytic_event_data" CommandConnect = "connect" CommandPreconnect = "preconnect" CommandSpanEvents = "span_event_data" CommandLogEvents = "log_event_data" CommandPhpPackages = "update_loaded_modules" )
Variables ¶
This section is empty.
Functions ¶
func CalculatePreconnectHost ¶
func CalculatePreconnectHost(license LicenseKey, overrideHost string) string
func CompressEncode ¶
func GetStatusCodeMessage ¶
Not a method of RPMResponse so that it can be called during creation
func Uncompress ¶
func UncompressDecode ¶
Types ¶
type Client ¶
type Client interface {
Execute(cmd *RpmCmd, cs RpmControls) RPMResponse
}
func NewClient ¶
func NewClient(cfg *ClientConfig) (Client, error)
type ClientConfig ¶
type ClientFn ¶
type ClientFn func(cmd *RpmCmd, cs RpmControls) RPMResponse
func (ClientFn) Execute ¶
func (fn ClientFn) Execute(cmd *RpmCmd, cs RpmControls) RPMResponse
type Collectible ¶
type CollectibleFunc ¶
func (CollectibleFunc) CollectorJSON ¶
func (fn CollectibleFunc) CollectorJSON(auditVersion bool) ([]byte, error)
type Event ¶
Event lets you specify the limit and report period for each event type, this is used in EventConfigs.
type EventConfigs ¶
type EventConfigs struct { ErrorEventConfig Event AnalyticEventConfig Event CustomEventConfig Event SpanEventConfig Event LogEventConfig Event }
EventConfigs represents the local harvest limits and harvest interval that were created based on what the collector returned in the event_harvest_config and the span_event_harvest_config.
func NewHarvestLimits ¶
func NewHarvestLimits(agentLimits *EventConfigs) EventConfigs
NewHarvestLimits creates a EventConfigs with the correct default limits. The collector should not know about our per-event report period. If we get per app config limits from the agent(s), we need to honor that. It takes an EventConfig variable so that if the agent has configured any limits, we can also incorporate those here.
type EventHarvestConfig ¶
type EventHarvestConfig struct { // This is used to determine if harvestAll can be used. It is also used by // a supportability metric. ReportPeriod time.Duration EventConfigs EventConfigs }
EventHarvestConfig represents the event_harvest_config object used by the daemon specified in connect messages.
func NewEventHarvestConfig ¶
func NewEventHarvestConfig(agentLimits *EventConfigs) EventHarvestConfig
NewEventHarvestConfig creates an event harvest configuration with the default values baked into the daemon. The collector should always receive the daemon default values. We should never send back what we received from the collector. We should never send per-event report periods. It takes an EventConfig variable so that if the agent has configured any limits, we can also incorporate those here.
func (EventHarvestConfig) MarshalJSON ¶
func (daemonConfig EventHarvestConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals an EventHarvestConfig into (effectively) a marshalled rawEventHarvestConfig, which is the wire format expected by the collector.
func (*EventHarvestConfig) UnmarshalJSON ¶
func (daemonConfig *EventHarvestConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals an event_harvest_config JSON object into an EventHarvestConfig.
type LicenseKey ¶
type LicenseKey string
LicenseKey represents a license key for an account.
func (LicenseKey) Sha256 ¶
func (key LicenseKey) Sha256() string
func (LicenseKey) String ¶
func (key LicenseKey) String() string
String obfuscates the license key by removing all but a safe prefix and suffix.
type RPMResponse ¶
type RPMResponse struct { StatusCode int Body []byte // Err indicates whether or not the call was successful: newRPMResponse // should be used to avoid mismatch between StatusCode and Err. Err error // contains filtered or unexported fields }
RPMResponse contains a NR endpoint response.
Agent Behavior Summary:
on connect/preconnect:
410 means shutdown 200, 202 mean success (start run) all other response codes and errors mean try after backoff
on harvest:
410 means shutdown 401, 409 mean restart run 408, 429, 500, 503 mean save data for next harvest all other response codes and errors discard the data and continue the current harvest
func NewRPMResponseError ¶
func NewRPMResponseError(err error) RPMResponse
All RPMResponse's should be created through newRPMResponse() methods. You must either pass a status code, or an err. If no error is passed, one is created when needed based on the status code. Otherwise, the error is scrubbed of sensitive information
func (RPMResponse) IsDisconnect ¶
func (resp RPMResponse) IsDisconnect() bool
IsDisconnect indicates that the agent should disconnect.
func (RPMResponse) IsInvalidLicense ¶
func (resp RPMResponse) IsInvalidLicense() bool
This is in place because, to update the license ini value, the PHP app must be shut off
func (RPMResponse) IsRestartException ¶
func (resp RPMResponse) IsRestartException() bool
IsRestartException indicates that the agent should restart. 401 (License Exception) is considered a restart exception according to the spec,
and is included here as such, however the PHP agent will not restart on a 401 and instead stop
func (RPMResponse) ShouldSaveHarvestData ¶
func (resp RPMResponse) ShouldSaveHarvestData() bool
ShouldSaveHarvestData indicates that the agent should save the data and try to send it in the next harvest.
type RpmCmd ¶
type RpmCmd struct { Name string Collector string RunID string Data []byte License LicenseKey RequestHeadersMap map[string]string MaxPayloadSize int }
RpmCmd contains fields specific to an individual call made to RPM.
type RpmControls ¶
type RpmControls struct { Collectible Collectible AgentLanguage string AgentVersion string // contains filtered or unexported fields }
RpmControls contains fields which will be the same for all calls made by the same application.
type SpanEventHarvestConfig ¶
type SpanEventHarvestConfig struct {
SpanEventConfig Event
}
EventHarvestConfig holds the span_event_harvest_config object specified in connect messages.
func (*SpanEventHarvestConfig) UnmarshalJSON ¶
func (daemonConfig *SpanEventHarvestConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a span_harvest_config JSON object into an SpanEventHarvestConfig.
type SystemCertPoolState ¶
type SystemCertPoolState int
const ( // The system certificate pool is missing, and should generate a warning. SystemCertPoolMissing SystemCertPoolState = iota // The system certificate pool is available. SystemCertPoolAvailable // The daemon was not built in a way where the system certificate pool is // relevant, and we should not warn or generate any supportability metrics. SystemCertPoolIgnored )
Constants related to the system certificate pool behaviour.
var ( DefaultCertPool *x509.CertPool CertPoolState SystemCertPoolState )