From 93842ed5bb1ba61f8b153b272c924b8dd99116d0 Mon Sep 17 00:00:00 2001 From: Kostiantyn Masliuk <1pkg@protonmail.com> Date: Tue, 4 Feb 2025 16:46:51 -0800 Subject: [PATCH] kibana: add x-elastic-product-origin header to the client --- internal/kibana/client.go | 4 ++++ internal/kibana/client_test.go | 1 + 2 files changed, 5 insertions(+) diff --git a/internal/kibana/client.go b/internal/kibana/client.go index b4d8a4d7158..35d3f665b41 100644 --- a/internal/kibana/client.go +++ b/internal/kibana/client.go @@ -41,6 +41,10 @@ type Client struct { func NewClient(cfg ClientConfig) (*Client, error) { // Never fetch the Kibana version; we don't use it. cfg.IgnoreVersion = true + if cfg.Headers == nil { + cfg.Headers = make(map[string]string) + } + cfg.Headers["X-Elastic-Product-Origin"] = "observability" client, err := kibana.NewClientWithConfig( &cfg, "apm-server", version.VersionWithQualifier(), diff --git a/internal/kibana/client_test.go b/internal/kibana/client_test.go index 0595e9c437f..2775ce310e9 100644 --- a/internal/kibana/client_test.go +++ b/internal/kibana/client_test.go @@ -92,6 +92,7 @@ func TestClientHeaders(t *testing.T) { assert.Equal(t, "Basic dXNlcjpwYXNz", headers.Get("Authorization")) assert.Equal(t, []string{"abc", "123"}, headers.Values("Combined")) + assert.Equal(t, "observability", headers.Get("X-Elastic-Product-Origin")) } func TestClientSend(t *testing.T) {