domain

package
v1.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package domain provides domain logic.

Index

Constants

View Source
const (
	// FileCreated event type
	FileCreated = "file_created"
	// FileChanged event type
	FileChanged = "file_changed"
	// FileDeleted event type
	FileDeleted = "file_deleted"
	// FileRenamed event type
	FileRenamed = "file_rename"
)
View Source
const (
	SnappyBlockCompression = "snappy"
)

Variables

View Source
var (
	ErrJSONUnmarshal    = errors.New("failed to parse metric from request body")
	ErrMetricIDMismatch = errors.New("metric ID in path does not match product ID in body")
)

Functions

This section is empty.

Types

type FileMonitor

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

FileMonitor is responsible for monitoring changes in the secret file, and will notify components in the application that depend on the secret filePath can be a directory or a single file

func NewFileMonitor

func NewFileMonitor(ctx context.Context, bus types.Bus, filePath string) (*FileMonitor, error)

NewFileMonitor creates a new file monitor.

func (*FileMonitor) Close

func (m *FileMonitor) Close()

func (*FileMonitor) Start

func (m *FileMonitor) Start()

type MetricCollector

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

MetricCollector is responsible for collecting and flushing metrics.

func NewMetricCollector

func NewMetricCollector(s *config.Settings, clock types.TimeProvider, costStore types.WritableStore, observabilityStore types.WritableStore) (*MetricCollector, error)

NewMetricCollector creates a new MetricCollector and starts the flushing goroutine.

func (*MetricCollector) Close

func (d *MetricCollector) Close()

Close stops the flushing goroutine gracefully.

func (*MetricCollector) DecodeV1

func (d *MetricCollector) DecodeV1(data []byte) ([]types.Metric, error)

DecodeV1 decompresses and decodes a Protobuf v1 WriteRequest, then converts it to a slice of Metric structs.

func (*MetricCollector) DecodeV2

func (d *MetricCollector) DecodeV2(data []byte) ([]types.Metric, *remote.WriteResponseStats, error)

DecodeV2 decompresses and decodes a Protobuf v2 WriteRequest, then converts it to a slice of Metric structs and collects stats.

func (*MetricCollector) Flush

func (d *MetricCollector) Flush(ctx context.Context) error

Flush triggers the flushing of accumulated metrics.

func (*MetricCollector) PutMetrics

func (d *MetricCollector) PutMetrics(ctx context.Context, contentType, encodingType string, body []byte) (*remote.WriteResponseStats, error)

PutMetrics appends metrics and returns write response stats.

type MetricFilter

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

MetricFilter is a filter that can be used to filter metrics, including labels, according to the configuration provided.

func NewMetricFilter

func NewMetricFilter(cfg *config.Metrics) (*MetricFilter, error)

NewMetricFilter creates a new MetricFilter for the given configuration.

func (*MetricFilter) Filter

func (mf *MetricFilter) Filter(metrics []types.Metric) (costMetrics []types.Metric, observabilityMetrics []types.Metric)

Filter processes the supplied metrics through the filter. It returns two slices, the first being the list of cost metrics, the second being the list of observability metrics, both of which have also had the labels filtered to only include those that match the filter.

Directories

Path Synopsis
Package backfiller provides functionality to backfill Kubernetes resources and store them in a specified storage.
Package backfiller provides functionality to backfill Kubernetes resources and store them in a specified storage.
Package filter provides low-level functionality for metric filtering.
Package filter provides low-level functionality for metric filtering.
Package healthz provides a simple and extensible health check mechanism for HTTP services.
Package healthz provides a simple and extensible health check mechanism for HTTP services.
Package housekeeper provides a mechanism for cleaning up stale data in a resource store.
Package housekeeper provides a mechanism for cleaning up stale data in a resource store.
Package k8s provides utilities for interacting with Kubernetes clusters.
Package k8s provides utilities for interacting with Kubernetes clusters.
Package monitor provides functionality to manage and reload secrets dynamically.
Package monitor provides functionality to manage and reload secrets dynamically.
Package pusher provides a mechanism for pushing metrics to a remote write endpoint.
Package pusher provides a mechanism for pushing metrics to a remote write endpoint.
Package shipper provides domain logic for for the shipper.
Package shipper provides domain logic for for the shipper.

Jump to

Keyboard shortcuts

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