Skip to content

host info processor merge in user configurable overrides #5118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion modules/overrides/runtime_config_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/drone/envsubst"
"github.com/go-kit/log/level"

"github.com/grafana/dskit/runtimeconfig"
"github.com/grafana/dskit/services"
"github.com/prometheus/client_golang/prometheus"
Expand Down
14 changes: 14 additions & 0 deletions modules/overrides/user_configurable_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,20 @@ func (o *userConfigurableOverridesManager) MetricsGeneratorProcessorSpanMetricsT
return o.Interface.MetricsGeneratorProcessorSpanMetricsTargetInfoExcludedDimensions(userID)
}

func (o *userConfigurableOverridesManager) MetricsGeneratorProcessorHostInfoHostIdentifiers(userID string) []string {
if hostIdentifiers, ok := o.getTenantLimits(userID).GetMetricsGenerator().GetProcessor().GetHostInfo().GetHostIdentifiers(); ok {
return hostIdentifiers
}
return o.Interface.MetricsGeneratorProcessorHostInfoHostIdentifiers(userID)
}

func (o *userConfigurableOverridesManager) MetricsGeneratorProcessorHostInfoMetricName(userID string) string {
if metricName, ok := o.getTenantLimits(userID).GetMetricsGenerator().GetProcessor().GetHostInfo().GetMetricName(); ok {
return metricName
}
return o.Interface.MetricsGeneratorProcessorHostInfoMetricName(userID)
}

// statusUserConfigurableOverrides used to marshal userconfigurableoverrides.Limits for tenants
type statusUserConfigurableOverrides struct {
TenantLimits tenantLimits `yaml:"user_configurable_overrides" json:"user_configurable_overrides"`
Expand Down
10 changes: 8 additions & 2 deletions modules/overrides/user_configurable_overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func TestUserConfigOverridesManager_MergeRuntimeConfig(t *testing.T) {
assert.NotEqual(t, mgr.Forwarders(tenantID), baseMgr.Forwarders(tenantID))

// Processors will be the merged result between runtime and user-configurable overrides
assert.Equal(t, mgr.MetricsGeneratorProcessors(tenantID), map[string]struct{}{"local-blocks": {}, "service-graphs": {}, "span-metrics": {}})
assert.Equal(t, mgr.MetricsGeneratorProcessors(tenantID), map[string]struct{}{"local-blocks": {}, "service-graphs": {}, "span-metrics": {}, "host-info": {}})

// For the remaining settings runtime overrides will bubble up
assert.Equal(t, mgr.IngestionRateStrategy(), baseMgr.IngestionRateStrategy())
Expand Down Expand Up @@ -436,6 +436,8 @@ func TestUserConfigOverridesManager_MergeRuntimeConfig(t *testing.T) {
assert.Equal(t, mgr.MetricsGeneratorProcessorSpanMetricsEnableTargetInfo(tenantID), baseMgr.MetricsGeneratorProcessorSpanMetricsEnableTargetInfo(tenantID))
assert.Equal(t, mgr.MetricsGeneratorProcessorServiceGraphsEnableClientServerPrefix(tenantID), baseMgr.MetricsGeneratorProcessorServiceGraphsEnableClientServerPrefix(tenantID))
assert.Equal(t, mgr.MetricsGeneratorProcessorSpanMetricsTargetInfoExcludedDimensions(tenantID), baseMgr.MetricsGeneratorProcessorSpanMetricsTargetInfoExcludedDimensions(tenantID))
assert.Equal(t, mgr.MetricsGeneratorProcessorHostInfoHostIdentifiers(tenantID), baseMgr.MetricsGeneratorProcessorHostInfoHostIdentifiers(tenantID))
assert.Equal(t, mgr.MetricsGeneratorProcessorHostInfoMetricName(tenantID), baseMgr.MetricsGeneratorProcessorHostInfoMetricName(tenantID))
assert.Equal(t, mgr.BlockRetention(tenantID), baseMgr.BlockRetention(tenantID))
assert.Equal(t, mgr.MaxSearchDuration(tenantID), baseMgr.MaxSearchDuration(tenantID))
assert.Equal(t, mgr.DedicatedColumns(tenantID), baseMgr.DedicatedColumns(tenantID))
Expand All @@ -462,7 +464,7 @@ func perTenantRuntimeOverrides(tenantID string) *perTenantOverrides {
},
MetricsGenerator: MetricsGeneratorOverrides{
RingSize: 2,
Processors: listtomap.ListToMap{"span-metrics": {}, "service-graphs": {}},
Processors: listtomap.ListToMap{"span-metrics": {}, "service-graphs": {}, "host-info": {}},
MaxActiveSeries: 60000,
CollectionInterval: 15 * time.Second,
DisableCollection: false,
Expand Down Expand Up @@ -494,6 +496,10 @@ func perTenantRuntimeOverrides(tenantID string) *perTenantOverrides {
TraceIdlePeriod: 20 * time.Second,
CompleteBlockTimeout: 30 * time.Second,
},
HostInfo: HostInfoOverrides{
HostIdentifiers: []string{"host.name"},
MetricName: "override_host_info",
},
},
IngestionSlack: 0,
},
Expand Down
7 changes: 7 additions & 0 deletions modules/overrides/userconfigurable/client/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ func (l *LimitsMetricsGeneratorProcessor) GetSpanMetrics() *LimitsMetricsGenerat
return nil
}

func (l *LimitsMetricsGeneratorProcessor) GetHostInfo() *LimitsMetricGeneratorProcessorHostInfo {
if l != nil {
return &l.HostInfo
}
return nil
}

type LimitsMetricsGeneratorProcessorServiceGraphs struct {
Dimensions *[]string `yaml:"dimensions,omitempty" json:"dimensions,omitempty"`
EnableClientServerPrefix *bool `yaml:"enable_client_server_prefix,omitempty" json:"enable_client_server_prefix,omitempty"`
Expand Down