I’m a developer who just started studying observability. I’m trying to collect telemetry data on the node.js application and collect it through grafana alloy, but i don’t have a clue how i can do it.
Here are the settings i’ve used, and i’d appreciate it if you could take a look at what might be the problem (First of all, I’m going to test it on local) and if you could point out any components i don’t use for purpose!
const sdk = new NodeSDK({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: 'opentelemetry-101',
[SEMRESATTRS_SERVICE_VERSION]: '0.0.1',
}),
spanProcessors: [
new BatchSpanProcessor(
new OTLPTraceExporter({
url: 'http://localhost:4318/v1/traces',
}),
),
],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: 'http://localhost:4318/v1/metrics',
}),
exportIntervalMillis: 1000,
}),
instrumentations: [getNodeAutoInstrumentations()],
});
services:
grafana-alloy:
container_name: grafana-alloy
image: grafana/alloy:v1.3.0
ports:
- "12345:12345"
- "4317:4317"
- "4318:4318"
volumes:
- ./config.alloy:/etc/alloy/config.alloy
command:
- run
- --server.http.listen-addr=0.0.0.0:12345
- --storage.path=/var/lib/alloy/data
- /etc/alloy/config.alloy
init:
image: &tempoImage grafana/tempo:latest
user: root
entrypoint:
- "chown"
- "10001:10001"
- "/var/tempo"
volumes:
- ./tempo-data:/var/tempo
grafana-tempo:
container_name: grafana-tempo
image: *tempoImage
command: [ "-config.file=/etc/tempo.yaml" ]
volumes:
- ./tempo.yaml:/etc/tempo.yaml
- ./tempo-data:/var/tempo
ports:
- "3200:3200" # tempo
- "9095:9095" # tempo grpc
- "14317:4317" # otlp grpc
- "14318:4318" # otlp http
depends_on:
- init
logging {
level = "info"
format = "logfmt"
}
otelcol.exporter.otlp "default" {
client {
endpoint = "grafana-tempo:14317"
}
}
otelcol.receiver.otlp "default" {
grpc {
endpoint = "127.0.0.1:4317"
}
http {
endpoint = "127.0.0.1:4318"
}
output {
traces = [otelcol.exporter.otlp.default.input]
}
}