build: opentelemetry support

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-03-01 09:29:37 +01:00
parent 1cd72a6029
commit 1e18821ebc
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
3 changed files with 39 additions and 0 deletions

View File

@ -1561,6 +1561,8 @@ manuals:
title: Multi-stage builds
- path: /build/building/multi-platform/
title: Multi-platform images
- path: /build/building/opentelemetry/
title: OpenTelemetry support
- path: /build/building/base-images/
title: Create your own base image
- sectiontitle: Drivers

View File

@ -0,0 +1,37 @@
---
title: OpenTelemetry support
keywords: build, buildx buildkit, opentelemetry
---
Both Buildx and BuildKit support [OpenTelemetry](https://opentelemetry.io/){:target="blank" rel="noopener" class=""}.
To capture the trace to [Jaeger](https://github.com/jaegertracing/jaeger){:target="blank" rel="noopener" class=""},
set `JAEGER_TRACE` environment variable to the collection address using a
`driver-opt`.
First create a Jaeger container:
```console
$ docker run -d --name jaeger -p "6831:6831/udp" -p "16686:16686" jaegertracing/all-in-one
```
Then [create a `docker-container` builder](../drivers/docker-container.md)
that will use the Jaeger instance via the `JAEGER_TRACE` env var:
```console
$ docker buildx create --use \
--name mybuilder \
--driver docker-container \
--driver-opt "network=host" \
--driver-opt "env.JAEGER_TRACE=localhost:6831"
```
Boot and [inspect `mybuilder`](../../engine/reference/commandline/buildx_inspect.md):
```console
$ docker buildx inspect --bootstrap
```
Buildx commands should be traced at `http://127.0.0.1:16686/`:
![OpenTelemetry Buildx Bake](../images/opentelemetry.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB