Documentation ¶
Index ¶
- Constants
- func OCStatusCodeFromHTTP(code int32) int32
- type Client
- func (sa *Client) Export(ctx context.Context, batches []*jaegerpb.Batch) error
- func (sa *Client) ExportWithAccessToken(ctx context.Context, batches []*jaegerpb.Batch, accessToken string) error
- func (sa *Client) ExportWithAccessTokenAndGetResponse(ctx context.Context, batches []*jaegerpb.Batch, accessToken string) (*IngestResponse, error)
- func (sa *Client) Stop()
- type CompressionMethod
- type ErrSend
- type IngestResponse
- type Option
- func WithAccessToken(t string) Option
- func WithCompressionMethod(compressionMethod CompressionMethod) Option
- func WithDisabledCompression() Option
- func WithEndpoint(endpoint string) Option
- func WithHTTPClient(c *http.Client) Option
- func WithMaxConnections(n uint) Option
- func WithTracerProvider(tracerProvider trace.TracerProvider) Option
- func WithWorkers(n uint) Option
Constants ¶
const ( OCOK = 0 OCCancelled = 1 OCUnknown = 2 OCInvalidArgument = 3 OCDeadlineExceeded = 4 OCNotFound = 5 OCAlreadyExists = 6 OCPermissionDenied = 7 OCResourceExhausted = 8 OCFailedPrecondition = 9 OCAborted = 10 OCOutOfRange = 11 OCUnimplemented = 12 OCInternal = 13 OCDataLoss = 15 OCUnauthenticated = 16 )
Variables ¶
This section is empty.
Functions ¶
func OCStatusCodeFromHTTP ¶ added in v0.4.0
OCStatusCodeFromHTTP takes an HTTP status code and return the appropriate OpenTelemetry status code See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements an HTTP sender for the SAPM protocol
func (*Client) Export ¶
Export takes a Jaeger batches and uses one of the available workers to export it synchronously. It returns an error in case a request cannot be processed. It's up to the caller to retry.
func (*Client) ExportWithAccessToken ¶ added in v0.5.3
func (sa *Client) ExportWithAccessToken(ctx context.Context, batches []*jaegerpb.Batch, accessToken string) error
ExportWithAccessToken takes a Jaeger batches and an SFx access token and uses one of the available workers to export it synchronously, preferentially using the provided token and defaulting to the worker's token if empty. It returns an error in case a request cannot be processed. It's up to the caller to retry.
func (*Client) ExportWithAccessTokenAndGetResponse ¶ added in v0.10.0
func (sa *Client) ExportWithAccessTokenAndGetResponse(ctx context.Context, batches []*jaegerpb.Batch, accessToken string) (*IngestResponse, error)
ExportWithAccessTokenAndGetResponse does everything ExportWithAccessToken does and in addition will return a ResponseBody indicating the response returned from trace ingest. This can be used by consumers to get insights into partial drops of spans/traces from within a batch.
func (*Client) Stop ¶
func (sa *Client) Stop()
Stop waits for all inflight requests to finish and then drains the worker pool so no more work can be done. It returns once all workers are drained from the pool. Note that the client can accept new requests while Stop() waits for other requests to finish.
type CompressionMethod ¶ added in v0.13.0
type CompressionMethod string
CompressionMethod strings MUST match the Content-Encoding http header values.
const CompressionMethodGzip CompressionMethod = "gzip"
const CompressionMethodZstd CompressionMethod = "zstd"
type ErrSend ¶ added in v0.3.0
ErrSend is returned by the HTTP sender when it fails to complete a request for any reason.
type IngestResponse ¶ added in v0.10.0
IngestResponse encapsulates the body of response returned by trace ingest and any error encountered by the worker while reading the body.
type Option ¶
Option takes a reference to a Client and sets relevant config fields on it.
func WithAccessToken ¶
WithAccessToken allows to pass an authentication token to the client. The auth token is set to X-SF-TOKEN HTTP header.
func WithCompressionMethod ¶ added in v0.13.0
func WithCompressionMethod(compressionMethod CompressionMethod) Option
WithCompressionMethod chooses the compression method for the outgoing requests. The default compression method is CompressionMethodGzip. This option is ignored if WithDisabledCompression() is used.
func WithDisabledCompression ¶ added in v0.5.1
func WithDisabledCompression() Option
WithDisabledCompression configures the client to not apply compression on the outgoing requests.
func WithEndpoint ¶
WithEndpoint takes an HTTP endpoint as a string in the format scheme://address:port/path and configures the client to export all requests to this endpoint.
func WithHTTPClient ¶
WithHTTPClient allows to pass a custom HTTP Client instance to SAPM Client
func WithMaxConnections ¶
WithMaxConnections allows to specify the max number of open HTTP connections the client should keep at any time.
func WithTracerProvider ¶ added in v0.9.0
func WithTracerProvider(tracerProvider trace.TracerProvider) Option
WithTracerProvider returns an Option to use the TracerProvider when creating a Tracer.
func WithWorkers ¶
WithWorkers configures the client to use N number of workers.