vendor: update buildkit v0.26.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@ require (
|
||||
github.com/hashicorp/hcl/v2 v2.24.0
|
||||
github.com/in-toto/in-toto-golang v0.9.0
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
github.com/moby/buildkit v0.25.0-rc1.0.20251105204500-e18be4182830
|
||||
github.com/moby/buildkit v0.26.0-rc1
|
||||
github.com/moby/go-archive v0.1.0
|
||||
github.com/moby/sys/atomicwriter v0.1.0
|
||||
github.com/moby/sys/mountinfo v0.7.2
|
||||
@@ -147,7 +147,7 @@ require (
|
||||
github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect
|
||||
|
||||
@@ -252,8 +252,8 @@ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTS
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/moby/buildkit v0.25.0-rc1.0.20251105204500-e18be4182830 h1:uhSnuca3y3RfEmF5/27ZOA/sFDc9WWApOLM5W/57c4U=
|
||||
github.com/moby/buildkit v0.25.0-rc1.0.20251105204500-e18be4182830/go.mod h1:IKOZJHc6vcPssXSDjpqamEormeIu/dgzw38NFZCmIp0=
|
||||
github.com/moby/buildkit v0.26.0-rc1 h1:gAroxWAvEcssyohcbCb82cK7BIbmqugFy9+93AQT1eo=
|
||||
github.com/moby/buildkit v0.26.0-rc1/go.mod h1:LiT7ohcE83rF/GtmoOBHj75+nUry+ili3FqZtlDkspo=
|
||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
|
||||
@@ -336,8 +336,8 @@ github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzM
|
||||
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw=
|
||||
@@ -409,8 +409,8 @@ github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 h1:lREC4C0ilyP4WibDhQ7Gg2ygAQFP8oR07Fst/5cafwI=
|
||||
|
||||
+11
-2
@@ -408,6 +408,7 @@ type SolveRequest struct {
|
||||
SourcePolicy *pb1.Policy `protobuf:"bytes,12,opt,name=SourcePolicy,proto3" json:"SourcePolicy,omitempty"`
|
||||
Exporters []*Exporter `protobuf:"bytes,13,rep,name=Exporters,proto3" json:"Exporters,omitempty"`
|
||||
EnableSessionExporter bool `protobuf:"varint,14,opt,name=EnableSessionExporter,proto3" json:"EnableSessionExporter,omitempty"`
|
||||
SourcePolicySession string `protobuf:"bytes,15,opt,name=SourcePolicySession,proto3" json:"SourcePolicySession,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -540,6 +541,13 @@ func (x *SolveRequest) GetEnableSessionExporter() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *SolveRequest) GetSourcePolicySession() string {
|
||||
if x != nil {
|
||||
return x.SourcePolicySession
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CacheOptions struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// ExportRefDeprecated is deprecated in favor or the new Exports since BuildKit v0.4.0.
|
||||
@@ -2050,7 +2058,7 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc =
|
||||
" \x01(\tR\n" +
|
||||
"RecordType\x12\x16\n" +
|
||||
"\x06Shared\x18\v \x01(\bR\x06Shared\x12\x18\n" +
|
||||
"\aParents\x18\f \x03(\tR\aParents\"\xf4\a\n" +
|
||||
"\aParents\x18\f \x03(\tR\aParents\"\xa6\b\n" +
|
||||
"\fSolveRequest\x12\x10\n" +
|
||||
"\x03Ref\x18\x01 \x01(\tR\x03Ref\x12.\n" +
|
||||
"\n" +
|
||||
@@ -2068,7 +2076,8 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc =
|
||||
"\bInternal\x18\v \x01(\bR\bInternal\x12I\n" +
|
||||
"\fSourcePolicy\x18\f \x01(\v2%.moby.buildkit.v1.sourcepolicy.PolicyR\fSourcePolicy\x128\n" +
|
||||
"\tExporters\x18\r \x03(\v2\x1a.moby.buildkit.v1.ExporterR\tExporters\x124\n" +
|
||||
"\x15EnableSessionExporter\x18\x0e \x01(\bR\x15EnableSessionExporter\x1aJ\n" +
|
||||
"\x15EnableSessionExporter\x18\x0e \x01(\bR\x15EnableSessionExporter\x120\n" +
|
||||
"\x13SourcePolicySession\x18\x0f \x01(\tR\x13SourcePolicySession\x1aJ\n" +
|
||||
"\x1cExporterAttrsDeprecatedEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a@\n" +
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ message SolveRequest {
|
||||
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 12;
|
||||
repeated Exporter Exporters = 13;
|
||||
bool EnableSessionExporter = 14;
|
||||
string SourcePolicySession = 15;
|
||||
}
|
||||
|
||||
message CacheOptions {
|
||||
|
||||
+47
@@ -142,6 +142,7 @@ func (m *SolveRequest) CloneVT() *SolveRequest {
|
||||
r.Internal = m.Internal
|
||||
r.SourcePolicy = m.SourcePolicy.CloneVT()
|
||||
r.EnableSessionExporter = m.EnableSessionExporter
|
||||
r.SourcePolicySession = m.SourcePolicySession
|
||||
if rhs := m.ExporterAttrsDeprecated; rhs != nil {
|
||||
tmpContainer := make(map[string]string, len(rhs))
|
||||
for k, v := range rhs {
|
||||
@@ -1039,6 +1040,9 @@ func (this *SolveRequest) EqualVT(that *SolveRequest) bool {
|
||||
if this.EnableSessionExporter != that.EnableSessionExporter {
|
||||
return false
|
||||
}
|
||||
if this.SourcePolicySession != that.SourcePolicySession {
|
||||
return false
|
||||
}
|
||||
return string(this.unknownFields) == string(that.unknownFields)
|
||||
}
|
||||
|
||||
@@ -2245,6 +2249,13 @@ func (m *SolveRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
|
||||
i -= len(m.unknownFields)
|
||||
copy(dAtA[i:], m.unknownFields)
|
||||
}
|
||||
if len(m.SourcePolicySession) > 0 {
|
||||
i -= len(m.SourcePolicySession)
|
||||
copy(dAtA[i:], m.SourcePolicySession)
|
||||
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SourcePolicySession)))
|
||||
i--
|
||||
dAtA[i] = 0x7a
|
||||
}
|
||||
if m.EnableSessionExporter {
|
||||
i--
|
||||
if m.EnableSessionExporter {
|
||||
@@ -4159,6 +4170,10 @@ func (m *SolveRequest) SizeVT() (n int) {
|
||||
if m.EnableSessionExporter {
|
||||
n += 2
|
||||
}
|
||||
l = len(m.SourcePolicySession)
|
||||
if l > 0 {
|
||||
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
|
||||
}
|
||||
n += len(m.unknownFields)
|
||||
return n
|
||||
}
|
||||
@@ -6279,6 +6294,38 @@ func (m *SolveRequest) UnmarshalVT(dAtA []byte) error {
|
||||
}
|
||||
}
|
||||
m.EnableSessionExporter = bool(v != 0)
|
||||
case 15:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field SourcePolicySession", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protohelpers.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protohelpers.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protohelpers.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.SourcePolicySession = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := protohelpers.Skip(dAtA[iNdEx:])
|
||||
|
||||
+2
-2
@@ -146,8 +146,8 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
_, _, dt, err := info.metaResolver.ResolveImageConfig(ctx, ref, sourceresolver.Opt{
|
||||
Platform: p,
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
},
|
||||
})
|
||||
@@ -163,8 +163,8 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
ref, dgst, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, sourceresolver.Opt{
|
||||
Platform: p,
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
},
|
||||
})
|
||||
|
||||
+22
-5
@@ -24,7 +24,6 @@ type MetaResolver interface {
|
||||
type Opt struct {
|
||||
LogName string
|
||||
SourcePolicies []*spb.Policy
|
||||
Platform *ocispecs.Platform
|
||||
|
||||
ImageOpt *ResolveImageOpt
|
||||
OCILayoutOpt *ResolveOCILayoutOpt
|
||||
@@ -40,12 +39,29 @@ type MetaResponse struct {
|
||||
}
|
||||
|
||||
type ResolveImageOpt struct {
|
||||
ResolveMode string
|
||||
Platform *ocispecs.Platform
|
||||
ResolveMode string
|
||||
NoConfig bool
|
||||
AttestationChain bool
|
||||
}
|
||||
|
||||
type ResolveImageResponse struct {
|
||||
Digest digest.Digest
|
||||
Config []byte
|
||||
Digest digest.Digest
|
||||
Config []byte
|
||||
AttestationChain *AttestationChain
|
||||
}
|
||||
|
||||
type AttestationChain struct {
|
||||
Root digest.Digest
|
||||
ImageManifest digest.Digest
|
||||
AttestationManifest digest.Digest
|
||||
SignatureManifests []digest.Digest
|
||||
Blobs map[digest.Digest]Blob
|
||||
}
|
||||
|
||||
type Blob struct {
|
||||
Descriptor ocispecs.Descriptor
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type ResolveGitOpt struct {
|
||||
@@ -67,7 +83,8 @@ type ResolveHTTPResponse struct {
|
||||
}
|
||||
|
||||
type ResolveOCILayoutOpt struct {
|
||||
Store ResolveImageConfigOptStore
|
||||
Platform *ocispecs.Platform
|
||||
Store ResolveImageConfigOptStore
|
||||
}
|
||||
|
||||
type ResolveImageConfigOptStore struct {
|
||||
|
||||
+12
-2
@@ -51,6 +51,7 @@ type SolveOpt struct {
|
||||
SessionPreInitialized bool // TODO: refactor to better session syncing
|
||||
Internal bool
|
||||
SourcePolicy *spb.Policy
|
||||
SourcePolicyProvider session.Attachable
|
||||
Ref string
|
||||
}
|
||||
|
||||
@@ -219,6 +220,10 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
s.Allow(filesync.NewFSSyncTarget(syncTargets...))
|
||||
}
|
||||
|
||||
if opt.SourcePolicyProvider != nil {
|
||||
s.Allow(opt.SourcePolicyProvider)
|
||||
}
|
||||
|
||||
eg.Go(func() error {
|
||||
sd := c.sessionDialer
|
||||
if sd == nil {
|
||||
@@ -275,7 +280,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
})
|
||||
}
|
||||
|
||||
resp, err := c.ControlClient().Solve(ctx, &controlapi.SolveRequest{
|
||||
sopt := &controlapi.SolveRequest{
|
||||
Ref: ref,
|
||||
Definition: pbd,
|
||||
Exporters: exports,
|
||||
@@ -290,7 +295,12 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
Entitlements: slices.Clone(opt.AllowedEntitlements),
|
||||
Internal: opt.Internal,
|
||||
SourcePolicy: opt.SourcePolicy,
|
||||
})
|
||||
}
|
||||
if opt.SourcePolicyProvider != nil {
|
||||
sopt.SourcePolicySession = s.ID()
|
||||
}
|
||||
|
||||
resp, err := c.ControlClient().Solve(ctx, sopt)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to solve")
|
||||
}
|
||||
|
||||
+4
-4
@@ -94,9 +94,9 @@ func (nc *NamedContext) load(ctx context.Context, count int) (*llb.State, *docke
|
||||
named = reference.TagNameOnly(named)
|
||||
|
||||
ref, dgst, data, err := nc.bc.client.ResolveImageConfig(ctx, named.String(), sourceresolver.Opt{
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, ref),
|
||||
Platform: opt.Platform,
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, ref),
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: opt.Platform,
|
||||
ResolveMode: opt.ResolveMode,
|
||||
},
|
||||
})
|
||||
@@ -183,9 +183,9 @@ func (nc *NamedContext) load(ctx context.Context, count int) (*llb.State, *docke
|
||||
}
|
||||
|
||||
_, dgst, data, err := nc.bc.client.ResolveImageConfig(ctx, dummyRef.String(), sourceresolver.Opt{
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, dummyRef.String()),
|
||||
Platform: opt.Platform,
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, dummyRef.String()),
|
||||
OCILayoutOpt: &sourceresolver.ResolveOCILayoutOpt{
|
||||
Platform: opt.Platform,
|
||||
Store: sourceresolver.ResolveImageConfigOptStore{
|
||||
SessionID: nc.bc.bopts.SessionID,
|
||||
StoreID: named.Name(),
|
||||
|
||||
+64
-6
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -25,6 +26,7 @@ import (
|
||||
"github.com/moby/buildkit/util/imageutil"
|
||||
"github.com/moby/sys/signal"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
fstypes "github.com/tonistiigi/fsutil/types"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -497,8 +499,14 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
}, nil
|
||||
}
|
||||
|
||||
var platform *ocispecs.Platform
|
||||
if imgOpt := opt.ImageOpt; imgOpt != nil && imgOpt.Platform != nil {
|
||||
platform = imgOpt.Platform
|
||||
} else if ociOpt := opt.OCILayoutOpt; ociOpt != nil && ociOpt.Platform != nil {
|
||||
platform = ociOpt.Platform
|
||||
}
|
||||
var p *opspb.Platform
|
||||
if platform := opt.Platform; platform != nil {
|
||||
if platform != nil {
|
||||
p = &opspb.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
@@ -514,6 +522,13 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
LogName: opt.LogName,
|
||||
SourcePolicies: opt.SourcePolicies,
|
||||
}
|
||||
if opt.ImageOpt != nil {
|
||||
req.Image = &pb.ResolveSourceImageRequest{
|
||||
NoConfig: opt.ImageOpt.NoConfig,
|
||||
AttestationChain: opt.ImageOpt.AttestationChain,
|
||||
}
|
||||
}
|
||||
|
||||
if opt.GitOpt != nil {
|
||||
req.Git = &pb.ResolveSourceGitRequest{
|
||||
ReturnObject: opt.GitOpt.ReturnObject,
|
||||
@@ -529,10 +544,7 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
Op: resp.Source,
|
||||
}
|
||||
if resp.Image != nil {
|
||||
r.Image = &sourceresolver.ResolveImageResponse{
|
||||
Digest: digest.Digest(resp.Image.Digest),
|
||||
Config: resp.Image.Config,
|
||||
}
|
||||
r.Image = imgResponseFromPB(resp.Image)
|
||||
}
|
||||
if resp.Git != nil {
|
||||
r.Git = &sourceresolver.ResolveGitResponse{
|
||||
@@ -561,6 +573,45 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func imgResponseFromPB(resp *pb.ResolveSourceImageResponse) *sourceresolver.ResolveImageResponse {
|
||||
r := &sourceresolver.ResolveImageResponse{
|
||||
Digest: digest.Digest(resp.Digest),
|
||||
Config: resp.Config,
|
||||
}
|
||||
if resp.AttestationChain != nil {
|
||||
ac := &sourceresolver.AttestationChain{
|
||||
Root: digest.Digest(resp.AttestationChain.Root),
|
||||
ImageManifest: digest.Digest(resp.AttestationChain.ImageManifest),
|
||||
AttestationManifest: digest.Digest(resp.AttestationChain.AttestationManifest),
|
||||
SignatureManifests: []digest.Digest{},
|
||||
Blobs: map[digest.Digest]sourceresolver.Blob{},
|
||||
}
|
||||
for _, sm := range resp.AttestationChain.SignatureManifests {
|
||||
ac.SignatureManifests = append(ac.SignatureManifests, digest.Digest(sm))
|
||||
}
|
||||
for k, v := range resp.AttestationChain.Blobs {
|
||||
ac.Blobs[digest.Digest(k)] = sourceresolver.Blob{
|
||||
Descriptor: descriptorFromPB(v.GetDescriptor_()),
|
||||
Data: v.Data,
|
||||
}
|
||||
}
|
||||
r.AttestationChain = ac
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func descriptorFromPB(pbDesc *pb.Descriptor) ocispecs.Descriptor {
|
||||
if pbDesc == nil {
|
||||
return ocispecs.Descriptor{}
|
||||
}
|
||||
return ocispecs.Descriptor{
|
||||
MediaType: pbDesc.GetMediaType(),
|
||||
Size: pbDesc.GetSize(),
|
||||
Digest: digest.Digest(pbDesc.GetDigest()),
|
||||
Annotations: maps.Clone(pbDesc.GetAnnotations()),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, ref string, opt sourceresolver.Opt, p *opspb.Platform) (string, digest.Digest, []byte, error) {
|
||||
op := &opspb.SourceOp{
|
||||
Identifier: "docker-image://" + ref,
|
||||
@@ -596,8 +647,15 @@ func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, re
|
||||
}
|
||||
|
||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt sourceresolver.Opt) (string, digest.Digest, []byte, error) {
|
||||
var platform *ocispecs.Platform
|
||||
if imgOpt := opt.ImageOpt; imgOpt != nil && imgOpt.Platform != nil {
|
||||
platform = imgOpt.Platform
|
||||
} else if ociOpt := opt.OCILayoutOpt; ociOpt != nil && ociOpt.Platform != nil {
|
||||
platform = ociOpt.Platform
|
||||
}
|
||||
|
||||
var p *opspb.Platform
|
||||
if platform := opt.Platform; platform != nil {
|
||||
if platform != nil {
|
||||
p = &opspb.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
|
||||
+574
-268
File diff suppressed because it is too large
Load Diff
+28
-1
@@ -135,8 +135,9 @@ message ResolveSourceMetaRequest {
|
||||
pb.Platform Platform = 2;
|
||||
string LogName = 3;
|
||||
string ResolveMode = 4;
|
||||
repeated moby.buildkit.v1.sourcepolicy.Policy SourcePolicies = 8;
|
||||
ResolveSourceGitRequest Git = 5;
|
||||
ResolveSourceImageRequest Image = 6;
|
||||
repeated moby.buildkit.v1.sourcepolicy.Policy SourcePolicies = 8;
|
||||
}
|
||||
|
||||
message ResolveSourceMetaResponse {
|
||||
@@ -146,9 +147,23 @@ message ResolveSourceMetaResponse {
|
||||
ResolveSourceHTTPResponse HTTP = 4;
|
||||
}
|
||||
|
||||
message ResolveSourceImageRequest {
|
||||
bool NoConfig = 1;
|
||||
bool AttestationChain = 2;
|
||||
}
|
||||
|
||||
message AttestationChain {
|
||||
string Root = 1;
|
||||
string ImageManifest = 2;
|
||||
string AttestationManifest = 3;
|
||||
repeated string SignatureManifests = 4;
|
||||
map<string, Blob> Blobs = 5;
|
||||
}
|
||||
|
||||
message ResolveSourceImageResponse {
|
||||
string Digest = 1;
|
||||
bytes Config = 2;
|
||||
AttestationChain AttestationChain = 3;
|
||||
}
|
||||
|
||||
message ResolveSourceGitRequest {
|
||||
@@ -348,3 +363,15 @@ message SignalMessage {
|
||||
// are platform dependent.
|
||||
string Name = 1;
|
||||
}
|
||||
|
||||
message Blob {
|
||||
Descriptor descriptor = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
message Descriptor {
|
||||
string media_type = 1;
|
||||
string digest = 2;
|
||||
int64 size = 3;
|
||||
map<string, string> annotations = 5;
|
||||
}
|
||||
+1484
File diff suppressed because it is too large
Load Diff
+15
-1
@@ -6,11 +6,17 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/v2/core/content"
|
||||
"github.com/containerd/containerd/v2/core/remotes"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func FromFetcher(f remotes.Fetcher) content.Provider {
|
||||
type ReferrersProvider interface {
|
||||
content.Provider
|
||||
remotes.ReferrersFetcher
|
||||
}
|
||||
|
||||
func FromFetcher(f remotes.Fetcher) ReferrersProvider {
|
||||
return &fetchedProvider{
|
||||
f: f,
|
||||
}
|
||||
@@ -29,6 +35,14 @@ func (p *fetchedProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor
|
||||
return &readerAt{Reader: rc, Closer: rc, size: desc.Size}, nil
|
||||
}
|
||||
|
||||
func (p *fetchedProvider) FetchReferrers(ctx context.Context, dgst digest.Digest, opts ...remotes.FetchReferrersOpt) ([]ocispecs.Descriptor, error) {
|
||||
refs, ok := p.f.(remotes.ReferrersFetcher)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("fetcher does not support referrers")
|
||||
}
|
||||
return refs.FetchReferrers(ctx, dgst, opts...)
|
||||
}
|
||||
|
||||
type readerAt struct {
|
||||
io.Reader
|
||||
io.Closer
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ func marshalJSON(id []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
// unmarshalJSON inflates trace id from hex string, possibly enclosed in quotes.
|
||||
func unmarshalJSON(dst []byte, src []byte) error {
|
||||
func unmarshalJSON(dst, src []byte) error {
|
||||
if l := len(src); l >= 2 && src[0] == '"' && src[l-1] == '"' {
|
||||
src = src[1 : l-1]
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ func (i *protoInt64) UnmarshalJSON(data []byte) error {
|
||||
// strings or integers.
|
||||
type protoUint64 uint64
|
||||
|
||||
// Int64 returns the protoUint64 as a uint64.
|
||||
// Uint64 returns the protoUint64 as a uint64.
|
||||
func (i *protoUint64) Uint64() uint64 { return uint64(*i) }
|
||||
|
||||
// UnmarshalJSON decodes both strings and integers.
|
||||
|
||||
+43
-27
@@ -10,6 +10,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -151,8 +152,8 @@ func (s Span) MarshalJSON() ([]byte, error) {
|
||||
}{
|
||||
Alias: Alias(s),
|
||||
ParentSpanID: parentSpanId,
|
||||
StartTime: uint64(startT),
|
||||
EndTime: uint64(endT),
|
||||
StartTime: uint64(startT), // nolint:gosec // >0 checked above.
|
||||
EndTime: uint64(endT), // nolint:gosec // >0 checked above.
|
||||
})
|
||||
}
|
||||
|
||||
@@ -201,11 +202,13 @@ func (s *Span) UnmarshalJSON(data []byte) error {
|
||||
case "startTimeUnixNano", "start_time_unix_nano":
|
||||
var val protoUint64
|
||||
err = decoder.Decode(&val)
|
||||
s.StartTime = time.Unix(0, int64(val.Uint64()))
|
||||
v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked.
|
||||
s.StartTime = time.Unix(0, v)
|
||||
case "endTimeUnixNano", "end_time_unix_nano":
|
||||
var val protoUint64
|
||||
err = decoder.Decode(&val)
|
||||
s.EndTime = time.Unix(0, int64(val.Uint64()))
|
||||
v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked.
|
||||
s.EndTime = time.Unix(0, v)
|
||||
case "attributes":
|
||||
err = decoder.Decode(&s.Attrs)
|
||||
case "droppedAttributesCount", "dropped_attributes_count":
|
||||
@@ -248,13 +251,20 @@ func (s *Span) UnmarshalJSON(data []byte) error {
|
||||
type SpanFlags int32
|
||||
|
||||
const (
|
||||
// SpanFlagsTraceFlagsMask is a mask for trace-flags.
|
||||
//
|
||||
// Bits 0-7 are used for trace flags.
|
||||
SpanFlagsTraceFlagsMask SpanFlags = 255
|
||||
// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
|
||||
// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
|
||||
// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
|
||||
// SpanFlagsContextHasIsRemoteMask is a mask for HAS_IS_REMOTE status.
|
||||
//
|
||||
// Bits 8 and 9 are used to indicate that the parent span or link span is
|
||||
// remote. Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
|
||||
SpanFlagsContextHasIsRemoteMask SpanFlags = 256
|
||||
// SpanFlagsContextHasIsRemoteMask indicates the Span is remote.
|
||||
// SpanFlagsContextIsRemoteMask is a mask for IS_REMOTE status.
|
||||
//
|
||||
// Bits 8 and 9 are used to indicate that the parent span or link span is
|
||||
// remote. Bit 9 (`IS_REMOTE`) indicates whether the span or link is
|
||||
// remote.
|
||||
SpanFlagsContextIsRemoteMask SpanFlags = 512
|
||||
)
|
||||
|
||||
@@ -263,26 +273,30 @@ const (
|
||||
type SpanKind int32
|
||||
|
||||
const (
|
||||
// Indicates that the span represents an internal operation within an application,
|
||||
// as opposed to an operation happening at the boundaries. Default value.
|
||||
// SpanKindInternal indicates that the span represents an internal
|
||||
// operation within an application, as opposed to an operation happening at
|
||||
// the boundaries.
|
||||
SpanKindInternal SpanKind = 1
|
||||
// Indicates that the span covers server-side handling of an RPC or other
|
||||
// remote network request.
|
||||
// SpanKindServer indicates that the span covers server-side handling of an
|
||||
// RPC or other remote network request.
|
||||
SpanKindServer SpanKind = 2
|
||||
// Indicates that the span describes a request to some remote service.
|
||||
// SpanKindClient indicates that the span describes a request to some
|
||||
// remote service.
|
||||
SpanKindClient SpanKind = 3
|
||||
// Indicates that the span describes a producer sending a message to a broker.
|
||||
// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
|
||||
// between producer and consumer spans. A PRODUCER span ends when the message was accepted
|
||||
// by the broker while the logical processing of the message might span a much longer time.
|
||||
// SpanKindProducer indicates that the span describes a producer sending a
|
||||
// message to a broker. Unlike SpanKindClient and SpanKindServer, there is
|
||||
// often no direct critical path latency relationship between producer and
|
||||
// consumer spans. A SpanKindProducer span ends when the message was
|
||||
// accepted by the broker while the logical processing of the message might
|
||||
// span a much longer time.
|
||||
SpanKindProducer SpanKind = 4
|
||||
// Indicates that the span describes consumer receiving a message from a broker.
|
||||
// Like the PRODUCER kind, there is often no direct critical path latency relationship
|
||||
// between producer and consumer spans.
|
||||
// SpanKindConsumer indicates that the span describes a consumer receiving
|
||||
// a message from a broker. Like SpanKindProducer, there is often no direct
|
||||
// critical path latency relationship between producer and consumer spans.
|
||||
SpanKindConsumer SpanKind = 5
|
||||
)
|
||||
|
||||
// Event is a time-stamped annotation of the span, consisting of user-supplied
|
||||
// SpanEvent is a time-stamped annotation of the span, consisting of user-supplied
|
||||
// text description and key-value pairs.
|
||||
type SpanEvent struct {
|
||||
// time_unix_nano is the time the event occurred.
|
||||
@@ -312,7 +326,7 @@ func (e SpanEvent) MarshalJSON() ([]byte, error) {
|
||||
Time uint64 `json:"timeUnixNano,omitempty"`
|
||||
}{
|
||||
Alias: Alias(e),
|
||||
Time: uint64(t),
|
||||
Time: uint64(t), //nolint:gosec // >0 checked above
|
||||
})
|
||||
}
|
||||
|
||||
@@ -347,7 +361,8 @@ func (se *SpanEvent) UnmarshalJSON(data []byte) error {
|
||||
case "timeUnixNano", "time_unix_nano":
|
||||
var val protoUint64
|
||||
err = decoder.Decode(&val)
|
||||
se.Time = time.Unix(0, int64(val.Uint64()))
|
||||
v := int64(min(val.Uint64(), math.MaxInt64)) //nolint:gosec // Overflow checked.
|
||||
se.Time = time.Unix(0, v)
|
||||
case "name":
|
||||
err = decoder.Decode(&se.Name)
|
||||
case "attributes":
|
||||
@@ -365,10 +380,11 @@ func (se *SpanEvent) UnmarshalJSON(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// A pointer from the current span to another span in the same trace or in a
|
||||
// different trace. For example, this can be used in batching operations,
|
||||
// where a single batch handler processes multiple requests from different
|
||||
// traces or when the handler receives a request from a different project.
|
||||
// SpanLink is a reference from the current span to another span in the same
|
||||
// trace or in a different trace. For example, this can be used in batching
|
||||
// operations, where a single batch handler processes multiple requests from
|
||||
// different traces or when the handler receives a request from a different
|
||||
// project.
|
||||
type SpanLink struct {
|
||||
// A unique identifier of a trace that this linked span is part of. The ID is a
|
||||
// 16-byte array.
|
||||
|
||||
+6
-4
@@ -3,17 +3,19 @@
|
||||
|
||||
package telemetry
|
||||
|
||||
// StatusCode is the status of a Span.
|
||||
//
|
||||
// For the semantics of status codes see
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
|
||||
type StatusCode int32
|
||||
|
||||
const (
|
||||
// The default status.
|
||||
// StatusCodeUnset is the default status.
|
||||
StatusCodeUnset StatusCode = 0
|
||||
// The Span has been validated by an Application developer or Operator to
|
||||
// have completed successfully.
|
||||
// StatusCodeOK is used when the Span has been validated by an Application
|
||||
// developer or Operator to have completed successfully.
|
||||
StatusCodeOK StatusCode = 1
|
||||
// The Span contains an error.
|
||||
// StatusCodeError is used when the Span contains an error.
|
||||
StatusCodeError StatusCode = 2
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ func (td *Traces) UnmarshalJSON(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// A collection of ScopeSpans from a Resource.
|
||||
// ResourceSpans is a collection of ScopeSpans from a Resource.
|
||||
type ResourceSpans struct {
|
||||
// The resource for the spans in this message.
|
||||
// If this field is not set then no resource info is known.
|
||||
@@ -128,7 +128,7 @@ func (rs *ResourceSpans) UnmarshalJSON(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// A collection of Spans produced by an InstrumentationScope.
|
||||
// ScopeSpans is a collection of Spans produced by an InstrumentationScope.
|
||||
type ScopeSpans struct {
|
||||
// The instrumentation scope information for the spans in this message.
|
||||
// Semantically when InstrumentationScope isn't set, it is equivalent with
|
||||
|
||||
+6
-8
@@ -1,8 +1,6 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:generate stringer -type=ValueKind -trimprefix=ValueKind
|
||||
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
@@ -23,7 +21,7 @@ import (
|
||||
// A zero value is valid and represents an empty value.
|
||||
type Value struct {
|
||||
// Ensure forward compatibility by explicitly making this not comparable.
|
||||
noCmp [0]func() //nolint: unused // This is indeed used.
|
||||
noCmp [0]func() //nolint:unused // This is indeed used.
|
||||
|
||||
// num holds the value for Int64, Float64, and Bool. It holds the length
|
||||
// for String, Bytes, Slice, Map.
|
||||
@@ -92,7 +90,7 @@ func IntValue(v int) Value { return Int64Value(int64(v)) }
|
||||
|
||||
// Int64Value returns a [Value] for an int64.
|
||||
func Int64Value(v int64) Value {
|
||||
return Value{num: uint64(v), any: ValueKindInt64}
|
||||
return Value{num: uint64(v), any: ValueKindInt64} //nolint:gosec // Raw value conv.
|
||||
}
|
||||
|
||||
// Float64Value returns a [Value] for a float64.
|
||||
@@ -164,7 +162,7 @@ func (v Value) AsInt64() int64 {
|
||||
// this will return garbage.
|
||||
func (v Value) asInt64() int64 {
|
||||
// Assumes v.num was a valid int64 (overflow not checked).
|
||||
return int64(v.num) // nolint: gosec
|
||||
return int64(v.num) //nolint:gosec // Bounded.
|
||||
}
|
||||
|
||||
// AsBool returns the value held by v as a bool.
|
||||
@@ -309,13 +307,13 @@ func (v Value) String() string {
|
||||
return v.asString()
|
||||
case ValueKindInt64:
|
||||
// Assumes v.num was a valid int64 (overflow not checked).
|
||||
return strconv.FormatInt(int64(v.num), 10) // nolint: gosec
|
||||
return strconv.FormatInt(int64(v.num), 10) //nolint:gosec // Bounded.
|
||||
case ValueKindFloat64:
|
||||
return strconv.FormatFloat(v.asFloat64(), 'g', -1, 64)
|
||||
case ValueKindBool:
|
||||
return strconv.FormatBool(v.asBool())
|
||||
case ValueKindBytes:
|
||||
return fmt.Sprint(v.asBytes())
|
||||
return string(v.asBytes())
|
||||
case ValueKindMap:
|
||||
return fmt.Sprint(v.asMap())
|
||||
case ValueKindSlice:
|
||||
@@ -343,7 +341,7 @@ func (v *Value) MarshalJSON() ([]byte, error) {
|
||||
case ValueKindInt64:
|
||||
return json.Marshal(struct {
|
||||
Value string `json:"intValue"`
|
||||
}{strconv.FormatInt(int64(v.num), 10)})
|
||||
}{strconv.FormatInt(int64(v.num), 10)}) //nolint:gosec // Raw value conv.
|
||||
case ValueKindFloat64:
|
||||
return json.Marshal(struct {
|
||||
Value float64 `json:"doubleValue"`
|
||||
|
||||
+20
-5
@@ -6,6 +6,7 @@ package sdk
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -16,7 +17,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
|
||||
@@ -85,7 +86,12 @@ func (s *span) SetAttributes(attrs ...attribute.KeyValue) {
|
||||
limit := maxSpan.Attrs
|
||||
if limit == 0 {
|
||||
// No attributes allowed.
|
||||
s.span.DroppedAttrs += uint32(len(attrs))
|
||||
n := int64(len(attrs))
|
||||
if n > 0 {
|
||||
s.span.DroppedAttrs += uint32( //nolint:gosec // Bounds checked.
|
||||
min(n, math.MaxUint32),
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -121,8 +127,13 @@ func (s *span) SetAttributes(attrs ...attribute.KeyValue) {
|
||||
// convCappedAttrs converts up to limit attrs into a []telemetry.Attr. The
|
||||
// number of dropped attributes is also returned.
|
||||
func convCappedAttrs(limit int, attrs []attribute.KeyValue) ([]telemetry.Attr, uint32) {
|
||||
n := len(attrs)
|
||||
if limit == 0 {
|
||||
return nil, uint32(len(attrs))
|
||||
var out uint32
|
||||
if n > 0 {
|
||||
out = uint32(min(int64(n), math.MaxUint32)) //nolint:gosec // Bounds checked.
|
||||
}
|
||||
return nil, out
|
||||
}
|
||||
|
||||
if limit < 0 {
|
||||
@@ -130,8 +141,12 @@ func convCappedAttrs(limit int, attrs []attribute.KeyValue) ([]telemetry.Attr, u
|
||||
return convAttrs(attrs), 0
|
||||
}
|
||||
|
||||
limit = min(len(attrs), limit)
|
||||
return convAttrs(attrs[:limit]), uint32(len(attrs) - limit)
|
||||
if n < 0 {
|
||||
n = 0
|
||||
}
|
||||
|
||||
limit = min(n, limit)
|
||||
return convAttrs(attrs[:limit]), uint32(n - limit) //nolint:gosec // Bounds checked.
|
||||
}
|
||||
|
||||
func convAttrs(attrs []attribute.KeyValue) []telemetry.Attr {
|
||||
|
||||
+23
-6
@@ -5,6 +5,7 @@ package sdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
@@ -21,15 +22,20 @@ type tracer struct {
|
||||
|
||||
var _ trace.Tracer = tracer{}
|
||||
|
||||
func (t tracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||
var psc trace.SpanContext
|
||||
func (t tracer) Start(
|
||||
ctx context.Context,
|
||||
name string,
|
||||
opts ...trace.SpanStartOption,
|
||||
) (context.Context, trace.Span) {
|
||||
var psc, sc trace.SpanContext
|
||||
sampled := true
|
||||
span := new(span)
|
||||
|
||||
// Ask eBPF for sampling decision and span context info.
|
||||
t.start(ctx, span, &psc, &sampled, &span.spanContext)
|
||||
t.start(ctx, span, &psc, &sampled, &sc)
|
||||
|
||||
span.sampled.Store(sampled)
|
||||
span.spanContext = sc
|
||||
|
||||
ctx = trace.ContextWithSpan(ctx, span)
|
||||
|
||||
@@ -58,7 +64,13 @@ func (t *tracer) start(
|
||||
// start is used for testing.
|
||||
var start = func(context.Context, *span, *trace.SpanContext, *bool, *trace.SpanContext) {}
|
||||
|
||||
func (t tracer) traces(name string, cfg trace.SpanConfig, sc, psc trace.SpanContext) (*telemetry.Traces, *telemetry.Span) {
|
||||
var intToUint32Bound = min(math.MaxInt, math.MaxUint32)
|
||||
|
||||
func (t tracer) traces(
|
||||
name string,
|
||||
cfg trace.SpanConfig,
|
||||
sc, psc trace.SpanContext,
|
||||
) (*telemetry.Traces, *telemetry.Span) {
|
||||
span := &telemetry.Span{
|
||||
TraceID: telemetry.TraceID(sc.TraceID()),
|
||||
SpanID: telemetry.SpanID(sc.SpanID()),
|
||||
@@ -73,11 +85,16 @@ func (t tracer) traces(name string, cfg trace.SpanConfig, sc, psc trace.SpanCont
|
||||
|
||||
links := cfg.Links()
|
||||
if limit := maxSpan.Links; limit == 0 {
|
||||
span.DroppedLinks = uint32(len(links))
|
||||
n := len(links)
|
||||
if n > 0 {
|
||||
bounded := max(min(n, intToUint32Bound), 0)
|
||||
span.DroppedLinks = uint32(bounded) //nolint:gosec // Bounds checked.
|
||||
}
|
||||
} else {
|
||||
if limit > 0 {
|
||||
n := max(len(links)-limit, 0)
|
||||
span.DroppedLinks = uint32(n)
|
||||
bounded := min(n, intToUint32Bound)
|
||||
span.DroppedLinks = uint32(bounded) //nolint:gosec // Bounds checked.
|
||||
links = links[n:]
|
||||
}
|
||||
span.Links = convLinks(links)
|
||||
|
||||
Vendored
+3
-3
@@ -443,7 +443,7 @@ github.com/mitchellh/go-wordwrap
|
||||
# github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
## explicit; go 1.14
|
||||
github.com/mitchellh/hashstructure/v2
|
||||
# github.com/moby/buildkit v0.25.0-rc1.0.20251105204500-e18be4182830
|
||||
# github.com/moby/buildkit v0.26.0-rc1
|
||||
## explicit; go 1.24.3
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
@@ -699,8 +699,8 @@ github.com/zclconf/go-cty/cty/function/stdlib
|
||||
github.com/zclconf/go-cty/cty/gocty
|
||||
github.com/zclconf/go-cty/cty/json
|
||||
github.com/zclconf/go-cty/cty/set
|
||||
# go.opentelemetry.io/auto/sdk v1.1.0
|
||||
## explicit; go 1.22.0
|
||||
# go.opentelemetry.io/auto/sdk v1.2.1
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/auto/sdk
|
||||
go.opentelemetry.io/auto/sdk/internal/telemetry
|
||||
# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0
|
||||
|
||||
Reference in New Issue
Block a user