mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* [Generator] Add DRAIN span_name sanitizer * Fix linter * Fix formatting * Update default manifest * Fix build error in update-fixtures * Remove bad test * Remove misleading comment * Add per-tenant override for drain mode * Do a machines job * Address PR feedback * Address PR review: rename drain_mode config and improve sanitizer - Rename `drain_mode` to `span_name_sanitization` across all config, legacy config, interfaces, and overrides for better user-facing clarity - Add explicit default value "disabled" in RegisterFlagsAndApplyDefaults - Add ValidateSpanNameSanitization function in validation/fields.go - Rename metrics to remove DRAIN reference: `drain_spans_compacted_total` -> `spans_sanitized_total` `post_drain_demand_estimate` -> `post_sanitization_demand_estimate` - Pass configured staleDuration to NewDrainSanitizer instead of hardcoded 15min, consistent with other registry components - Extract "span_name" magic string to labelSpanName constant - Update all tests with new names and signatures * Update manifest * Use empty string as disabled * Update CHANGELOG.md Co-authored-by: Suraj Nath <[email protected]> * Update manifest --------- Co-authored-by: Suraj Nath <[email protected]>
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package registry
|
|
|
|
import (
|
|
"flag"
|
|
"time"
|
|
)
|
|
|
|
type Config struct {
|
|
// CollectionInterval controls how often to collect metrics.
|
|
// Defaults to 15s.
|
|
CollectionInterval time.Duration `yaml:"collection_interval"`
|
|
|
|
// StaleDuration controls how quickly series become stale and are deleted from the registry.
|
|
// An active series is deleted if it hasn't been updated for a more than the stale duration.
|
|
// Defaults to 15m.
|
|
StaleDuration time.Duration `yaml:"stale_duration"`
|
|
|
|
// ExternalLabels are added to any time series generated by this instance.
|
|
ExternalLabels map[string]string `yaml:"external_labels,omitempty"`
|
|
|
|
InjectTenantIDAs string `yaml:"inject_tenant_id_as,omitempty"`
|
|
|
|
// MaxLabelNameLength configures the maximum length of label names. Label names exceeding
|
|
// this limit will be truncated.
|
|
MaxLabelNameLength int `yaml:"max_label_name_length"`
|
|
|
|
// MaxLabelValueLength configures the maximum length of label values. Label values exceeding
|
|
// this limit will be truncated.
|
|
MaxLabelValueLength int `yaml:"max_label_value_length"`
|
|
}
|
|
|
|
// RegisterFlagsAndApplyDefaults registers the flags.
|
|
func (cfg *Config) RegisterFlagsAndApplyDefaults(string, *flag.FlagSet) {
|
|
cfg.CollectionInterval = 15 * time.Second
|
|
cfg.StaleDuration = 15 * time.Minute
|
|
cfg.MaxLabelNameLength = 1024
|
|
cfg.MaxLabelValueLength = 2048
|
|
}
|
|
|
|
const (
|
|
SpanNameSanitizationDisabled = ""
|
|
SpanNameSanitizationDryRun = "dry_run"
|
|
SpanNameSanitizationEnabled = "enabled"
|
|
)
|