Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro committed Jul 20, 2024
1 parent 50e312c commit f105bc9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
17 changes: 7 additions & 10 deletions docker-compose/monitor/docker-compose-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ version: "3.5"
services:
jaeger:
networks:
- backend
backend:
# This is the host name used in Prometheus scrape configuration.
aliases: [spm_metrics_source]
image: jaegertracing/jaeger:${JAEGER_IMAGE_TAG:-latest}
volumes:
- "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" # Do we need this for v2 ? Seems to be running without this.
- "./jaeger-v2-config.yml:/etc/jaeger/config.yml"
command: ["--config", "/etc/jaeger/config.yml"]
# TODO: Need to pass this through config
# environment:
# - METRICS_STORAGE_TYPE=prometheus
# - PROMETHEUS_SERVER_URL=http://prometheus:9090
# # - PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR=${PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR:-true}
# - PROMETHEUS_QUERY_NAMESPACE=${PROMETHEUS_QUERY_NAMESPACE:-}
# - PROMETHEUS_QUERY_DURATION_UNIT=${PROMETHEUS_QUERY_DURATION_UNIT:-}
# - PROMETHEUS_QUERY_NORMALIZE_CALLS=true
# - PROMETHEUS_QUERY_NORMALIZE_DURATION=true
ports:
- "16686:16686"
- "8889:8889"

microsim:
networks:
- backend
Expand All @@ -28,6 +23,7 @@ services:
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger:4318/v1/traces
depends_on:
- jaeger

prometheus:
networks:
- backend
Expand All @@ -36,6 +32,7 @@ services:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"

grafana:
networks:
- backend
Expand Down
4 changes: 3 additions & 1 deletion docker-compose/monitor/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ services:

otel_collector:
networks:
- backend
backend:
# This is the host name used in Prometheus scrape configuration.
aliases: [spm_metrics_source]
image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.89.0}
volumes:
- ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml
Expand Down
6 changes: 5 additions & 1 deletion docker-compose/monitor/jaeger-v2-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ service:
metrics/spanmetrics:
receivers: [spanmetrics]
exporters: [prometheus]

telemetry:
logs:
level: DEBUG

extensions:
jaeger_query:
Expand All @@ -23,6 +25,8 @@ extensions:
some_metrics_storage:
prometheus:
endpoint: http://prometheus:9090
normalize_calls: true
normalize_duration: true

connectors:
spanmetrics:
Expand Down
21 changes: 11 additions & 10 deletions pkg/prometheus/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ import (

// Configuration describes the options to customize the storage behavior.
type Configuration struct {
ServerURL string `mapstructure:"endpoint"`
ConnectTimeout time.Duration
TLS tlscfg.Options
TokenFilePath string
TokenOverrideFromContext bool

MetricNamespace string
LatencyUnit string
NormalizeCalls bool
NormalizeDuration bool
ServerURL string `valid:"required" mapstructure:"endpoint"`
ConnectTimeout time.Duration `mapstructure:"connect_timeout"`
TLS tlscfg.Options

TokenFilePath string `mapstructure:"token_file_path"`
TokenOverrideFromContext bool `mapstructure:"token_override_from_context"`

MetricNamespace string `mapstructure:"metric_namespace"`
LatencyUnit string `mapstructure:"latency_unit"`
NormalizeCalls bool `mapstructure:"normalize_calls"`
NormalizeDuration bool `mapstructure:"normalize_duration"`
}

func (c *Configuration) Validate() error {
Expand Down
8 changes: 5 additions & 3 deletions scripts/spm-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ while getopts "b:h" opt; do
esac
done

set -x

if [ "$BINARY" == "jaeger" ]; then
compose_file=docker-compose/monitor/docker-compose-v2.yml
fi
Expand All @@ -36,7 +38,7 @@ check_service_health() {
local url=$2
echo "Checking health of service: $service_name at $url"

local wait_seconds=10
local wait_seconds=3
local curl_params=(
--silent
--output
Expand All @@ -63,7 +65,7 @@ wait_for_services() {
check_service_health "Jaeger" "http://localhost:16686"
check_service_health "Prometheus" "http://localhost:9090/graph"
# Grafana is not actually important for the functional test,
# but it at least validates that the docker-compose file is correct.
# but we still validate that the docker-compose file is correct.
check_service_health "Grafana" "http://localhost:3000"
}

Expand Down Expand Up @@ -150,7 +152,7 @@ main() {
(cd docker-compose/monitor && make build BINARY="$BINARY" && make dev-v2 DOCKER_COMPOSE_ARGS="-d")
else
(cd docker-compose/monitor && make build BINARY="$BINARY" && make dev DOCKER_COMPOSE_ARGS="-d")
fi
fi
wait_for_services
check_spm
success="true"
Expand Down

0 comments on commit f105bc9

Please sign in to comment.