Skip to content

Commit

Permalink
Enable spanmetrics and set service_name label
Browse files Browse the repository at this point in the history
  • Loading branch information
Starefossen committed Aug 8, 2024
1 parent 49f1feb commit f378d35
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,14 @@ services:
image: grafana/otel-lgtm:latest
container_name: otel-lgtm
ports:
- "${GRAFANA_SERVICE_PORT}:${GRAFANA_SERVICE_PORT}"
- "${GRAFANA_SERVICE_PORT}"
environment:
- GF_SERVER_DOMAIN=localhost
- GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s/grafana/
- GF_SERVER_SERVE_FROM_SUB_PATH=true
volumes:
- ./src/otel-lgtm/config/otelcol-config.yaml:/otel-lgtm/otelcol-config.yaml
- ./src/otel-lgtm/config/tempo-config.yaml:/otel-lgtm/tempo-config.yaml
logging: *logging

# Jaeger
Expand Down
61 changes: 61 additions & 0 deletions src/otel-lgtm/config/otelcol-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
prometheus/collector:
config:
scrape_configs:
- job_name: "opentelemetry-collector"
static_configs:
- targets: ["localhost:8888"]

processors:
batch:
transform:
metric_statements:
- context: datapoint
statements:
- set(attributes["service_name"], resource.attributes["service.name"])
- set(attributes["service_version"], resource.attributes["service.version"])
- set(attributes["service_namespace"], resource.attributes["service.namespace"])

exporters:
otlphttp/metrics:
endpoint: http://localhost:9090/api/v1/otlp
tls:
insecure: true
otlphttp/traces:
endpoint: http://localhost:4418
tls:
insecure: true
otlphttp/logs:
endpoint: http://localhost:3100/otlp
tls:
insecure: true
logging/metrics:
verbosity: detailed
logging/traces:
verbosity: detailed
logging/logs:
verbosity: detailed

service:
pipelines:
traces:
receivers: [otlp]
processors: [transform, batch]
exporters: [otlphttp/traces]
#exporters: [otlphttp/traces,logging/traces]
metrics:
receivers: [otlp, prometheus/collector]
processors: [transform, batch]
exporters: [otlphttp/metrics]
#exporters: [otlphttp/metrics,logging/metrics]
logs:
receivers: [otlp]
processors: [transform, batch]
exporters: [otlphttp/logs]
#exporters: [otlphttp/logs,logging/logs]
36 changes: 36 additions & 0 deletions src/otel-lgtm/config/tempo-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server:
http_listen_port: 3200
grpc_listen_port: 9096

distributor:
receivers:
otlp:
protocols:
grpc:
endpoint: "localhost:4417"
http:
endpoint: "localhost:4418"

storage:
trace:
backend: local
wal:
path: /tmp/tempo/wal
local:
path: /tmp/tempo/blocks

metrics_generator:
processor:
local_blocks:
filter_server_spans: false
traces_storage:
path: /tmp/tempo/generator/traces
storage:
path: /tmp/tempo/generator/wal
# TODO: support otlp at metrics_generator
remote_write:
- url: http://localhost:9090/api/v1/write
send_exemplars: true

overrides:
metrics_generator_processors: [service-graphs, span-metrics, local-blocks]

0 comments on commit f378d35

Please sign in to comment.