-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(example-fastify): update example to use latest versions (#1899)
* fix(example-fastify): update example to use latest versions * fix(fastify-example): update screenshot
- Loading branch information
1 parent
fce7d3b
commit 12834d5
Showing
10 changed files
with
2,429 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
version: "3" | ||
services: | ||
# Collector | ||
collector: | ||
image: otel/opentelemetry-collector:0.38.0 | ||
# image: otel/opentelemetry-collector:latest | ||
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"] | ||
image: otel/opentelemetry-collector:0.92.0 | ||
command: ["--config=/conf/collector-config.yaml"] | ||
volumes: | ||
- ./collector-config.yaml:/conf/collector-config.yaml | ||
ports: | ||
- "9464:9464" | ||
- "4317:4317" | ||
- "4318:4318" | ||
- "4317:4317" # OTLP-grpc compatible endpoint (used by client/server) | ||
- "4318:4318" # OTLP-http compatible endpoint (unused in this example) | ||
depends_on: | ||
- zipkin-all-in-one | ||
- jaeger | ||
- zipkin | ||
|
||
# Zipkin | ||
zipkin-all-in-one: | ||
image: openzipkin/zipkin:latest | ||
jaeger: | ||
image: jaegertracing/all-in-one:1.52 | ||
ports: | ||
- "9411:9411" | ||
- "16686:16686" # frontend (to inspect traces) | ||
|
||
zipkin: | ||
image: openzipkin/zipkin:3 | ||
ports: | ||
- "9411:9411" # frontend (to inspect traces) | ||
|
||
prometheus: | ||
container_name: prometheus | ||
image: prom/prometheus:v2.49.0 | ||
volumes: | ||
- ./prometheus.yaml:/etc/prometheus/prometheus.yml | ||
ports: | ||
- "9090:9090" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
global: | ||
scrape_interval: 15s # Default is every 1 minute. | ||
|
||
scrape_configs: | ||
- job_name: 'collector' | ||
# metrics_path defaults to '/metrics' | ||
# scheme defaults to 'http'. | ||
static_configs: | ||
- targets: ['collector:9464'] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
const { | ||
diag, | ||
DiagConsoleLogger, | ||
DiagLogLevel, | ||
} = require('@opentelemetry/api'); | ||
|
||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.WARN); | ||
|
||
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http'); | ||
const { FastifyInstrumentation } = require('@opentelemetry/instrumentation-fastify'); | ||
|
||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto'); | ||
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto'); | ||
const { NodeSDK, metrics } = require('@opentelemetry/sdk-node'); | ||
|
||
const sdk = new NodeSDK({ | ||
instrumentations: [ | ||
HttpInstrumentation, | ||
new FastifyInstrumentation(), | ||
], | ||
traceExporter: new OTLPTraceExporter(), | ||
metricReader: new metrics.PeriodicExportingMetricReader({ | ||
exporter: new OTLPMetricExporter(), | ||
}), | ||
}); | ||
|
||
process.on('beforeExit', async () => { | ||
await sdk.shutdown(); | ||
}); | ||
|
||
sdk.start(); |
Oops, something went wrong.