-
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 <sgrunert@redhat.com>
- Loading branch information
1 parent
c631776
commit 66bb77f
Showing
47 changed files
with
2,007 additions
and
502 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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
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 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,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -uo pipefail | ||
|
||
# Global vars to be used | ||
# shellcheck source=stop | ||
source "$(dirname "${BASH_SOURCE[0]}")"/stop | ||
|
||
JAEGER_IMG="jaegertracing/all-in-one:1.52" | ||
|
||
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 "Everything is ready, open http://localhost:16686 to access jaeger" |
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,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -uo pipefail | ||
|
||
# Global vars to be used | ||
# shellcheck source=env | ||
source "$(dirname "${BASH_SOURCE[0]}")"/env | ||
|
||
echo "Stopping $JAEGER_CTR container" | ||
"$CONTAINER_RUNTIME" stop "$JAEGER_CTR" >/dev/null 2>&1 || true |
Oops, something went wrong.