-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`crictl` now features 3 new CLI parameters: - `--enable-tracing`: Enable OpenTelemetry tracing. (default: false) - `--tracing-endpoint`: Address to which the gRPC tracing collector will send spans to. (default: "0.0.0.0:4317") - `--tracing-sampling-rate-per-million`: Number of samples to collect per million OpenTelemetry spans. Set to 1000000 or -1 to always sample. (default: -1) The tracer provider will be created on startup and the `Shutdown()` invocation will ensure that all spans are processed before exiting the binary. The `hack/tracing` directory contains scripts for local testing: ``` > ./hack/tracing/start … Everything is ready, open http://localhost:16686 to access jaeger ``` When now running `crictl` with `--enable-tracing`: ``` > sudo ./build/bin/linux/amd64/crictl --enable-tracing ps ``` Then jaeger should show collected traces and spans for the 3 RPCs `ListContainers`, `ImageFsInfo` as well as `Version`. Signed-off-by: Sascha Grunert <[email protected]>
- Loading branch information
1 parent
a6e0a5a
commit 9e47eb0
Showing
72 changed files
with
1,215 additions
and
383 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
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,16 @@ | ||
#!/usr/bin/env bash | ||
set -uo pipefail | ||
|
||
cd "$(dirname "$0")" | ||
|
||
CONTAINER_RUNTIME=$(which podman 2>/dev/null) || CONTAINER_RUNTIME=$(which docker 2>/dev/null) | ||
if [[ -z "$CONTAINER_RUNTIME" ]]; then | ||
echo "Neither docker nor podman found in \$PATH" | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
|
||
export OTLP_CTR=otlp | ||
export JAEGER_CTR=jaeger | ||
export CONTAINER_RUNTIME |
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,8 @@ | ||
#!/usr/bin/env bash | ||
set -uo pipefail | ||
|
||
# Global vars to be used | ||
# shellcheck source=env | ||
source "$(dirname "${BASH_SOURCE[0]}")"/env | ||
|
||
"$CONTAINER_RUNTIME" logs "$OTLP_CTR" 2>&1 |
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,36 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
http: | ||
grpc: | ||
|
||
exporters: | ||
logging: | ||
loglevel: debug | ||
|
||
jaeger: | ||
endpoint: localhost:14250 | ||
tls: | ||
insecure: true | ||
|
||
processors: | ||
batch: | ||
|
||
extensions: | ||
health_check: | ||
pprof: | ||
endpoint: :1888 | ||
zpages: | ||
endpoint: :55679 | ||
|
||
service: | ||
extensions: [pprof, zpages, health_check] | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging, jaeger] | ||
metrics: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging] |
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,49 @@ | ||
#!/usr/bin/env bash | ||
set -uo pipefail | ||
|
||
# Global vars to be used | ||
# shellcheck source=stop | ||
source "$(dirname "${BASH_SOURCE[0]}")"/stop | ||
|
||
JAEGER_IMG="jaegertracing/all-in-one:1.41.0" | ||
OTLP_IMG="otel/opentelemetry-collector:0.70.0" | ||
|
||
echo "Starting $JAEGER_CTR" | ||
"$CONTAINER_RUNTIME" run -d --rm --network host --name "$JAEGER_CTR" "$JAEGER_IMG" | ||
|
||
PORT=14250 | ||
MAX_CNT=100 | ||
for ((i = 0; i <= "$MAX_CNT"; i++)); do | ||
if netstat -tuplen 2>/dev/null | grep -q "$PORT .* LISTEN"; then | ||
break | ||
fi | ||
|
||
if [[ $i == "$MAX_CNT" ]]; then | ||
echo "Giving up" | ||
exit 1 | ||
fi | ||
|
||
echo "Waiting for gRPC port $PORT to listen… ($i)" | ||
sleep 3 | ||
done | ||
|
||
echo "Starting $OTLP_CTR" | ||
"$CONTAINER_RUNTIME" run -d --rm --network host --name "$OTLP_CTR" \ | ||
-v ./otel-collector-config.yaml:/etc/otel-collector-config.yaml \ | ||
"$OTLP_IMG" --config=/etc/otel-collector-config.yaml | ||
|
||
for ((i = 0; i <= "$MAX_CNT"; i++)); do | ||
if ./logs | grep -q '"jaeger", "state": "READY"'; then | ||
break | ||
fi | ||
|
||
if [[ $i == "$MAX_CNT" ]]; then | ||
echo "Giving up" | ||
exit 1 | ||
fi | ||
|
||
echo "Waiting for OTLP to become ready… ($i)" | ||
sleep 3 | ||
done | ||
|
||
echo "Everything is ready, open http://localhost:16686 to access jaeger" |
Oops, something went wrong.