From 7206eaffddbaf5e2f32df31643c5c7d77ccd8d4f Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Tue, 13 Aug 2024 10:50:20 +0530 Subject: [PATCH 01/14] Configure healthcheck extension Signed-off-by: Wise-Wizard --- .../extension/healthcheckextension/config.go | 71 +++++++++++++++++++ .../extension/healthcheckextension/factory.go | 53 ++++++++++++++ .../extension/healthcheckextension/server.go | 28 ++++++++ 3 files changed, 152 insertions(+) create mode 100644 cmd/jaeger/internal/extension/healthcheckextension/config.go create mode 100644 cmd/jaeger/internal/extension/healthcheckextension/factory.go create mode 100644 cmd/jaeger/internal/extension/healthcheckextension/server.go diff --git a/cmd/jaeger/internal/extension/healthcheckextension/config.go b/cmd/jaeger/internal/extension/healthcheckextension/config.go new file mode 100644 index 00000000000..e059698e0da --- /dev/null +++ b/cmd/jaeger/internal/extension/healthcheckextension/config.go @@ -0,0 +1,71 @@ +package healthcheckextension + +import ( + "errors" + "strings" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" +) + +type ResponseBodySettings struct { + // Healthy represents the body of the response returned when the collector is healthy. + // The default value is "" + Healthy string `mapstructure:"healthy"` + + // Unhealthy represents the body of the response returned when the collector is unhealthy. + // The default value is "" + Unhealthy string `mapstructure:"unhealthy"` +} + +// Config has the configuration for the extension enabling the health check +// extension, used to report the health status of the service. +type Config struct { + confighttp.ServerConfig `mapstructure:",squash"` + + // Path represents the path the health check service will serve. + // The default path is "/". + Path string `mapstructure:"path"` + + // ResponseBody represents the body of the response returned by the health check service. + // This overrides the default response that it would return. + ResponseBody *ResponseBodySettings `mapstructure:"response_body"` + + // CheckCollectorPipeline contains the list of settings of collector pipeline health check + CheckCollectorPipeline checkCollectorPipelineSettings `mapstructure:"check_collector_pipeline"` +} + +var _ component.Config = (*Config)(nil) +var ( + errNoEndpointProvided = errors.New("bad config: endpoint must be specified") + errInvalidExporterFailureThresholdProvided = errors.New("bad config: exporter_failure_threshold expects a positive number") + errInvalidPath = errors.New("bad config: path must start with /") +) + +// Validate checks if the extension configuration is valid +func (cfg *Config) Validate() error { + _, err := time.ParseDuration(cfg.CheckCollectorPipeline.Interval) + if err != nil { + return err + } + if cfg.Endpoint == "" { + return errNoEndpointProvided + } + if cfg.CheckCollectorPipeline.ExporterFailureThreshold <= 0 { + return errInvalidExporterFailureThresholdProvided + } + if !strings.HasPrefix(cfg.Path, "/") { + return errInvalidPath + } + return nil +} + +type checkCollectorPipelineSettings struct { + // Enabled indicates whether to not enable collector pipeline check. + Enabled bool `mapstructure:"enabled"` + // Interval the time range to check healthy status of collector pipeline + Interval string `mapstructure:"interval"` + // ExporterFailureThreshold is the threshold of exporter failure numbers during the Interval + ExporterFailureThreshold int `mapstructure:"exporter_failure_threshold"` +} diff --git a/cmd/jaeger/internal/extension/healthcheckextension/factory.go b/cmd/jaeger/internal/extension/healthcheckextension/factory.go new file mode 100644 index 00000000000..0d0f9485eda --- /dev/null +++ b/cmd/jaeger/internal/extension/healthcheckextension/factory.go @@ -0,0 +1,53 @@ +package healthcheckextension + +import ( + "context" + + "github.com/jaegertracing/jaeger/ports" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/extension" +) + +const defaultPort = 13133 + +// ComponentType is the name of this extension in configuration +var ( + ComponentType = component.MustNewType("healthcheck") + ID = component.NewID(ComponentType) +) + +// New Factory creates a factory for health check extension +func NewFactory() extension.Factory { + return extension.NewFactory( + ComponentType, + createDefaultConfig, + createExtension, + component.StabilityLevelBeta, + ) +} + +func createDefaultConfig() component.Config { + return &Config{ + ServerConfig: confighttp.ServerConfig{ + Endpoint: ports.PortToHostPort(defaultPort), + }, + CheckCollectorPipeline: defaultCheckCollectorPipelineSettings(), + Path: "/", + } +} + +// defaultCheckCollectorPipelineSettings returns the default settings for CheckCollectorPipeline. +func defaultCheckCollectorPipelineSettings() checkCollectorPipelineSettings { + return checkCollectorPipelineSettings{ + Enabled: false, + Interval: "5m", + ExporterFailureThreshold: 5, + } +} + +// createExtension creates the extension based on this config. +func createExtension(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { + config := cfg.(*Config) + return newServer(*config, set.TelemetrySettings), nil +} diff --git a/cmd/jaeger/internal/extension/healthcheckextension/server.go b/cmd/jaeger/internal/extension/healthcheckextension/server.go new file mode 100644 index 00000000000..04a8990005e --- /dev/null +++ b/cmd/jaeger/internal/extension/healthcheckextension/server.go @@ -0,0 +1,28 @@ +package healthcheckextension + +import ( + "github.com/jaegertracing/jaeger/pkg/healthcheck" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" + "go.uber.org/zap" +) + +type healthCheckExtension struct { + config Config + logger *zap.Logger + state *healthcheck.HealthCheck + settings component.TelemetrySettings +} + +func newServer(cfg Config, set component.TelemetrySettings) extension.Extension { + hc := &healthCheckExtension{ + config: cfg, + logger: set.Logger, + state: healthcheck.New(), + settings: set, + } + + hc.state.SetLogger(set.Logger) + + return hc +} From e2339af15bd62985c13061be20b802aab7f7c0d5 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Wed, 14 Aug 2024 13:41:29 +0530 Subject: [PATCH 02/14] Added functional healthcheck extension Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/all-in-one.yaml | 20 +++++- cmd/jaeger/internal/components.go | 3 +- .../extension/healthcheckextension/config.go | 71 ------------------- .../extension/healthcheckextension/factory.go | 53 -------------- .../extension/healthcheckextension/server.go | 28 -------- go.mod | 1 + go.sum | 2 + 7 files changed, 24 insertions(+), 154 deletions(-) delete mode 100644 cmd/jaeger/internal/extension/healthcheckextension/config.go delete mode 100644 cmd/jaeger/internal/extension/healthcheckextension/factory.go delete mode 100644 cmd/jaeger/internal/extension/healthcheckextension/server.go diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index 43540cf66f0..475d3b43a95 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -1,5 +1,5 @@ service: - extensions: [jaeger_storage, jaeger_query, remote_sampling] + extensions: [jaeger_storage, jaeger_query, remote_sampling, healthcheckv2] pipelines: traces: receivers: [otlp, jaeger, zipkin] @@ -33,6 +33,24 @@ extensions: # initial_sampling_probability: 0.1 http: grpc: + + healthcheckv2: + use_v2: true + component_health: + include_permanent_errors: false + include_recoverable_errors: true + recovery_duration: 5m + http: + endpoint: "localhost:13133" + status: + enabled: true + path: "/health/status" + config: + enabled: true + path: "/health/config" + grpc: + endpoint: "localhost:13132" + transport: "tcp" receivers: otlp: diff --git a/cmd/jaeger/internal/components.go b/cmd/jaeger/internal/components.go index 7a615785b4d..e21a32a11d3 100644 --- a/cmd/jaeger/internal/components.go +++ b/cmd/jaeger/internal/components.go @@ -7,6 +7,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver" @@ -26,7 +27,6 @@ import ( "go.opentelemetry.io/collector/processor/memorylimiterprocessor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/otlpreceiver" - "github.com/jaegertracing/jaeger/cmd/jaeger/internal/exporters/storageexporter" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerquery" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage" @@ -61,6 +61,7 @@ func (b builders) build() (otelcol.Factories, error) { // standard ballastextension.NewFactory(), zpagesextension.NewFactory(), + healthcheckv2extension.NewFactory(), // add-ons jaegerquery.NewFactory(), jaegerstorage.NewFactory(), diff --git a/cmd/jaeger/internal/extension/healthcheckextension/config.go b/cmd/jaeger/internal/extension/healthcheckextension/config.go deleted file mode 100644 index e059698e0da..00000000000 --- a/cmd/jaeger/internal/extension/healthcheckextension/config.go +++ /dev/null @@ -1,71 +0,0 @@ -package healthcheckextension - -import ( - "errors" - "strings" - "time" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/confighttp" -) - -type ResponseBodySettings struct { - // Healthy represents the body of the response returned when the collector is healthy. - // The default value is "" - Healthy string `mapstructure:"healthy"` - - // Unhealthy represents the body of the response returned when the collector is unhealthy. - // The default value is "" - Unhealthy string `mapstructure:"unhealthy"` -} - -// Config has the configuration for the extension enabling the health check -// extension, used to report the health status of the service. -type Config struct { - confighttp.ServerConfig `mapstructure:",squash"` - - // Path represents the path the health check service will serve. - // The default path is "/". - Path string `mapstructure:"path"` - - // ResponseBody represents the body of the response returned by the health check service. - // This overrides the default response that it would return. - ResponseBody *ResponseBodySettings `mapstructure:"response_body"` - - // CheckCollectorPipeline contains the list of settings of collector pipeline health check - CheckCollectorPipeline checkCollectorPipelineSettings `mapstructure:"check_collector_pipeline"` -} - -var _ component.Config = (*Config)(nil) -var ( - errNoEndpointProvided = errors.New("bad config: endpoint must be specified") - errInvalidExporterFailureThresholdProvided = errors.New("bad config: exporter_failure_threshold expects a positive number") - errInvalidPath = errors.New("bad config: path must start with /") -) - -// Validate checks if the extension configuration is valid -func (cfg *Config) Validate() error { - _, err := time.ParseDuration(cfg.CheckCollectorPipeline.Interval) - if err != nil { - return err - } - if cfg.Endpoint == "" { - return errNoEndpointProvided - } - if cfg.CheckCollectorPipeline.ExporterFailureThreshold <= 0 { - return errInvalidExporterFailureThresholdProvided - } - if !strings.HasPrefix(cfg.Path, "/") { - return errInvalidPath - } - return nil -} - -type checkCollectorPipelineSettings struct { - // Enabled indicates whether to not enable collector pipeline check. - Enabled bool `mapstructure:"enabled"` - // Interval the time range to check healthy status of collector pipeline - Interval string `mapstructure:"interval"` - // ExporterFailureThreshold is the threshold of exporter failure numbers during the Interval - ExporterFailureThreshold int `mapstructure:"exporter_failure_threshold"` -} diff --git a/cmd/jaeger/internal/extension/healthcheckextension/factory.go b/cmd/jaeger/internal/extension/healthcheckextension/factory.go deleted file mode 100644 index 0d0f9485eda..00000000000 --- a/cmd/jaeger/internal/extension/healthcheckextension/factory.go +++ /dev/null @@ -1,53 +0,0 @@ -package healthcheckextension - -import ( - "context" - - "github.com/jaegertracing/jaeger/ports" - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/confighttp" - "go.opentelemetry.io/collector/extension" -) - -const defaultPort = 13133 - -// ComponentType is the name of this extension in configuration -var ( - ComponentType = component.MustNewType("healthcheck") - ID = component.NewID(ComponentType) -) - -// New Factory creates a factory for health check extension -func NewFactory() extension.Factory { - return extension.NewFactory( - ComponentType, - createDefaultConfig, - createExtension, - component.StabilityLevelBeta, - ) -} - -func createDefaultConfig() component.Config { - return &Config{ - ServerConfig: confighttp.ServerConfig{ - Endpoint: ports.PortToHostPort(defaultPort), - }, - CheckCollectorPipeline: defaultCheckCollectorPipelineSettings(), - Path: "/", - } -} - -// defaultCheckCollectorPipelineSettings returns the default settings for CheckCollectorPipeline. -func defaultCheckCollectorPipelineSettings() checkCollectorPipelineSettings { - return checkCollectorPipelineSettings{ - Enabled: false, - Interval: "5m", - ExporterFailureThreshold: 5, - } -} - -// createExtension creates the extension based on this config. -func createExtension(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { - config := cfg.(*Config) - return newServer(*config, set.TelemetrySettings), nil -} diff --git a/cmd/jaeger/internal/extension/healthcheckextension/server.go b/cmd/jaeger/internal/extension/healthcheckextension/server.go deleted file mode 100644 index 04a8990005e..00000000000 --- a/cmd/jaeger/internal/extension/healthcheckextension/server.go +++ /dev/null @@ -1,28 +0,0 @@ -package healthcheckextension - -import ( - "github.com/jaegertracing/jaeger/pkg/healthcheck" - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/extension" - "go.uber.org/zap" -) - -type healthCheckExtension struct { - config Config - logger *zap.Logger - state *healthcheck.HealthCheck - settings component.TelemetrySettings -} - -func newServer(cfg Config, set component.TelemetrySettings) extension.Extension { - hc := &healthCheckExtension{ - config: cfg, - logger: set.Logger, - state: healthcheck.New(), - settings: set, - } - - hc.state.SetLogger(set.Logger) - - return hc -} diff --git a/go.mod b/go.mod index c0c0993e481..1898553343c 100644 --- a/go.mod +++ b/go.mod @@ -168,6 +168,7 @@ require ( github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/onsi/ginkgo v1.16.5 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension v0.107.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.107.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.107.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.107.0 // indirect diff --git a/go.sum b/go.sum index 3e4bd4bfc89..a2cd1f4b8fa 100644 --- a/go.sum +++ b/go.sum @@ -386,6 +386,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.107.0/go.mod h1:gMY05z3fY6HnL/vNfyVYl3w4eihI8DftosfHuxqEeTg= github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.107.0 h1:g4LloH7qCMZfahxep5dKU9U18RnHGYsDw+/BQkzg9ts= github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.107.0/go.mod h1:+oXUZlAMk5MepQpL7OJiLEUyugPFlmCs8kL/ciaERAs= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension v0.107.0 h1:qAJyEY8c0OwAaX/avNOI1Ovoh2oRu744WXdlm6oefBc= +github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension v0.107.0/go.mod h1:6LO3bm94bdTS6W7d2vuYboDNtPzspTJBDZRema1gBb4= github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.107.0 h1:ng+d8RpXN+cUUJTn1yA2xmXCEah0o7BsGzwsm3fDSsw= github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.107.0/go.mod h1:pc5uB5lbPTNddFYA0bYy0TYkp4Yjh4teYXBPsRL2/Rk= github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.107.0 h1:NKH1JyZbqUSDGbIVqTyGJclmdnp6v4TQYfLhNI4tZno= From 98e4bd48a1aac58f5944f5c9dc2a3ebda62e17f5 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Wed, 14 Aug 2024 13:45:53 +0530 Subject: [PATCH 03/14] Ran make fmt Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/components.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/jaeger/internal/components.go b/cmd/jaeger/internal/components.go index e21a32a11d3..5f5bcd03150 100644 --- a/cmd/jaeger/internal/components.go +++ b/cmd/jaeger/internal/components.go @@ -27,6 +27,7 @@ import ( "go.opentelemetry.io/collector/processor/memorylimiterprocessor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/otlpreceiver" + "github.com/jaegertracing/jaeger/cmd/jaeger/internal/exporters/storageexporter" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerquery" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage" From 5a1e45499741650c0ca7d01df2ec97ea0f1cc127 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Fri, 16 Aug 2024 14:05:37 +0530 Subject: [PATCH 04/14] Added CI Test Signed-off-by: Wise-Wizard --- cmd/all-in-one/all_in_one_test.go | 32 +++++++++++++++++++++++------ cmd/jaeger/internal/all-in-one.yaml | 13 ------------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index 9d3cc7a1057..a5d64eef90d 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -38,16 +38,19 @@ import ( // An optional SKIP_SAMPLING=true environment variable can be used to skip sampling checks (for jaeger-v2). const ( - host = "0.0.0.0" - queryPort = "16686" - agentPort = "5778" - queryAddr = "http://" + host + ":" + queryPort - agentAddr = "http://" + host + ":" + agentPort + host = "0.0.0.0" + queryPort = "16686" + agentPort = "5778" + healthPort = "13133" + queryAddr = "http://" + host + ":" + queryPort + agentAddr = "http://" + host + ":" + agentPort + healthAddr = "http://" + host + ":" + healthPort getServicesURL = "/api/services" getTraceURL = "/api/traces/" getServicesAPIV3URL = "/api/v3/services" getSamplingStrategyURL = "/sampling?service=whatever" + getHealthURL = "/status/" ) var traceID string // stores state exchanged between createTrace and getAPITrace @@ -63,7 +66,7 @@ func TestAllInOne(t *testing.T) { // Check if the query service is available healthCheck(t) - + healthCheckV2(t) t.Run("checkWebUI", checkWebUI) t.Run("createTrace", createTrace) t.Run("getAPITrace", getAPITrace) @@ -88,6 +91,23 @@ func healthCheck(t *testing.T) { t.Logf("Server detected at %s", queryAddr) } +func healthCheckV2(t *testing.T) { + require.Eventuallyf( + t, + func() bool { + resp, err := http.Get(healthAddr + getHealthURL) + if err == nil { + resp.Body.Close() + } + return err == nil + }, + 10*time.Second, + time.Second, + "expecting health endpoint to be healhty", + ) + t.Logf("V2-HealthCheck Server detected at %s", healthAddr) +} + func httpGet(t *testing.T, url string) (*http.Response, []byte) { t.Logf("Executing HTTP GET %s", url) req, err := http.NewRequest(http.MethodGet, url, nil) diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index 475d3b43a95..22af1c37881 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -36,21 +36,8 @@ extensions: healthcheckv2: use_v2: true - component_health: - include_permanent_errors: false - include_recoverable_errors: true - recovery_duration: 5m http: - endpoint: "localhost:13133" - status: - enabled: true - path: "/health/status" - config: - enabled: true - path: "/health/config" grpc: - endpoint: "localhost:13132" - transport: "tcp" receivers: otlp: From 5df9a65f4bd204e1c4873e7d508c781e904da7d9 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 01:43:54 +0530 Subject: [PATCH 05/14] Added skip flag Signed-off-by: Wise-Wizard --- .github/workflows/ci-docker-all-in-one.yml | 2 ++ cmd/all-in-one/all_in_one_test.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-docker-all-in-one.yml b/.github/workflows/ci-docker-all-in-one.yml index 95bb409f2f7..65c8e8b458d 100644 --- a/.github/workflows/ci-docker-all-in-one.yml +++ b/.github/workflows/ci-docker-all-in-one.yml @@ -23,8 +23,10 @@ jobs: mode: - name: v1 binary: all-in-one + skip_healthcheck: true - name: v2 binary: jaeger + skip_healthcheck: false steps: - name: Harden Runner diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index 1684f0dab5c..f6d56121f68 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -24,7 +24,6 @@ import ( ) // These tests are only run when the environment variable TEST_MODE=integration is set. -// An optional SKIP_SAMPLING=true environment variable can be used to skip sampling checks (for jaeger-v2). const ( host = "0.0.0.0" @@ -81,6 +80,9 @@ func healthCheck(t *testing.T) { } func healthCheckV2(t *testing.T) { + if os.Getenv("SKIP_HEALTHCHECK") == "true" { + t.Skip("Skipping health check for V1 Binary") + } require.Eventuallyf( t, func() bool { From f2cf47a5efe839eadd271a3716239170c7ae2e6f Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 01:55:19 +0530 Subject: [PATCH 06/14] Added env Signed-off-by: Wise-Wizard --- .github/workflows/ci-docker-all-in-one.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-docker-all-in-one.yml b/.github/workflows/ci-docker-all-in-one.yml index 65c8e8b458d..97dea6bd75a 100644 --- a/.github/workflows/ci-docker-all-in-one.yml +++ b/.github/workflows/ci-docker-all-in-one.yml @@ -76,3 +76,4 @@ jobs: env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} + SKIP_HEALTHCHECK: ${{ matrix.mode.skip_healthcheck }} From 431cafd34ad8fd3b626b0f823f3c6975e9fd9e97 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 02:04:10 +0530 Subject: [PATCH 07/14] Fix health URL Signed-off-by: Wise-Wizard --- cmd/all-in-one/all_in_one_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index f6d56121f68..9d47383c131 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -38,7 +38,7 @@ const ( getTraceURL = "/api/traces/" getServicesAPIV3URL = "/api/v3/services" getSamplingStrategyURL = "/sampling?service=whatever" - getHealthURL = "/status/" + getHealthURL = "/status" ) var traceID string // stores state exchanged between createTrace and getAPITrace From 74ca0b644cbd66e32316ce041b452850630411d7 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 02:35:45 +0530 Subject: [PATCH 08/14] Added env in run config Signed-off-by: Wise-Wizard --- .github/workflows/ci-docker-all-in-one.yml | 15 +++++++++++---- cmd/all-in-one/all_in_one_test.go | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-docker-all-in-one.yml b/.github/workflows/ci-docker-all-in-one.yml index 97dea6bd75a..4d9f94b5276 100644 --- a/.github/workflows/ci-docker-all-in-one.yml +++ b/.github/workflows/ci-docker-all-in-one.yml @@ -23,10 +23,8 @@ jobs: mode: - name: v1 binary: all-in-one - skip_healthcheck: true - name: v2 binary: jaeger - skip_healthcheck: false steps: - name: Harden Runner @@ -68,12 +66,21 @@ jobs: ;; esac + - name: Determine healthcheck setting + id: healthcheck + run: | + if [[ "${{ matrix.mode.name }}" == "v1" ]]; then + echo "HEALTHCHECK_V2=false" >> $GITHUB_ENV + elif [[ "${{ matrix.mode.name }}" == "v2" ]]; then + echo "HEALTHCHECK_V2=true" >> $GITHUB_ENV + fi + - name: Build, test, and publish all-in-one image run: | bash scripts/build-all-in-one-image.sh \ ${{ env.BUILD_FLAGS }} \ - -b ${{ matrix.mode.binary }} + -b ${{ matrix.mode.binary }} \ env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} - SKIP_HEALTHCHECK: ${{ matrix.mode.skip_healthcheck }} + HEALTHCHECK_V2: ${{ env.HEALTHCHECK_V2 }} diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index 9d47383c131..3dee235c0f1 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -74,13 +74,13 @@ func healthCheck(t *testing.T) { }, 10*time.Second, time.Second, - "expecting query endpoint to be healhty", + "expecting query endpoint to be healthy", ) t.Logf("Server detected at %s", queryAddr) } func healthCheckV2(t *testing.T) { - if os.Getenv("SKIP_HEALTHCHECK") == "true" { + if os.Getenv("HEALTHCHECK_V2") == "false" { t.Skip("Skipping health check for V1 Binary") } require.Eventuallyf( @@ -94,7 +94,7 @@ func healthCheckV2(t *testing.T) { }, 10*time.Second, time.Second, - "expecting health endpoint to be healhty", + "expecting health endpoint to be healthy", ) t.Logf("V2-HealthCheck Server detected at %s", healthAddr) } From 689ca7e63887694cce7a3aa94d92fef7228b913d Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 10:21:52 +0530 Subject: [PATCH 09/14] Exposed docker port Signed-off-by: Wise-Wizard --- cmd/jaeger/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/jaeger/Dockerfile b/cmd/jaeger/Dockerfile index 1028c8c58b8..ffb6cac112d 100644 --- a/cmd/jaeger/Dockerfile +++ b/cmd/jaeger/Dockerfile @@ -43,6 +43,9 @@ EXPOSE 9411 # Web HTTP EXPOSE 16686 +# Health Check HTTP +EXPOSE 13133 + COPY jaeger-linux-$TARGETARCH /cmd/jaeger/jaeger-linux COPY sampling-strategies.json /cmd/jaeger/sampling-strategies.json @@ -92,6 +95,9 @@ EXPOSE 16686 # Delve EXPOSE 12345 +# Health Check HTTP +EXPOSE 13133 + COPY jaeger-debug-linux-$TARGETARCH /cmd/jaeger/jaeger-linux COPY sampling-strategies.json /cmd/jaeger/sampling-strategies.json From d7669d14bf77c1f1a6dce22257c6b84f278cf37f Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 10:33:19 +0530 Subject: [PATCH 10/14] Endpoint configured Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/all-in-one.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index 22af1c37881..4dad6d883ef 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -37,6 +37,7 @@ extensions: healthcheckv2: use_v2: true http: + endpoint: "0.0.0.0:13133" grpc: receivers: From 1b82b7973c3ed8e2f1557b0a23ee34e23fca9d2a Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Sat, 17 Aug 2024 11:18:08 +0530 Subject: [PATCH 11/14] Debug Logs Signed-off-by: Wise-Wizard --- cmd/all-in-one/all_in_one_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index 3dee235c0f1..bbdcd6b6a3a 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -87,6 +87,7 @@ func healthCheckV2(t *testing.T) { t, func() bool { resp, err := http.Get(healthAddr + getHealthURL) + t.Log("gdkjfdsgfdggdfdgfgfgfddgfgfdfdgg", err) if err == nil { resp.Body.Close() } From f863d0aed51d94a9d347f00d6e15151105699b3c Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 17 Aug 2024 18:43:44 -0400 Subject: [PATCH 12/14] add port mapping Signed-off-by: Yuri Shkuro --- scripts/build-all-in-one-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-all-in-one-image.sh b/scripts/build-all-in-one-image.sh index b73e24dbe51..d167e40e508 100755 --- a/scripts/build-all-in-one-image.sh +++ b/scripts/build-all-in-one-image.sh @@ -65,7 +65,7 @@ make build-ui run_integration_test() { local image_name="$1" - CID=$(docker run -d -p 16686:16686 -p 5778:5778 "${image_name}:${GITHUB_SHA}") + CID=$(docker run -d -p 16686:16686 -p 5778:5778 -p13133:13133 "${image_name}:${GITHUB_SHA}") if ! make all-in-one-integration-test ; then echo "---- integration test failed unexpectedly ----" From aaa5e30a47530d55f23fa9521afc61ef3476ea83 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 17 Aug 2024 18:44:06 -0400 Subject: [PATCH 13/14] fix Signed-off-by: Yuri Shkuro --- .github/workflows/ci-docker-all-in-one.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-docker-all-in-one.yml b/.github/workflows/ci-docker-all-in-one.yml index 4d9f94b5276..57fd058c661 100644 --- a/.github/workflows/ci-docker-all-in-one.yml +++ b/.github/workflows/ci-docker-all-in-one.yml @@ -79,7 +79,7 @@ jobs: run: | bash scripts/build-all-in-one-image.sh \ ${{ env.BUILD_FLAGS }} \ - -b ${{ matrix.mode.binary }} \ + -b ${{ matrix.mode.binary }} env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} From 00bff85de5f956bc213d2a115ca6dd37d3b98d25 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 17 Aug 2024 19:24:49 -0400 Subject: [PATCH 14/14] clean-up Signed-off-by: Yuri Shkuro --- cmd/all-in-one/all_in_one_test.go | 15 ++++++--------- cmd/jaeger/Dockerfile | 6 ++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cmd/all-in-one/all_in_one_test.go b/cmd/all-in-one/all_in_one_test.go index bbdcd6b6a3a..7e080e2129a 100644 --- a/cmd/all-in-one/all_in_one_test.go +++ b/cmd/all-in-one/all_in_one_test.go @@ -32,13 +32,12 @@ const ( healthPort = "13133" queryAddr = "http://" + host + ":" + queryPort agentAddr = "http://" + host + ":" + agentPort - healthAddr = "http://" + host + ":" + healthPort + healthAddr = "http://" + host + ":" + healthPort + "/status" getServicesURL = "/api/services" getTraceURL = "/api/traces/" getServicesAPIV3URL = "/api/v3/services" getSamplingStrategyURL = "/sampling?service=whatever" - getHealthURL = "/status" ) var traceID string // stores state exchanged between createTrace and getAPITrace @@ -54,7 +53,8 @@ func TestAllInOne(t *testing.T) { // Check if the query service is available healthCheck(t) - healthCheckV2(t) + + t.Run("healthCheckV2", healthCheckV2) t.Run("checkWebUI", checkWebUI) t.Run("createTrace", createTrace) t.Run("getAPITrace", getAPITrace) @@ -63,8 +63,7 @@ func TestAllInOne(t *testing.T) { } func healthCheck(t *testing.T) { - require.Eventuallyf( - t, + require.Eventuallyf(t, func() bool { resp, err := http.Get(queryAddr + "/") if err == nil { @@ -83,11 +82,9 @@ func healthCheckV2(t *testing.T) { if os.Getenv("HEALTHCHECK_V2") == "false" { t.Skip("Skipping health check for V1 Binary") } - require.Eventuallyf( - t, + require.Eventuallyf(t, func() bool { - resp, err := http.Get(healthAddr + getHealthURL) - t.Log("gdkjfdsgfdggdfdgfgfgfddgfgfdfdgg", err) + resp, err := http.Get(healthAddr) if err == nil { resp.Body.Close() } diff --git a/cmd/jaeger/Dockerfile b/cmd/jaeger/Dockerfile index ffb6cac112d..5ff10914439 100644 --- a/cmd/jaeger/Dockerfile +++ b/cmd/jaeger/Dockerfile @@ -43,6 +43,9 @@ EXPOSE 9411 # Web HTTP EXPOSE 16686 +# Health Check gRPC +EXPOSE 13132 + # Health Check HTTP EXPOSE 13133 @@ -95,6 +98,9 @@ EXPOSE 16686 # Delve EXPOSE 12345 +# Health Check gRPC +EXPOSE 13132 + # Health Check HTTP EXPOSE 13133