Documentation
¶
Index ¶
Constants ¶
View Source
const (
MaxAllowedChunkSize = 20 * 1024 * 1024 // 20MB
)
Variables ¶
This section is empty.
Functions ¶
func NewAPI ¶
func NewAPI(apiAddr, clusterID, token string, isInsecure bool) (*grpc.ClientConn, pb.IngestionAPIClient, error)
Types ¶
type ClientOption ¶
type ClientOption func(*metricClient)
func WithDrainTimeout ¶
func WithDrainTimeout(timeout time.Duration) ClientOption
func WithFlushInterval ¶
func WithFlushInterval(interval time.Duration) ClientOption
func WithMaxRetryTimeout ¶
func WithMaxRetryTimeout(timeout time.Duration) ClientOption
type Metric ¶
func NewMetric ¶
func NewMetric[T any](client MetricClient, opts ...MetricOption[T]) (Metric[T], error)
type MetricClient ¶
type MetricClient interface {
Start(ctx context.Context) error
// contains filtered or unexported methods
}
func NewMetricClient ¶
func NewMetricClient( cfg Config, logger *logging.Logger, options ...ClientOption, ) (MetricClient, error)
NewMetricClient creates a new MetricClient instance which is responsible for sending metrics to the ingestion service. It validates the provided configuration, sets up gRPC connection, and initializes the client. The returned client can then be started with the Start method to begin periodic metric flushing.
Parameters:
- cfg: Configuration struct containing API address, token, cluster ID, and other optional settings.
- logger: Logger instance for diagnostic and error messages.
Returns:
- MetricClient: an initialized metrics client ready to start flushing metrics.
- error: if required parameters are missing or if the gRPC client cannot be created.
type MetricOption ¶
func WithAvroSchema ¶
func WithAvroSchema[T any](schema avro.Schema) MetricOption[T]
func WithCollectionName ¶
func WithCollectionName[T any](name string) MetricOption[T]
func WithMaxChunkSize ¶
func WithMaxChunkSize[T any](size int) MetricOption[T]
func WithSchema ¶
func WithSchema[T any](schema string) MetricOption[T]
func WithSkipTimestamp ¶
func WithSkipTimestamp[T any]() MetricOption[T]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.