From dd090859776f10d9df35f4a785213cc653127ab7 Mon Sep 17 00:00:00 2001 From: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:26:15 -0400 Subject: [PATCH] Change "config refresh" to "first request" --- internal/confmap/provider/eecprovider/provider.go | 6 +++--- internal/confmap/provider/eecprovider/provider_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/confmap/provider/eecprovider/provider.go b/internal/confmap/provider/eecprovider/provider.go index 7c572231..bc1f6ce7 100644 --- a/internal/confmap/provider/eecprovider/provider.go +++ b/internal/confmap/provider/eecprovider/provider.go @@ -36,7 +36,7 @@ const ( AuthHeaderKey = "Authorization" ApiTokenPrefixFormat = "Api-Token %s" - ConfigRefreshHeaderKey = "X-Otelcol-Config-Refresh" + FirstRequestHeaderKey = "X-Otelcol-First-Request" ConfigChangedHeaderKey = "X-Otelcol-Config-Changed" ) @@ -175,7 +175,7 @@ func (p *provider) Retrieve(ctx context.Context, uri string, watcherFunc confmap if err != nil { return nil, err } - req.Header.Add(ConfigRefreshHeaderKey, "false") + req.Header.Add(FirstRequestHeaderKey, "true") req.Header.Add(ConfigChangedHeaderKey, "false") body, err = p.getConfigBytes(client, req) @@ -211,7 +211,7 @@ func (p *provider) Retrieve(ctx context.Context, uri string, watcherFunc confmap if err != nil { return nil, err } - req.Header.Add(ConfigRefreshHeaderKey, "true") + req.Header.Add(FirstRequestHeaderKey, "false") req.Header.Add(ConfigChangedHeaderKey, configChanged) diff --git a/internal/confmap/provider/eecprovider/provider_test.go b/internal/confmap/provider/eecprovider/provider_test.go index 47d83d0c..c28d7e34 100644 --- a/internal/confmap/provider/eecprovider/provider_test.go +++ b/internal/confmap/provider/eecprovider/provider_test.go @@ -576,7 +576,7 @@ func TestFragmentConfiguration(t *testing.T) { assert.NoError(t, ep.Shutdown(context.Background())) } -func TestConfigRefreshHeader(t *testing.T) { +func TestFirstRequestHeader(t *testing.T) { count := &atomic.Int64{} answerWithConfig := func(w http.ResponseWriter, req *http.Request) { @@ -600,9 +600,9 @@ func TestConfigRefreshHeader(t *testing.T) { } if count.Load() == 0 { - assert.Equal(t, "false", req.Header.Get(ConfigRefreshHeaderKey)) + assert.Equal(t, "true", req.Header.Get(FirstRequestHeaderKey)) } else { - assert.Equal(t, "true", req.Header.Get(ConfigRefreshHeaderKey)) + assert.Equal(t, "false", req.Header.Get(FirstRequestHeaderKey)) } count.Add(1)