Tempo: add custom grpc limits

This commit is contained in:
Gareth Dawson
2026-01-08 22:08:54 +09:00
parent ec55871b9b
commit 57930f22f5
4 changed files with 42 additions and 1 deletions
@@ -77,6 +77,8 @@ type PluginInstanceCfg struct {
SigV4AuthEnabled bool
SigV4VerboseLogging bool
LiveClientQueueMaxSize int
}
// ProvidePluginInstanceConfig returns a new PluginInstanceCfg.
@@ -124,6 +126,7 @@ func ProvidePluginInstanceConfig(cfg *setting.Cfg, settingProvider setting.Provi
ResponseLimit: cfg.ResponseLimit,
SigV4AuthEnabled: cfg.SigV4AuthEnabled,
SigV4VerboseLogging: cfg.SigV4VerboseLogging,
LiveClientQueueMaxSize: cfg.LiveClientQueueMaxSize,
}, nil
}
@@ -198,5 +198,10 @@ func (s *RequestConfigProvider) PluginRequestConfig(ctx context.Context, pluginI
m[backend.AppClientSecret] = externalService.ClientSecret
}
if pluginID == "tempo" {
const liveClientQueueMaxSize = "GF_LIVE_CLIENT_QUEUE_MAX_SIZE"
m[liveClientQueueMaxSize] = strconv.Itoa(s.cfg.LiveClientQueueMaxSize)
}
return m
}
@@ -259,6 +259,24 @@ func TestRequestConfigProvider_PluginRequestConfig_concurrentQueryCount(t *testi
})
}
func TestRequestConfigProvider_PluginRequestConfig_liveClientQueueMaxSize(t *testing.T) {
t.Run("Sets the live client queue max size only for Tempo", func(t *testing.T) {
cfg := setting.NewCfg()
cfg.LiveClientQueueMaxSize = 123
pCfg, err := ProvidePluginInstanceConfig(cfg, setting.ProvideProvider(cfg), featuremgmt.WithFeatures())
require.NoError(t, err)
p := NewRequestConfigProvider(pCfg, &fakeSSOSettingsProvider{})
require.Subset(t, p.PluginRequestConfig(context.Background(), "tempo", nil), map[string]string{
"GF_LIVE_CLIENT_QUEUE_MAX_SIZE": "123",
})
require.NotContains(t, p.PluginRequestConfig(context.Background(), "prometheus", nil), "GF_LIVE_CLIENT_QUEUE_MAX_SIZE")
})
}
func TestRequestConfigProvider_PluginRequestConfig_azureAuthEnabled(t *testing.T) {
t.Run("Uses the configured azureAuthEnabled", func(t *testing.T) {
cfg := &PluginInstanceCfg{