From f105bc9169611e3df02d26747d1f27ac05850879 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 20 Jul 2024 19:14:45 -0400 Subject: [PATCH] fix Signed-off-by: Yuri Shkuro --- docker-compose/monitor/docker-compose-v2.yml | 17 +++++++--------- docker-compose/monitor/docker-compose.yml | 4 +++- docker-compose/monitor/jaeger-v2-config.yml | 6 +++++- pkg/prometheus/config/config.go | 21 ++++++++++---------- scripts/spm-integration-test.sh | 8 +++++--- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/docker-compose/monitor/docker-compose-v2.yml b/docker-compose/monitor/docker-compose-v2.yml index 0707d75f554..5bddd2cc658 100644 --- a/docker-compose/monitor/docker-compose-v2.yml +++ b/docker-compose/monitor/docker-compose-v2.yml @@ -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 @@ -28,6 +23,7 @@ services: - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger:4318/v1/traces depends_on: - jaeger + prometheus: networks: - backend @@ -36,6 +32,7 @@ services: - "./prometheus.yml:/etc/prometheus/prometheus.yml" ports: - "9090:9090" + grafana: networks: - backend diff --git a/docker-compose/monitor/docker-compose.yml b/docker-compose/monitor/docker-compose.yml index 0f79258024a..3f288201eb9 100644 --- a/docker-compose/monitor/docker-compose.yml +++ b/docker-compose/monitor/docker-compose.yml @@ -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 diff --git a/docker-compose/monitor/jaeger-v2-config.yml b/docker-compose/monitor/jaeger-v2-config.yml index 8e74447fb06..bc7160c5bb8 100644 --- a/docker-compose/monitor/jaeger-v2-config.yml +++ b/docker-compose/monitor/jaeger-v2-config.yml @@ -8,7 +8,9 @@ service: metrics/spanmetrics: receivers: [spanmetrics] exporters: [prometheus] - + telemetry: + logs: + level: DEBUG extensions: jaeger_query: @@ -23,6 +25,8 @@ extensions: some_metrics_storage: prometheus: endpoint: http://prometheus:9090 + normalize_calls: true + normalize_duration: true connectors: spanmetrics: diff --git a/pkg/prometheus/config/config.go b/pkg/prometheus/config/config.go index adcaaeb0f9d..54ee6ea9398 100644 --- a/pkg/prometheus/config/config.go +++ b/pkg/prometheus/config/config.go @@ -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 { diff --git a/scripts/spm-integration-test.sh b/scripts/spm-integration-test.sh index 45c7e273904..86c4d870a5a 100755 --- a/scripts/spm-integration-test.sh +++ b/scripts/spm-integration-test.sh @@ -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 @@ -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 @@ -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" } @@ -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"