Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN yum install -y unzip dos2unix jq
# installs for the final image
# see https://github.com/thomasdarimont/keycloak/blob/main/docs/guides/server/containers.adoc#installing-additional-rpm-packages
RUN mkdir -p /mnt/rootfs
RUN dnf install --installroot /mnt/rootfs curl-minimal jq procps --releasever 9 --setopt install_weak_deps=false --nodocs -y && \
RUN dnf install --installroot /mnt/rootfs curl-minimal --releasever 9 --setopt install_weak_deps=false --nodocs -y && \
dnf --installroot /mnt/rootfs clean all && \
rpm --root /mnt/rootfs -e --nodeps setup

Expand Down
6 changes: 6 additions & 0 deletions docker/otelcol-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ receivers:
static_configs:
- targets: ["localhost:8888"]

extensions:
health_check:
endpoint: 0.0.0.0:13133
path: "/ready"

processors:
batch:

Expand Down Expand Up @@ -41,6 +46,7 @@ exporters:
verbosity: detailed

service:
extensions: [health_check]
pipelines:
traces:
receivers: [otlp]
Expand Down
30 changes: 1 addition & 29 deletions docker/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ services["loki"]="http://localhost:3100/ready"
services["prometheus"]="http://localhost:9090/api/v1/status/runtimeinfo"
services["tempo"]="http://localhost:3200/ready"
services["pyroscope"]="http://localhost:4040/ready"
services["otelcol"]="http://localhost:13133/ready"

# Initialize service_ready status to false for all services
for service in "${!services[@]}"; do
service_ready[$service]=false
done

# Also check OpenTelemetry collector separately (since it uses a different check method)
service_ready["otelcol"]=false

# Function to check if a service is ready
check_service_ready() {
local service=$1
Expand Down Expand Up @@ -80,29 +78,6 @@ check_service_ready() {
return 1
}

# Function to check if OpenTelemetry collector is ready
check_otelcol_ready() {
# Skip if already marked as ready
if [[ ${service_ready["otelcol"]} == true ]]; then
return 0
fi

# Check if collector is ready via Prometheus metric
if curl -sg 'http://localhost:9090/api/v1/query?query=otelcol_process_uptime_total{}' 2>/dev/null | jq -r .data.result[0].value[1] 2>/dev/null | grep '[0-9]' >/dev/null; then
# Calculate and display startup time
end_time=$(date +%s)
# shellcheck disable=SC2154
otelcol_start_time=${start_time_otelcol}
elapsed=$((end_time - otelcol_start_time))
elapsed_times["otelcol"]=$elapsed
service_ready["otelcol"]=true
echo "OpenTelemetry collector is up and running. Startup time: ${elapsed} seconds"
return 0
fi

return 1
}

# Wait for all services to be ready
all_ready=false
while [[ $all_ready == false ]]; do
Expand All @@ -111,9 +86,6 @@ while [[ $all_ready == false ]]; do
check_service_ready "$service" "${services[$service]}"
done

# Check OpenTelemetry collector
check_otelcol_ready

# Check if all services are ready
all_ready=true
for service in "${!service_ready[@]}"; do
Expand Down