Skip to content

Commit

Permalink
Merge branch 'main' into otlp-receivers-to-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Jan 13, 2025
2 parents ebe7cb3 + fcc8936 commit e4eb44e
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 116 deletions.
4 changes: 2 additions & 2 deletions cmd/collector/app/server/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"google.golang.org/grpc/reflection"

"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
samplinggrpc "github.com/jaegertracing/jaeger/internal/sampling/grpc"
"github.com/jaegertracing/jaeger/pkg/telemetry"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)
Expand Down Expand Up @@ -65,7 +65,7 @@ func serveGRPC(server *grpc.Server, listener net.Listener, params *GRPCServerPar
healthServer := health.NewServer()

api_v2.RegisterCollectorServiceServer(server, params.Handler)
api_v2.RegisterSamplingManagerServer(server, sampling.NewGRPCHandler(params.SamplingProvider))
api_v2.RegisterSamplingManagerServer(server, samplinggrpc.NewHandler(params.SamplingProvider))

healthServer.SetServingStatus("jaeger.api_v2.CollectorService", grpc_health_v1.HealthCheckResponse_SERVING)
healthServer.SetServingStatus("jaeger.api_v2.SamplingManager", grpc_health_v1.HealthCheckResponse_SERVING)
Expand Down
8 changes: 4 additions & 4 deletions cmd/jaeger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ flowchart LR

## Try it out

* Download `docker-compose-v2.yml` from https://github.com/jaegertracing/jaeger/blob/main/examples/hotrod/docker-compose-v2.yml, e.g.:
* `curl -O https://raw.githubusercontent.com/jaegertracing/jaeger/refs/heads/main/examples/hotrod/docker-compose-v2.yml`
* Download `docker-compose.yml` from https://github.com/jaegertracing/jaeger/blob/main/examples/hotrod/docker-compose.yml, e.g.:
* `curl -O https://raw.githubusercontent.com/jaegertracing/jaeger/refs/heads/main/examples/hotrod/docker-compose.yml`
* Optional: find the latest images versions (see https://www.jaegertracing.io/download/) and pass them via environment variables `JAEGER_VERSION` and `HOTROD_VERSION`. Otherwise `docker compose` will use the `latest` tag, which is fine for the first time you download the images, but once they are in your local registry the `latest` tag is never updated and you may be running stale (and possibly incompatible) verions of Jaeger and the HotROD app.
* Run Jaeger backend and HotROD demo, e.g.:
* `JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose -f docker-compose-v2.yml up`
* `JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose -f docker-compose.yml up`
* Access Jaeger UI at http://localhost:16686 and HotROD app at http://localhost:8080
* Shutdown / cleanup with `docker compose -f docker-compose-v2.yml down`
* Shutdown / cleanup with `docker compose -f docker-compose.yml down`
4 changes: 2 additions & 2 deletions cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
"github.com/jaegertracing/jaeger/internal/metrics/otelmetrics"
samplinggrpc "github.com/jaegertracing/jaeger/internal/sampling/grpc"
"github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin/sampling/leaderelection"
Expand Down Expand Up @@ -276,7 +276,7 @@ func (ext *rsExtension) startGRPCServer(ctx context.Context, host component.Host
return err
}

api_v2.RegisterSamplingManagerServer(ext.grpcServer, sampling.NewGRPCHandler(ext.strategyProvider))
api_v2.RegisterSamplingManagerServer(ext.grpcServer, samplinggrpc.NewHandler(ext.strategyProvider))

healthServer := health.NewServer() // support health checks on the gRPC server
healthServer.SetServingStatus("jaeger.api_v2.SamplingManager", grpc_health_v1.HealthCheckResponse_SERVING)
Expand Down
14 changes: 7 additions & 7 deletions docker-compose/monitor/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2024 The Jaeger Authors.
# SPDX-License-Identifier: Apache-2.0

BINARY ?= all-in-one # Default value uses v1 binary
BINARY ?= jaeger # Default value uses v2 binary

.PHONY: build
build: clean-jaeger
Expand All @@ -20,13 +20,13 @@ build: clean-jaeger
.PHONY: dev
dev: export JAEGER_IMAGE_TAG = dev
dev:
docker compose -f docker-compose.yml up $(DOCKER_COMPOSE_ARGS)
docker compose up $(DOCKER_COMPOSE_ARGS)

.PHONY: dev-v2
dev-v2: export JAEGER_IMAGE_TAG = dev
dev-v2: export BINARY = jaeger
dev-v2: build
docker compose -f docker-compose-v2.yml up $(DOCKER_COMPOSE_ARGS)
.PHONY: dev-v1
dev-v1: export JAEGER_IMAGE_TAG = dev
dev-v1: export BINARY = all-in-one
dev-v1: build
docker compose -f docker-compose-v1.yml up $(DOCKER_COMPOSE_ARGS)

.PHONY: clean-jaeger
clean-jaeger:
Expand Down
14 changes: 7 additions & 7 deletions docker-compose/monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ It uses the latest image tags from both Jaeger and OpenTelemetry.
docker compose up
```

**Jaeger v2**
**Jaeger v1**

```shell
docker compose -f docker-compose-v2.yml up
docker compose -f docker-compose-v1.yml up
```

**Tips:**
- Let the application run for a couple of minutes to ensure there is enough time series data to plot in the dashboard.
- Navigate to Jaeger UI at http://localhost:16686/ and inspect the Monitor tab. Select `redis` service from the dropdown to see more than one endpoint.
- To visualize the raw metrics stored on the Prometheus server (for debugging and local development use cases), use the built-in Prometheus UI at http://localhost:9090/query. For example, http://localhost:9090/query?g0.expr=traces_span_metrics_calls_total&g0.tab=0&g0.range_input=5m

**Warning:** The included [docker-compose.yml](./docker-compose.yml) file uses the `latest` version of Jaeger and other components. If your local Docker registry already contains older versions, which may still be tagged as `latest`, you may want to delete those images before running the full set, to ensure consistent behavior:
**Warning:** The included ` docker compose` files use the `latest` version of Jaeger and other components. If your local Docker registry already contains older versions, which may still be tagged as `latest`, you may want to delete those images before running the full set, to ensure consistent behavior:

```bash
make clean-all
Expand All @@ -92,13 +92,13 @@ make clean-all
To use an official published image of Jaeger, specify the version via environment variable:

```shell
JAEGER_IMAGE_TAG=1.62.0 docker compose up
JAEGER_IMAGE_TAG=2.0.0 docker compose -f docker-compose.yml up
```

or for Jaeger v2:
or for Jaeger v1:

```shell
JAEGER_IMAGE_TAG=2.0.0 docker compose -f docker-compose-v2.yml up
JAEGER_IMAGE_TAG=1.62.0 docker compose -f docker-compose-v1.yml up
```

## Development
Expand All @@ -107,7 +107,7 @@ These steps allow for running the system necessary for SPM, built from Jaeger's

The primary use case is for testing source code changes to the SPM feature locally.

### Build jaeger-all-in-one docker image
### Build jaeger-v2 docker image

```shell
make build
Expand Down
54 changes: 54 additions & 0 deletions docker-compose/monitor/docker-compose-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
services:
jaeger:
networks:
- backend
image: jaegertracing/all-in-one:${JAEGER_IMAGE_TAG:-latest}
volumes:
- "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json"
command: --query.ui-config /etc/jaeger/jaeger-ui.json
environment:
- METRICS_STORAGE_TYPE=prometheus
- PROMETHEUS_SERVER_URL=http://prometheus:9090
- 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"

otel_collector:
networks:
backend:
# This is the host name used in Prometheus scrape configuration.
aliases: [spm_metrics_source]
image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.112.0}
volumes:
- ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml
command: --config /etc/otelcol/otel-collector-config.yml
depends_on:
- jaeger
ports:
- "8889:8889"

microsim:
networks:
- backend
image: yurishkuro/microsim:v0.4.1
command: "-d 24h -s 500ms"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel_collector:4318
- OTEL_EXPORTER_OTLP_INSECURE=true
depends_on:
- otel_collector

prometheus:
networks:
- backend
image: prom/prometheus:latest
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"

networks:
backend:
39 changes: 0 additions & 39 deletions docker-compose/monitor/docker-compose-v2.yml

This file was deleted.

37 changes: 11 additions & 26 deletions docker-compose/monitor/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,35 @@
services:
jaeger:
networks:
- backend
image: jaegertracing/all-in-one:${JAEGER_IMAGE_TAG:-latest}
volumes:
- "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json"
command: --query.ui-config /etc/jaeger/jaeger-ui.json
environment:
- METRICS_STORAGE_TYPE=prometheus
- PROMETHEUS_SERVER_URL=http://prometheus:9090
- 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"

otel_collector:
networks:
backend:
# This is the host name used in Prometheus scrape configuration.
aliases: [spm_metrics_source]
image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.112.0}
image: jaegertracing/jaeger:${JAEGER_IMAGE_TAG:-latest}
volumes:
- ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml
command: --config /etc/otelcol/otel-collector-config.yml
depends_on:
- jaeger
- "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" # Do we need this for v2 ? Seems to be running without this.
- "../../cmd/jaeger/config-spm.yaml:/etc/jaeger/config.yml"
command: ["--config", "/etc/jaeger/config.yml"]
ports:
- "16686:16686"
- "8888:8888"
- "8889:8889"
- "4317:4317"
- "4318:4318"

microsim:
networks:
- backend
image: yurishkuro/microsim:v0.4.1
command: "-d 24h -s 500ms"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel_collector:4318
- OTEL_EXPORTER_OTLP_INSECURE=true
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://jaeger:4318/v1/traces
depends_on:
- otel_collector
- jaeger

prometheus:
networks:
- backend
image: prom/prometheus:latest
image: prom/prometheus:v3.1.0
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# To run a specific version of Jaeger, use environment variable, e.g.:
# JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose up
# JAEGER_VERSION=1.52 docker compose up

services:
jaeger:
image: ${REGISTRY:-}jaegertracing/jaeger:${JAEGER_VERSION:-latest}
image: ${REGISTRY:-}jaegertracing/all-in-one:${JAEGER_VERSION:-latest}
ports:
- "16686:16686"
- "4317:4317"
Expand All @@ -14,7 +14,7 @@ services:
- jaeger-example

hotrod:
image: ${REGISTRY:-}jaegertracing/example-hotrod:${HOTROD_VERSION:-latest}
image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest}
# To run the latest trunk build, find the tag at Docker Hub and use the line below
# https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags
#image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c
Expand Down
6 changes: 3 additions & 3 deletions examples/hotrod/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# To run a specific version of Jaeger, use environment variable, e.g.:
# JAEGER_VERSION=1.52 docker compose up
# JAEGER_VERSION=2.0.0 HOTROD_VERSION=1.63.0 docker compose up

services:
jaeger:
image: ${REGISTRY:-}jaegertracing/all-in-one:${JAEGER_VERSION:-latest}
image: ${REGISTRY:-}jaegertracing/jaeger:${JAEGER_VERSION:-latest}
ports:
- "16686:16686"
- "4317:4317"
Expand All @@ -14,7 +14,7 @@ services:
- jaeger-example

hotrod:
image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest}
image: ${REGISTRY:-}jaegertracing/example-hotrod:${HOTROD_VERSION:-latest}
# To run the latest trunk build, find the tag at Docker Hub and use the line below
# https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags
#image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/net v0.34.0
golang.org/x/sys v0.29.0
google.golang.org/grpc v1.69.2
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.2
gopkg.in/yaml.v3 v3.0.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU=
google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A=
google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2018 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package sampling
package grpc

import (
"context"
Expand All @@ -10,19 +10,19 @@ import (
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

// GRPCHandler is sampling strategy handler for gRPC.
type GRPCHandler struct {
// Handler is sampling strategy handler for gRPC.
type Handler struct {
samplingProvider samplingstrategy.Provider
}

// NewGRPCHandler creates a handler that controls sampling strategies for services.
func NewGRPCHandler(provider samplingstrategy.Provider) GRPCHandler {
return GRPCHandler{
// NewHandler creates a handler that controls sampling strategies for services.
func NewHandler(provider samplingstrategy.Provider) Handler {
return Handler{
samplingProvider: provider,
}
}

// GetSamplingStrategy returns sampling decision from store.
func (s GRPCHandler) GetSamplingStrategy(ctx context.Context, param *api_v2.SamplingStrategyParameters) (*api_v2.SamplingStrategyResponse, error) {
func (s Handler) GetSamplingStrategy(ctx context.Context, param *api_v2.SamplingStrategyParameters) (*api_v2.SamplingStrategyResponse, error) {
return s.samplingProvider.GetSamplingStrategy(ctx, param.GetServiceName())
}
Loading

0 comments on commit e4eb44e

Please sign in to comment.