Skip to content

Commit 7b3bdbe

Browse files
committed
otel attribute to track builder implementation selected
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
1 parent 094b48f commit 7b3bdbe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/compose/build.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import (
5050
"github.com/moby/buildkit/util/progress/progressui"
5151
specs "github.com/opencontainers/image-spec/specs-go/v1"
5252
"github.com/sirupsen/logrus"
53+
"go.opentelemetry.io/otel/attribute"
54+
"go.opentelemetry.io/otel/trace"
5355

5456
// required to get default driver registered
5557
_ "github.com/docker/buildx/driver/docker"
@@ -101,6 +103,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
101103
return nil, err
102104
}
103105
if bake {
106+
trace.SpanFromContext(ctx).SetAttributes(attribute.String("builder", "bake"))
104107
return s.doBuildBake(ctx, project, serviceToBuild, options)
105108
}
106109

@@ -197,6 +200,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
197200
serviceName := fmt.Sprintf("Service %s", name)
198201

199202
if !buildkitEnabled {
203+
trace.SpanFromContext(ctx).SetAttributes(attribute.String("builder", "classic"))
200204
cw.Event(progress.BuildingEvent(serviceName))
201205
id, err := s.doBuildClassic(ctx, project, service, options)
202206
if err != nil {
@@ -220,6 +224,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
220224
return err
221225
}
222226

227+
trace.SpanFromContext(ctx).SetAttributes(attribute.String("builder", "buildkit"))
223228
digest, err := s.doBuildBuildkit(ctx, name, buildOptions, w, nodes)
224229
if err != nil {
225230
return err

0 commit comments

Comments
 (0)