metricsdedupprocessor

package module
v0.0.0-...-17c7cf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

Metrics Dedup Processor

Status
Stability development: metrics
Distributions []
Issues Open issues Closed issues
Code Owners @nicolastakashi

Description

This processor deduplicates metrics by ensuring that only metrics from the in-use replica are retained. It identifies the in-use replica by examining the data points attributes of incoming metrics to find the replica label. For more details, check the Defining in use replica section.

This explanation highlights that the processor inspects the metric resource attributes to determine the replica label.

processors:
  metricsdedup:
    replica_label: replica
    swap_timeout: 5m
Name Description Default
replica_label The label key that identifies the replica. replica
swap_timeout The duration that defines the time window to swap the in-use replica. 1m

Defining in use replica

The logic used to determine the in-use replica is inspired by Cortex component but adopts a simpler approach to avoid the need for distributed consensus on day zero.

Below is the sequence diagram that describes the logic used to determine the in-use replica:

sequenceDiagram
    participant Processor
    participant Receiver
    participant ReplicaInfo

    Receiver->>Processor: Send metric with replica
    Processor->>ReplicaInfo: Load current replica info
    alt No current replica
        Processor->>ReplicaInfo: Set new replica and update timestamp
    else Current replica exists
        alt Replica matches current replica
            Processor->>ReplicaInfo: Update timestamp
        else Replica different from current replica
            alt Timestamp older than swap timeout
                Processor->>ReplicaInfo: Set new replica and update timestamp
            else Timestamp within swap timeout
                Processor->>ReplicaInfo: Retain current replica
            end
        end
    end
    Processor->>Receiver: Return in-use replica

This approach ensures that only metrics from the in-use replica are processed, reducing the number of metrics processed and stored.

Documentation

Overview

Package metricsdedup deduplicates and flattens logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() processor.Factory

NewFactory returns a new factory for the Metrics Generation processor.

Types

type Config

type Config struct {
	ReplicaLabel string        `mapstructure:"replica_label"`
	SwapTimeout  time.Duration `mapstructure:"swap_timeout"`
}

func (*Config) Validate

func (cfg *Config) Validate() error

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func (*Processor) Capabilities

func (p *Processor) Capabilities() consumer.Capabilities

func (*Processor) ConsumeMetrics

func (p *Processor) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error

func (*Processor) Shutdown

func (p *Processor) Shutdown(_ context.Context) error

func (*Processor) Start

func (p *Processor) Start(_ context.Context, _ component.Host) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL