domain

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: Apache-2.0 Imports: 23 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.

func (*MetricCollector) Settings added in v1.2.0

func (d *MetricCollector) Settings() *config.Settings

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, droppedMetrics []types.Metric)

Filter processes the supplied metrics through the filter. It returns three slices: the first being the list of cost metrics, the second being the list of observability metrics, and the third being the list of dropped metrics. Both cost and observability metrics have also had the labels filtered to only include those that match the filter. Dropped metrics are defined as those which matched neither the cost nor observability filters.

Directories

Path Synopsis
Package diagnostic contains an interface to be implemented by diagnostics providers.
Package diagnostic contains an interface to be implemented by diagnostics providers.
catalog
Package catalog contains the registry of diagnostics.
Package catalog contains the registry of diagnostics.
common
Package common contains common utilities.
Package common contains common utilities.
cz
Package cz contains code for checking a CloudZero API token.
Package cz contains code for checking a CloudZero API token.
k8s/namespace
Package namespace contains code for checking the Kubernetes configuration.
Package namespace contains code for checking the Kubernetes configuration.
k8s/provider
Package provider contains code for checking the Kubernetes configuration.
Package provider contains code for checking the Kubernetes configuration.
k8s/version
Package version contains code for checking the Kubernetes configuration.
Package version contains code for checking the Kubernetes configuration.
kms
Package kms contains code for testing access the Kubernetes Management Service.
Package kms contains code for testing access the Kubernetes Management Service.
prom/config
Package config contains a diagnostic provider for checking the Prometheus configuration.
Package config contains a diagnostic provider for checking the Prometheus configuration.
prom/version
Package version contains a diagnostic provider for checking the Prometheus version.
Package version contains a diagnostic provider for checking the Prometheus version.
runner
Package runner contains tools for running diagnostics.
Package runner contains tools for running diagnostics.
stage
Package stage contains a diagnostic provider for checking the stage.
Package stage contains a diagnostic provider for checking the stage.
webhook
Package webhook contains code for checking a CloudZero API token.
Package webhook contains code for checking a CloudZero API token.
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 gives a unified interface for k8s information to be retrieved.
Package k8s gives a unified interface for k8s information to be retrieved.
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 the shipper.
Package shipper provides domain logic for the shipper.
Package webhook provides kubernetes webhook resource business logic.
Package webhook provides kubernetes webhook resource business logic.
backfiller
Package backfiller provides functionality to backfill Kubernetes Resource objects, and if enabled invokes the webhook domain logic
Package backfiller provides functionality to backfill Kubernetes Resource objects, and if enabled invokes the webhook domain logic
handler
Package handler admission webhook handlers (hook.Handler) for various resource types.
Package handler admission webhook handlers (hook.Handler) for various resource types.
helper
Package helper contains decode helper methods for transforming kubernetes metav1.Objects into K8sObjects
Package helper contains decode helper methods for transforming kubernetes metav1.Objects into K8sObjects
hook
Package hook contains structures and interfaces for implementing admission webhooks handlers.
Package hook contains structures and interfaces for implementing admission webhooks handlers.

Jump to

Keyboard shortcuts

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