Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Configure healthcheck extension #5831

Merged
merged 21 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/ci-docker-all-in-one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +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 }} \
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
HEALTHCHECK_V2: ${{ env.HEALTHCHECK_V2 }}
39 changes: 31 additions & 8 deletions cmd/all-in-one/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ 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"
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -52,7 +54,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)
Expand All @@ -72,11 +74,32 @@ 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("HEALTHCHECK_V2") == "false" {
t.Skip("Skipping health check for V1 Binary")
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
}
require.Eventuallyf(
t,
func() bool {
resp, err := http.Get(healthAddr + getHealthURL)
t.Log("gdkjfdsgfdggdfdgfgfgfddgfgfdfdgg", err)
if err == nil {
resp.Body.Close()
}
return err == nil
},
10*time.Second,
time.Second,
"expecting health endpoint to be healthy",
)
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)
Expand Down
6 changes: 6 additions & 0 deletions cmd/jaeger/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down
8 changes: 7 additions & 1 deletion cmd/jaeger/internal/all-in-one.yaml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -33,6 +33,12 @@ extensions:
# initial_sampling_probability: 0.1
http:
grpc:

healthcheckv2:
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
use_v2: true
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
http:
endpoint: "0.0.0.0:13133"
grpc:

receivers:
otlp:
Expand Down
2 changes: 2 additions & 0 deletions cmd/jaeger/internal/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -61,6 +62,7 @@ func (b builders) build() (otelcol.Factories, error) {
// standard
ballastextension.NewFactory(),
zpagesextension.NewFactory(),
healthcheckv2extension.NewFactory(),
// add-ons
jaegerquery.NewFactory(),
jaegerstorage.NewFactory(),
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Loading