Documentation ¶
Overview ¶
Package transport provides an interface and implementation for transporting data to the Elastic APM server.
Index ¶
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 an error will be returned. The URL must be the base server URL, excluding any transactions or errors path. e.g. "http://elastic-apm.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) SendTransactions ¶
func (t *HTTPTransport) SendTransactions(ctx context.Context, p *model.TransactionsPayload) error
SendTransactions sends the transactions payload over HTTP.
type Transport ¶
type Transport interface { // SendTransactions sends the transactions payload to the server. SendTransactions(context.Context, *model.TransactionsPayload) error // SendErrors sends the errors payload to the server. SendErrors(context.Context, *model.ErrorsPayload) error }
Transport provides an interface for sending transactions and errors payloads to Elastic APM. Methods are not required to be safe for concurrent use; tracers should serialize the calls.
var ( // Default is the default Transport, using the // ELASTIC_APM_* environment variables. // // If ELASTIC_APM_SERVER_URL is not defined, then // Defaultwill be set to Discard. If it is defined, // but invalid, then 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. |