Skip to content

Commit

Permalink
Change "config refresh" to "first request"
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-bradley committed Sep 4, 2024
1 parent 06b0363 commit dd09085
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions internal/confmap/provider/eecprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions internal/confmap/provider/eecprovider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit dd09085

Please sign in to comment.