Documentation ¶
Index ¶
- Constants
- type Compression
- type GRPCOption
- func WithGRPCCompressor(compressor string) GRPCOption
- func WithGRPCConn(conn *grpc.ClientConn) GRPCOption
- func WithGRPCDialOption(opts ...grpc.DialOption) GRPCOption
- func WithGRPCEndpoint(endpoint string) GRPCOption
- func WithGRPCHeaders(headers map[string]string) GRPCOption
- func WithGRPCInsecure() GRPCOption
- func WithGRPCReconnectionPeriod(rp time.Duration) GRPCOption
- func WithGRPCRetry(settings OTLPGRPCRetryConfig) GRPCOption
- func WithGRPCServiceConfig(serviceConfig string) GRPCOption
- func WithGRPCTLSCredentials(creds credentials.TransportCredentials) GRPCOption
- func WithGRPCTimeout(duration time.Duration) GRPCOption
- type MetricClient
- type MetricExporter
- func NewMetric(ctx context.Context, client MetricClient, opts ...MetricOption) (*MetricExporter, error)
- func NewMetricHTTP(ctx context.Context, opts ...MetricHTTPOption) (*MetricExporter, error)
- func NewMetricHTTPUnstarted(opts ...MetricHTTPOption) *MetricExporter
- func NewMetricPUnstarted(client MetricClient, opts ...MetricOption) *MetricExporter
- func NewOTLPGRPCMetric(ctx context.Context, opts ...GRPCOption) (*MetricExporter, error)
- func NewOTLPGRPCMetricUnstarted(opts ...GRPCOption) *MetricExporter
- type MetricHTTPOption
- func WithMetricHTTPBackoff(duration time.Duration) MetricHTTPOptiondeprecated
- func WithMetricHTTPCompression(compression Compression) MetricHTTPOption
- func WithMetricHTTPEndpoint(endpoint string) MetricHTTPOption
- func WithMetricHTTPHeaders(headers map[string]string) MetricHTTPOption
- func WithMetricHTTPInsecure() MetricHTTPOption
- func WithMetricHTTPMaxAttempts(maxAttempts int) MetricHTTPOptiondeprecated
- func WithMetricHTTPRetry(rc MetricHTTPRetryConfig) MetricHTTPOption
- func WithMetricHTTPTLSClientConfig(tlsCfg *tls.Config) MetricHTTPOption
- func WithMetricHTTPTimeout(duration time.Duration) MetricHTTPOption
- func WithMetricHTTPURLPath(urlPath string) MetricHTTPOption
- type MetricHTTPRetryConfig
- type MetricOption
- type OTLPGRPCRetryConfig
Constants ¶
const ( // OTLPMetricHTTPNoCompression tells the driver to send payloads without // compression. MetricHTTPNoCompression = otlpmetrichttp.NoCompression // OTLPMetricHTTPGzipCompression tells the driver to send payloads after // compressing them with gzip. MetricHTTPGzipCompression = otlpmetrichttp.GzipCompression )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compression ¶
type Compression = otlpmetrichttp.Compression
Compression describes the compression used for payloads sent to the collector.
type GRPCOption ¶
type GRPCOption = otlpmetricgrpc.Option
GRPCOption applies an option to the gRPC driver.
func WithGRPCCompressor ¶
func WithGRPCCompressor(compressor string) GRPCOption
WithGRPCCompressor sets the compressor for the gRPC client to use when sending requests. It is the responsibility of the caller to ensure that the compressor set has been registered with google.golang.org/grpc/encoding. This can be done by encoding.RegisterCompressor. Some compressors auto-register on import, such as gzip, which can be registered by calling `import _ "google.golang.org/grpc/encoding/gzip"`.
This option has no effect if WithGRPCConn is used.
func WithGRPCConn ¶
func WithGRPCConn(conn *grpc.ClientConn) GRPCOption
WithGRPCConn sets conn as the gRPC ClientConn used for all communication.
This option takes precedence over any other option that relates to establishing or persisting a gRPC connection to a target endpoint. Any other option of those types passed will be ignored.
It is the callers responsibility to close the passed conn. The client Shutdown method will not close this connection.
func WithGRPCDialOption ¶
func WithGRPCDialOption(opts ...grpc.DialOption) GRPCOption
WithGRPCDialOption sets explicit grpc.DialOptions to use when making a connection. The options here are appended to the internal grpc.DialOptions used so they will take precedence over any other internal grpc.DialOptions they might conflict with.
This option has no effect if WithGRPCConn is used.
func WithGRPCEndpoint ¶
func WithGRPCEndpoint(endpoint string) GRPCOption
WithEndpoint sets the target endpoint the exporter will connect to. If unset, localhost:4317 will be used as a default.
This option has no effect if WithGRPCConn is used.
func WithGRPCHeaders ¶
func WithGRPCHeaders(headers map[string]string) GRPCOption
WithGRPCHeaders will send the provided headers with each gRPC requests.
func WithGRPCInsecure ¶
func WithGRPCInsecure() GRPCOption
WithInsecure disables client transport security for the exporter's gRPC connection just like grpc.WithInsecure() (https://pkg.go.dev/google.golang.org/grpc#WithInsecure) does. Note, by default, client security is required unless WithInsecure is used.
This option has no effect if WithGRPCConn is used.
func WithGRPCReconnectionPeriod ¶
func WithGRPCReconnectionPeriod(rp time.Duration) GRPCOption
WithGRPCReconnectionPeriod set the minimum amount of time between connection attempts to the target endpoint.
This option has no effect if WithGRPCConn is used.
func WithGRPCRetry ¶
func WithGRPCRetry(settings OTLPGRPCRetryConfig) GRPCOption
WithGRPCRetry sets the retry policy for transient retryable errors that may be returned by the target endpoint when exporting a batch of spans.
If the target endpoint responds with not only a retryable error, but explicitly returns a backoff time in the response. That time will take precedence over these settings.
These settings do not define any network retry strategy. That is entirely handled by the gRPC ClientConn.
If unset, the default retry policy will be used. It will retry the export 5 seconds after receiving a retryable error and increase exponentially after each error for no more than a total time of 1 minute.
func WithGRPCServiceConfig ¶
func WithGRPCServiceConfig(serviceConfig string) GRPCOption
WithGRPCServiceConfig defines the default gRPC service config used.
This option has no effect if WithGRPCConn is used.
func WithGRPCTLSCredentials ¶
func WithGRPCTLSCredentials(creds credentials.TransportCredentials) GRPCOption
WithGRPCTLSCredentials allows the connection to use TLS credentials when talking to the server. It takes in grpc.TransportCredentials instead of say a Certificate file or a tls.Certificate, because the retrieving of these credentials can be done in many ways e.g. plain file, in code tls.Config or by certificate rotation, so it is up to the caller to decide what to use.
This option has no effect if WithGRPCConn is used.
func WithGRPCTimeout ¶
func WithGRPCTimeout(duration time.Duration) GRPCOption
WithGRPCTimeout sets the max amount of time a client will attempt to export a batch of spans. This takes precedence over any retry settings defined with WithRetry, once this time limit has been reached the export is abandoned and the batch of spans is dropped.
If unset, the default timeout will be set to 10 seconds.
type MetricClient ¶
type MetricClient = otlpmetric.Client
MetricClient manages connections to the collector, handles the transformation of data into wire format, and the transmission of that data to the collector.
func NewMetricHTTPClient ¶
func NewMetricHTTPClient(opts ...MetricHTTPOption) MetricClient
NewMetricHTTPClient creates a new HTTP metric client.
func NewOTLPGRPCMetricClient ¶
func NewOTLPGRPCMetricClient(opts ...GRPCOption) MetricClient
NewOTLPGRPCMetricClient creates a new gRPC metric client.
type MetricExporter ¶
type MetricExporter = otlpmetric.Exporter
MetricExporter exports metrics data in the OTLP wire format.
func NewMetric ¶
func NewMetric(ctx context.Context, client MetricClient, opts ...MetricOption) (*MetricExporter, error)
NewMetric constructs a new Exporter and starts it.
func NewMetricHTTP ¶
func NewMetricHTTP(ctx context.Context, opts ...MetricHTTPOption) (*MetricExporter, error)
NewMetricHTTP constructs a new Exporter and starts it.
func NewMetricHTTPUnstarted ¶
func NewMetricHTTPUnstarted(opts ...MetricHTTPOption) *MetricExporter
NewMetricHTTPUnstarted constructs a new Exporter and does not start it.
func NewMetricPUnstarted ¶
func NewMetricPUnstarted(client MetricClient, opts ...MetricOption) *MetricExporter
NewMetricUnstarted constructs a new Exporter and does not start it.
func NewOTLPGRPCMetric ¶
func NewOTLPGRPCMetric(ctx context.Context, opts ...GRPCOption) (*MetricExporter, error)
NewOTLPGRPCMetric constructs a new Exporter and starts it.
func NewOTLPGRPCMetricUnstarted ¶
func NewOTLPGRPCMetricUnstarted(opts ...GRPCOption) *MetricExporter
NewOTLPGPRCetricUnstarted constructs a new Exporter and does not start it.
type MetricHTTPOption ¶
type MetricHTTPOption = otlpmetrichttp.Option
MetricHTTPOption applies an option to the HTTP client.
func WithMetricHTTPBackoff
deprecated
func WithMetricHTTPBackoff(duration time.Duration) MetricHTTPOption
WithMetricHTTPBackoff tells the driver to use the duration as a base of the exponential backoff strategy. If unset, default (300ms) will be used.
Deprecated: Use WithRetry instead.
func WithMetricHTTPCompression ¶
func WithMetricHTTPCompression(compression Compression) MetricHTTPOption
WithMetricHTTPCompression tells the driver to compress the sent data.
func WithMetricHTTPEndpoint ¶
func WithMetricHTTPEndpoint(endpoint string) MetricHTTPOption
WithMetricHTTPEndpoint allows one to set the address of the collector endpoint that the driver will use to send metrics. If unset, it will instead try to use the default endpoint (localhost:4318). Note that the endpoint must not contain any URL path.
func WithMetricHTTPHeaders ¶
func WithMetricHTTPHeaders(headers map[string]string) MetricHTTPOption
WithMetricHTTPHeaders allows one to tell the driver to send additional HTTP headers with the payloads. Specifying headers like Content-Length, Content-Encoding and Content-Type may result in a broken driver.
func WithMetricHTTPInsecure ¶
func WithMetricHTTPInsecure() MetricHTTPOption
WithMetricHTTPInsecure tells the driver to connect to the collector using the HTTP scheme, instead of HTTPS.
func WithMetricHTTPMaxAttempts
deprecated
func WithMetricHTTPMaxAttempts(maxAttempts int) MetricHTTPOption
WithMetricHTTPMaxAttempts allows one to override how many times the driver will try to send the payload in case of retryable errors. The max attempts is limited to at most 5 retries. If unset, default (5) will be used.
Deprecated: Use WithRetry instead.
func WithMetricHTTPRetry ¶
func WithMetricHTTPRetry(rc MetricHTTPRetryConfig) MetricHTTPOption
WithMetricHTTPRetry configures the retry policy for transient errors that may occurs when exporting traces. An exponential back-off algorithm is used to ensure endpoints are not overwhelmed with retries. If unset, the default retry policy will retry after 5 seconds and increase exponentially after each error for a total of 1 minute.
func WithMetricHTTPTLSClientConfig ¶
func WithMetricHTTPTLSClientConfig(tlsCfg *tls.Config) MetricHTTPOption
WithMetricHTTPTLSClientConfig can be used to set up a custom TLS configuration for the client used to send payloads to the collector. Use it if you want to use a custom certificate.
func WithMetricHTTPTimeout ¶
func WithMetricHTTPTimeout(duration time.Duration) MetricHTTPOption
WithMetricHTTPTimeout tells the driver the max waiting time for the backend to process each metrics batch. If unset, the default will be 10 seconds.
func WithMetricHTTPURLPath ¶
func WithMetricHTTPURLPath(urlPath string) MetricHTTPOption
WithMetricHTTPURLPath allows one to override the default URL path used for sending metrics. If unset, default ("/v1/metrics") will be used.
type MetricHTTPRetryConfig ¶
type MetricHTTPRetryConfig = otlpmetrichttp.RetryConfig
MetricHTTPRetryConfig defines configuration for retrying batches in case of export failure using an exponential backoff.
type MetricOption ¶
type MetricOption = otlpmetric.Option
MetricOption are setting options passed to an Exporter on creation.
func WithMetricMetricAggregationTemporalitySelector ¶
func WithMetricMetricAggregationTemporalitySelector(selector aggregation.TemporalitySelector) MetricOption
WithMetricMetricAggregationTemporalitySelector defines the aggregation.TemporalitySelector used for selecting aggregation.Temporality (i.e., Cumulative vs. Delta aggregation). If not specified otherwise, exporter will use a cumulative temporality selector.
type OTLPGRPCRetryConfig ¶
type OTLPGRPCRetryConfig = otlpmetricgrpc.RetryConfig
OTLPGRPCRetryConfig defines configuration for retrying export of span batches that failed to be received by the target endpoint.
This configuration does not define any network retry strategy. That is entirely handled by the gRPC ClientConn.