Skip to content

Instantly share code, notes, and snippets.

@Tsugami
Created November 6, 2023 16:07
Show Gist options
  • Save Tsugami/2d6f315348fe1502b684a8027c2c4ddf to your computer and use it in GitHub Desktop.
Save Tsugami/2d6f315348fe1502b684a8027c2c4ddf to your computer and use it in GitHub Desktop.
version: "3.9"
services:
redis_bullmq:
image: redis:latest
container_name: redis_bullmq
restart: always
ports:
- 6379:6379
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
ports:
- 6555:3000
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_NAME=MainOrg
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
volumes:
- grafana_data:/var/lib/grafana
otel:
container_name: otel-collector
image: otel/opentelemetry-collector-contrib:0.86.0
command: [ "--config=/etc/otelcol-contrib/config.yml"]
volumes:
- ./otel-collector-config.yml:/etc/otelcol-contrib/config.yml
# - ./otel-collector-config.yml:/etc/otelcol-contrib/config.yaml
# - ./otel-collector-config.yml:/etc/otelcol/config.yaml
ports:
- 1888:1888 # pprof extension
- 8888:8888 # Prometheus metrics exposed by the Collector
- 8889:8889 # Prometheus exporter metrics
- 13133:13133 # health_check extension
- 4317:4317 # OTLP gRPC receiver
- 4318:4318 # OTLP http receiver
- 55679:55679 # zpages extension
environment:
- JAEGER_ENDPOINT=jaeger:4317
depends_on:
- jaeger
jaeger:
container_name: jaeger
image: jaegertracing/all-in-one:1.47
ports:
- 16686:16686 # Jaeger UI
- "4317" # OTLP gRPC default port
environment:
- COLLECTOR_OTLP_ENABLED=true
volumes:
grafana_data:
require("dotenv/config");
/*instrumentation.js*/
// Require dependencies
const { NodeSDK } = require("@opentelemetry/sdk-node");
const {
getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");
const {
PeriodicExportingMetricReader,
// ConsoleMetricExporter,
} = require("@opentelemetry/sdk-metrics");
const {
BullMQInstrumentation,
} = require("@jenniferplusplus/opentelemetry-instrumentation-bullmq");
const {
OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-grpc");
const { Resource } = require("@opentelemetry/resources");
const {
SemanticResourceAttributes,
} = require("@opentelemetry/semantic-conventions");
const {
OTLPTraceExporter: HTTPOTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-http");
const {
OTLPMetricExporter,
} = require("@opentelemetry/exporter-metrics-otlp-http");
// const { ConsoleSpanExporter } = require("@opentelemetry/sdk-trace-node");
const sdk = new NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: "SERVER",
}),
traceExporter: new HTTPOTLPTraceExporter({
// url: "http://localhost:4318/v1/traces",
}),
// metricReader: new PeriodicExportingMetricReader({
// exporter: new OTLPMetricExporter(),
// }),
instrumentations: [
getNodeAutoInstrumentations(),
new BullMQInstrumentation(),
],
});
sdk.start();
receivers:
otlp:
protocols:
grpc:
http:
exporters:
debug:
logging:
otlp/jaeger:
endpoint: "${env:JAEGER_ENDPOINT}"
tls:
insecure: true
# otlp:
# endpoint: tempo:4317
# tls:
# insecure: true
processors:
batch:
service:
pipelines:
metrics:
receivers: [otlp]
exporters: [debug, logging]
traces:
receivers: [otlp]
exporters: [debug, logging, otlp/jaeger]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment