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

feat: add otel collector and otlp support #238

Merged
merged 4 commits into from
Sep 19, 2023
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 config/flagd/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"blue": "0d507b",
"yellow": "d4ac0d"
},
"defaultVariant": "red",
"defaultVariant": "blue",
"targeting": {
"if": [
{
Expand Down
23 changes: 23 additions & 0 deletions config/otel/collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
receivers:
otlp:
protocols:
grpc:
exporters:
prometheus:
endpoint: "0.0.0.0:8889"
jaeger:
endpoint: jaeger:14250
tls:
insecure: true
processors:
batch:
service:
pipelines:
traces:
receivers: [ otlp ]
processors: [ batch ]
exporters: [ jaeger ]
metrics:
receivers: [ otlp ]
processors: [ batch ]
exporters: [ prometheus ]
18 changes: 18 additions & 0 deletions config/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
global:
scrape_interval: 5s # By default, scrape targets every 15 seconds.

# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "playground"

# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s

static_configs:
- targets: [ 'otel-collector:8889' ]
- targets: [ 'otel-collector:8888' ]
42 changes: 37 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
image: ghcr.io/open-feature/playground-app:v0.11.0 # x-release-please-version
# build:
# dockerfile: ./packages/app/Dockerfile
# context: .
ports:
- '30000:30000'
command:
Expand All @@ -23,6 +24,7 @@ services:
- FIB_SERVICE_URL=http://fib-service:30001
- FIB_SERVICE_USER
- FIB_SERVICE_PASS
- ENABLED_SPAN_BASED_TRACES
# Provider values come from the .env
- NEW_WELCOME_MESSAGE
- FIB_ALGO
Expand All @@ -47,7 +49,8 @@ services:
fib-service:
image: ghcr.io/open-feature/playground-fib-service:v0.11.0 # x-release-please-version
# build:
# dockerfile: ./packages/fibonacci-service/Dockerfile
# dockerfile: ./packages/fibonacci-service/Dockerfile
# context: .
expose:
- '30001'
environment:
Expand All @@ -57,6 +60,7 @@ services:
- OTEL_SERVICE_NAME=fibonacci-service
- FIB_SERVICE_USER
- FIB_SERVICE_PASS
- ENABLED_SPAN_BASED_TRACES
# Provider values come from the .env
- NEW_WELCOME_MESSAGE
- FIB_ALGO
Expand All @@ -69,20 +73,48 @@ services:
- CLOUDBEES_APP_KEY

jaeger:
image: jaegertracing/all-in-one:1.46
image: jaegertracing/all-in-one:latest
expose:
- '6832/udp'
ports:
- '16686:16686'

otel-collector:
image: otel/opentelemetry-collector-contrib:latest
restart: always
command: [ "--config=/etc/otel-collector-config.yaml" ]
volumes:
- ./config/otel/collector.yaml:/etc/otel-collector-config.yaml
expose:
- "1888" # pprof extension
- "8888" # Prometheus metrics exposed by the collector
- "8889" # Prometheus exporter metrics
- "4317" # OTLP gRPC receiver
depends_on:
- jaeger
- prometheus

prometheus:
container_name: prometheus
image: prom/prometheus:latest
restart: always
volumes:
- ./config/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"

flagd:
image: ghcr.io/open-feature/flagd:v0.5.4
image: ghcr.io/open-feature/flagd:v0.6.6
command:
- start
- --cors-origin
- '*'
- --uri
- file://etc/flagd/flags.json
- --sources
- '[{"uri":"etc/flagd/flags.json","provider":"file","selector":"etc/flagd/flags.json"}]'
- --metrics-exporter
- otel
- --otel-collector-uri
- otel-collector:4317
volumes:
- ./config/flagd/flags.json:/etc/flagd/flags.json
ports:
Expand Down
Loading
Loading