mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* First working draft of cost attribution usage tracker * Add missing tracker name label, more efficient batch proportioning, cleanup * Reduce series hashing * Fix user-configurable overrides tests for new json element * lint * Add per-tenant override for max cardinality * lint, review feedback * Default to not enabled, cleanup test config * Explicitly check for usage_metrics handler * review feedback * Update tracker to support many-to-one mapping with relabel * lint * New behavior for missing and overflow * Fix issue where subsequent spans would incorrectly reuse the series of the previous span if they were missing values * Revert maps back to slices now that we can depend on a dimension always having a value * Please ignore benchmark profiles * Tweak config to have specific cost attribution tracker section. Update manifest and config index * lint * changelog * Update api docs for new endpoint * Review feedback * review feedback * Swap loop order for a tad more performance
31 lines
836 B
Go
31 lines
836 B
Go
package usage
|
|
|
|
import (
|
|
"flag"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
defaultMaxCardinality = uint64(10000)
|
|
defaultStaleDuration = 15 * time.Minute
|
|
defaultPurgePeriod = time.Minute
|
|
)
|
|
|
|
type PerTrackerConfig struct {
|
|
Enabled bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
|
|
MaxCardinality uint64 `yaml:"max_cardinality,omitempty" json:"max_cardinality,omitempty"`
|
|
StaleDuration time.Duration `yaml:"stale_duration,omitempty" json:"stale_duration,omitempty"`
|
|
}
|
|
|
|
type Config struct {
|
|
CostAttribution PerTrackerConfig `yaml:"cost_attribution,omitempty" json:"cost_attribution,omitempty"`
|
|
}
|
|
|
|
func (c *Config) RegisterFlagsAndApplyDefaults(_ string, _ *flag.FlagSet) {
|
|
c.CostAttribution = PerTrackerConfig{
|
|
Enabled: false,
|
|
MaxCardinality: defaultMaxCardinality,
|
|
StaleDuration: defaultStaleDuration,
|
|
}
|
|
}
|