Documentation
¶
Overview ¶
Package transport provides an interface and implementation for transporting data to the Elastic APM server.
Index ¶
- type HTTPError
- type HTTPTransport
- func (t *HTTPTransport) SendErrors(ctx context.Context, p *model.ErrorsPayload) error
- func (t *HTTPTransport) SendMetrics(ctx context.Context, p *model.MetricsPayload) error
- func (t *HTTPTransport) SendTransactions(ctx context.Context, p *model.TransactionsPayload) error
- func (t *HTTPTransport) SetUserAgent(ua string)
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPTransport ¶
HTTPTransport is an implementation of Transport, sending payloads via a net/http client.
func NewHTTPTransport ¶
func NewHTTPTransport(serverURL, secretToken string) (*HTTPTransport, error)
NewHTTPTransport returns a new HTTPTransport, which can be used for sending transactions and errors to the APM server at the specified URL, with the given secret token.
If the URL specified is the empty string, then NewHTTPTransport will use the value of the ELASTIC_APM_SERVER_URL environment variable, if defined; if the environment variable is also undefined, then the transport will use the default URL "http://localhost:8200". The URL must be the base server URL, excluding any transactions or errors path. e.g. "http://server.example:8200".
If the secret token specified is the empty string, then NewHTTPTransport will use the value of the ELASTIC_APM_SECRET_TOKEN environment variable, if defined; if the environment variable is also undefined, then requests will not be authenticated.
If ELASTIC_APM_VERIFY_SERVER_CERT is set to "false", then the transport will not verify the APM server's TLS certificate.
The Client field will be initialized with a new http.Client configured from ELASTIC_APM_* environment variables. The Client field may be modified or replaced, e.g. in order to specify TLS root CAs.
func (*HTTPTransport) SendErrors ¶
func (t *HTTPTransport) SendErrors(ctx context.Context, p *model.ErrorsPayload) error
SendErrors sends the errors payload over HTTP.
func (*HTTPTransport) SendMetrics ¶ added in v0.5.0
func (t *HTTPTransport) SendMetrics(ctx context.Context, p *model.MetricsPayload) error
SendMetrics sends the metrics payload over HTTP.
func (*HTTPTransport) SendTransactions ¶
func (t *HTTPTransport) SendTransactions(ctx context.Context, p *model.TransactionsPayload) error
SendTransactions sends the transactions payload over HTTP.
func (*HTTPTransport) SetUserAgent ¶ added in v0.5.0
func (t *HTTPTransport) SetUserAgent(ua string)
SetUserAgent sets the User-Agent header that will be sent with each request.
type Transport ¶
type Transport interface { // SendErrors sends the errors payload to the server. SendErrors(context.Context, *model.ErrorsPayload) error // SendMetrics sends the metrics payload to the server. SendMetrics(context.Context, *model.MetricsPayload) error // SendTransactions sends the transactions payload to the server. SendTransactions(context.Context, *model.TransactionsPayload) error }
Transport provides an interface for sending data to the Elastic APM server. Methods are not required to be safe for concurrent use.
var ( // Default is the default Transport, using the // ELASTIC_APM_* environment variables. // // If ELASTIC_APM_SERVER_URL is set to an invalid // location, Default will be set to a transport // returning an error for every operation. Default Transport // Discard is a Transport on which all operations // succeed without doing anything. Discard = discardTransport{} )
func InitDefault ¶
InitDefault (re-)initializes Default, the default transport, returning its new value along with the error that will be returned by the transport if the environment variable configuration is invalid. The Transport returned is always non-nil.
Directories
¶
Path | Synopsis |
---|---|
Package transporttest provides implementations of transport.Transport for testing purposes.
|
Package transporttest provides implementations of transport.Transport for testing purposes. |