vendor: update buildkit to 862b22d7
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>pull/1467/head
parent
0e293a4ec9
commit
12ec931237
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,125 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
controlapi "github.com/moby/buildkit/api/services/control"
|
||||||
|
)
|
||||||
|
|
||||||
|
var emptyLogVertexSize int
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
emptyLogVertex := controlapi.VertexLog{}
|
||||||
|
emptyLogVertexSize = emptyLogVertex.Size()
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus {
|
||||||
|
s := &SolveStatus{}
|
||||||
|
for _, v := range resp.Vertexes {
|
||||||
|
s.Vertexes = append(s.Vertexes, &Vertex{
|
||||||
|
Digest: v.Digest,
|
||||||
|
Inputs: v.Inputs,
|
||||||
|
Name: v.Name,
|
||||||
|
Started: v.Started,
|
||||||
|
Completed: v.Completed,
|
||||||
|
Error: v.Error,
|
||||||
|
Cached: v.Cached,
|
||||||
|
ProgressGroup: v.ProgressGroup,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, v := range resp.Statuses {
|
||||||
|
s.Statuses = append(s.Statuses, &VertexStatus{
|
||||||
|
ID: v.ID,
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Name: v.Name,
|
||||||
|
Total: v.Total,
|
||||||
|
Current: v.Current,
|
||||||
|
Timestamp: v.Timestamp,
|
||||||
|
Started: v.Started,
|
||||||
|
Completed: v.Completed,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, v := range resp.Logs {
|
||||||
|
s.Logs = append(s.Logs, &VertexLog{
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Stream: int(v.Stream),
|
||||||
|
Data: v.Msg,
|
||||||
|
Timestamp: v.Timestamp,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, v := range resp.Warnings {
|
||||||
|
s.Warnings = append(s.Warnings, &VertexWarning{
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Level: int(v.Level),
|
||||||
|
Short: v.Short,
|
||||||
|
Detail: v.Detail,
|
||||||
|
URL: v.Url,
|
||||||
|
SourceInfo: v.Info,
|
||||||
|
Range: v.Ranges,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse) {
|
||||||
|
logSize := 0
|
||||||
|
for {
|
||||||
|
retry := false
|
||||||
|
sr := controlapi.StatusResponse{}
|
||||||
|
for _, v := range ss.Vertexes {
|
||||||
|
sr.Vertexes = append(sr.Vertexes, &controlapi.Vertex{
|
||||||
|
Digest: v.Digest,
|
||||||
|
Inputs: v.Inputs,
|
||||||
|
Name: v.Name,
|
||||||
|
Started: v.Started,
|
||||||
|
Completed: v.Completed,
|
||||||
|
Error: v.Error,
|
||||||
|
Cached: v.Cached,
|
||||||
|
ProgressGroup: v.ProgressGroup,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, v := range ss.Statuses {
|
||||||
|
sr.Statuses = append(sr.Statuses, &controlapi.VertexStatus{
|
||||||
|
ID: v.ID,
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Name: v.Name,
|
||||||
|
Current: v.Current,
|
||||||
|
Total: v.Total,
|
||||||
|
Timestamp: v.Timestamp,
|
||||||
|
Started: v.Started,
|
||||||
|
Completed: v.Completed,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for i, v := range ss.Logs {
|
||||||
|
sr.Logs = append(sr.Logs, &controlapi.VertexLog{
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Stream: int64(v.Stream),
|
||||||
|
Msg: v.Data,
|
||||||
|
Timestamp: v.Timestamp,
|
||||||
|
})
|
||||||
|
logSize += len(v.Data) + emptyLogVertexSize
|
||||||
|
// avoid logs growing big and split apart if they do
|
||||||
|
if logSize > 1024*1024 {
|
||||||
|
ss.Vertexes = nil
|
||||||
|
ss.Statuses = nil
|
||||||
|
ss.Logs = ss.Logs[i+1:]
|
||||||
|
retry = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range ss.Warnings {
|
||||||
|
sr.Warnings = append(sr.Warnings, &controlapi.VertexWarning{
|
||||||
|
Vertex: v.Vertex,
|
||||||
|
Level: int64(v.Level),
|
||||||
|
Short: v.Short,
|
||||||
|
Detail: v.Detail,
|
||||||
|
Info: v.SourceInfo,
|
||||||
|
Ranges: v.Range,
|
||||||
|
Url: v.URL,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
out = append(out, &sr)
|
||||||
|
if !retry {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
package detect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TraceRecorder struct {
|
||||||
|
sdktrace.SpanExporter
|
||||||
|
|
||||||
|
mu sync.Mutex
|
||||||
|
m map[trace.TraceID]*stubs
|
||||||
|
listeners map[trace.TraceID]int
|
||||||
|
flush func(context.Context) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type stubs struct {
|
||||||
|
spans []tracetest.SpanStub
|
||||||
|
last time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTraceRecorder() *TraceRecorder {
|
||||||
|
tr := &TraceRecorder{
|
||||||
|
m: map[trace.TraceID]*stubs{},
|
||||||
|
listeners: map[trace.TraceID]int{},
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
t := time.NewTimer(60 * time.Second)
|
||||||
|
for {
|
||||||
|
<-t.C
|
||||||
|
tr.gc()
|
||||||
|
t.Reset(50 * time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return tr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *TraceRecorder) Record(traceID trace.TraceID) func() []tracetest.SpanStub {
|
||||||
|
if r.flush != nil {
|
||||||
|
r.flush(context.TODO())
|
||||||
|
}
|
||||||
|
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
|
r.listeners[traceID]++
|
||||||
|
var once sync.Once
|
||||||
|
var spans []tracetest.SpanStub
|
||||||
|
return func() []tracetest.SpanStub {
|
||||||
|
once.Do(func() {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
|
if v, ok := r.m[traceID]; ok {
|
||||||
|
spans = v.spans
|
||||||
|
}
|
||||||
|
r.listeners[traceID]--
|
||||||
|
if r.listeners[traceID] == 0 {
|
||||||
|
delete(r.listeners, traceID)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return spans
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *TraceRecorder) gc() {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
for k, s := range r.m {
|
||||||
|
if _, ok := r.listeners[k]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if now.Sub(s.last) > 60*time.Second {
|
||||||
|
delete(r.m, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *TraceRecorder) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error {
|
||||||
|
r.mu.Lock()
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
for _, s := range spans {
|
||||||
|
ss := tracetest.SpanStubFromReadOnlySpan(s)
|
||||||
|
v, ok := r.m[ss.SpanContext.TraceID()]
|
||||||
|
if !ok {
|
||||||
|
v = &stubs{}
|
||||||
|
r.m[s.SpanContext().TraceID()] = v
|
||||||
|
}
|
||||||
|
v.last = now
|
||||||
|
v.spans = append(v.spans, ss)
|
||||||
|
}
|
||||||
|
r.mu.Unlock()
|
||||||
|
|
||||||
|
if r.SpanExporter == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return r.SpanExporter.ExportSpans(ctx, spans)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *TraceRecorder) Shutdown(ctx context.Context) error {
|
||||||
|
if r.SpanExporter == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return r.SpanExporter.Shutdown(ctx)
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
// Copyright The OpenTelemetry 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.
|
||||||
|
|
||||||
|
// Package tracetest is a testing helper package for the SDK. User can
|
||||||
|
// configure no-op or in-memory exporters to verify different SDK behaviors or
|
||||||
|
// custom instrumentation.
|
||||||
|
package tracetest // import "go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ trace.SpanExporter = (*NoopExporter)(nil)
|
||||||
|
|
||||||
|
// NewNoopExporter returns a new no-op exporter.
|
||||||
|
func NewNoopExporter() *NoopExporter {
|
||||||
|
return new(NoopExporter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NoopExporter is an exporter that drops all received spans and performs no
|
||||||
|
// action.
|
||||||
|
type NoopExporter struct{}
|
||||||
|
|
||||||
|
// ExportSpans handles export of spans by dropping them.
|
||||||
|
func (nsb *NoopExporter) ExportSpans(context.Context, []trace.ReadOnlySpan) error { return nil }
|
||||||
|
|
||||||
|
// Shutdown stops the exporter by doing nothing.
|
||||||
|
func (nsb *NoopExporter) Shutdown(context.Context) error { return nil }
|
||||||
|
|
||||||
|
var _ trace.SpanExporter = (*InMemoryExporter)(nil)
|
||||||
|
|
||||||
|
// NewInMemoryExporter returns a new InMemoryExporter.
|
||||||
|
func NewInMemoryExporter() *InMemoryExporter {
|
||||||
|
return new(InMemoryExporter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InMemoryExporter is an exporter that stores all received spans in-memory.
|
||||||
|
type InMemoryExporter struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
ss SpanStubs
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportSpans handles export of spans by storing them in memory.
|
||||||
|
func (imsb *InMemoryExporter) ExportSpans(_ context.Context, spans []trace.ReadOnlySpan) error {
|
||||||
|
imsb.mu.Lock()
|
||||||
|
defer imsb.mu.Unlock()
|
||||||
|
imsb.ss = append(imsb.ss, SpanStubsFromReadOnlySpans(spans)...)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shutdown stops the exporter by clearing spans held in memory.
|
||||||
|
func (imsb *InMemoryExporter) Shutdown(context.Context) error {
|
||||||
|
imsb.Reset()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the current in-memory storage.
|
||||||
|
func (imsb *InMemoryExporter) Reset() {
|
||||||
|
imsb.mu.Lock()
|
||||||
|
defer imsb.mu.Unlock()
|
||||||
|
imsb.ss = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpans returns the current in-memory stored spans.
|
||||||
|
func (imsb *InMemoryExporter) GetSpans() SpanStubs {
|
||||||
|
imsb.mu.Lock()
|
||||||
|
defer imsb.mu.Unlock()
|
||||||
|
ret := make(SpanStubs, len(imsb.ss))
|
||||||
|
copy(ret, imsb.ss)
|
||||||
|
return ret
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
// Copyright The OpenTelemetry 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.
|
||||||
|
|
||||||
|
package tracetest // import "go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SpanRecorder records started and ended spans.
|
||||||
|
type SpanRecorder struct {
|
||||||
|
startedMu sync.RWMutex
|
||||||
|
started []sdktrace.ReadWriteSpan
|
||||||
|
|
||||||
|
endedMu sync.RWMutex
|
||||||
|
ended []sdktrace.ReadOnlySpan
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ sdktrace.SpanProcessor = (*SpanRecorder)(nil)
|
||||||
|
|
||||||
|
func NewSpanRecorder() *SpanRecorder {
|
||||||
|
return new(SpanRecorder)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnStart records started spans.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) OnStart(_ context.Context, s sdktrace.ReadWriteSpan) {
|
||||||
|
sr.startedMu.Lock()
|
||||||
|
defer sr.startedMu.Unlock()
|
||||||
|
sr.started = append(sr.started, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnEnd records completed spans.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) OnEnd(s sdktrace.ReadOnlySpan) {
|
||||||
|
sr.endedMu.Lock()
|
||||||
|
defer sr.endedMu.Unlock()
|
||||||
|
sr.ended = append(sr.ended, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shutdown does nothing.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) Shutdown(context.Context) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForceFlush does nothing.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) ForceFlush(context.Context) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Started returns a copy of all started spans that have been recorded.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) Started() []sdktrace.ReadWriteSpan {
|
||||||
|
sr.startedMu.RLock()
|
||||||
|
defer sr.startedMu.RUnlock()
|
||||||
|
dst := make([]sdktrace.ReadWriteSpan, len(sr.started))
|
||||||
|
copy(dst, sr.started)
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ended returns a copy of all ended spans that have been recorded.
|
||||||
|
//
|
||||||
|
// This method is safe to be called concurrently.
|
||||||
|
func (sr *SpanRecorder) Ended() []sdktrace.ReadOnlySpan {
|
||||||
|
sr.endedMu.RLock()
|
||||||
|
defer sr.endedMu.RUnlock()
|
||||||
|
dst := make([]sdktrace.ReadOnlySpan, len(sr.ended))
|
||||||
|
copy(dst, sr.ended)
|
||||||
|
return dst
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
// Copyright The OpenTelemetry 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.
|
||||||
|
|
||||||
|
package tracetest // import "go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||||
|
"go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SpanStubs []SpanStub
|
||||||
|
|
||||||
|
// SpanStubsFromReadOnlySpans returns SpanStubs populated from ro.
|
||||||
|
func SpanStubsFromReadOnlySpans(ro []tracesdk.ReadOnlySpan) SpanStubs {
|
||||||
|
if len(ro) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
s := make(SpanStubs, 0, len(ro))
|
||||||
|
for _, r := range ro {
|
||||||
|
s = append(s, SpanStubFromReadOnlySpan(r))
|
||||||
|
}
|
||||||
|
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snapshots returns s as a slice of ReadOnlySpans.
|
||||||
|
func (s SpanStubs) Snapshots() []tracesdk.ReadOnlySpan {
|
||||||
|
if len(s) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ro := make([]tracesdk.ReadOnlySpan, len(s))
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
ro[i] = s[i].Snapshot()
|
||||||
|
}
|
||||||
|
return ro
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpanStub is a stand-in for a Span.
|
||||||
|
type SpanStub struct {
|
||||||
|
Name string
|
||||||
|
SpanContext trace.SpanContext
|
||||||
|
Parent trace.SpanContext
|
||||||
|
SpanKind trace.SpanKind
|
||||||
|
StartTime time.Time
|
||||||
|
EndTime time.Time
|
||||||
|
Attributes []attribute.KeyValue
|
||||||
|
Events []tracesdk.Event
|
||||||
|
Links []tracesdk.Link
|
||||||
|
Status tracesdk.Status
|
||||||
|
DroppedAttributes int
|
||||||
|
DroppedEvents int
|
||||||
|
DroppedLinks int
|
||||||
|
ChildSpanCount int
|
||||||
|
Resource *resource.Resource
|
||||||
|
InstrumentationLibrary instrumentation.Library
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpanStubFromReadOnlySpan returns a SpanStub populated from ro.
|
||||||
|
func SpanStubFromReadOnlySpan(ro tracesdk.ReadOnlySpan) SpanStub {
|
||||||
|
if ro == nil {
|
||||||
|
return SpanStub{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SpanStub{
|
||||||
|
Name: ro.Name(),
|
||||||
|
SpanContext: ro.SpanContext(),
|
||||||
|
Parent: ro.Parent(),
|
||||||
|
SpanKind: ro.SpanKind(),
|
||||||
|
StartTime: ro.StartTime(),
|
||||||
|
EndTime: ro.EndTime(),
|
||||||
|
Attributes: ro.Attributes(),
|
||||||
|
Events: ro.Events(),
|
||||||
|
Links: ro.Links(),
|
||||||
|
Status: ro.Status(),
|
||||||
|
DroppedAttributes: ro.DroppedAttributes(),
|
||||||
|
DroppedEvents: ro.DroppedEvents(),
|
||||||
|
DroppedLinks: ro.DroppedLinks(),
|
||||||
|
ChildSpanCount: ro.ChildSpanCount(),
|
||||||
|
Resource: ro.Resource(),
|
||||||
|
InstrumentationLibrary: ro.InstrumentationLibrary(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snapshot returns a read-only copy of the SpanStub.
|
||||||
|
func (s SpanStub) Snapshot() tracesdk.ReadOnlySpan {
|
||||||
|
return spanSnapshot{
|
||||||
|
name: s.Name,
|
||||||
|
spanContext: s.SpanContext,
|
||||||
|
parent: s.Parent,
|
||||||
|
spanKind: s.SpanKind,
|
||||||
|
startTime: s.StartTime,
|
||||||
|
endTime: s.EndTime,
|
||||||
|
attributes: s.Attributes,
|
||||||
|
events: s.Events,
|
||||||
|
links: s.Links,
|
||||||
|
status: s.Status,
|
||||||
|
droppedAttributes: s.DroppedAttributes,
|
||||||
|
droppedEvents: s.DroppedEvents,
|
||||||
|
droppedLinks: s.DroppedLinks,
|
||||||
|
childSpanCount: s.ChildSpanCount,
|
||||||
|
resource: s.Resource,
|
||||||
|
instrumentationLibrary: s.InstrumentationLibrary,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type spanSnapshot struct {
|
||||||
|
// Embed the interface to implement the private method.
|
||||||
|
tracesdk.ReadOnlySpan
|
||||||
|
|
||||||
|
name string
|
||||||
|
spanContext trace.SpanContext
|
||||||
|
parent trace.SpanContext
|
||||||
|
spanKind trace.SpanKind
|
||||||
|
startTime time.Time
|
||||||
|
endTime time.Time
|
||||||
|
attributes []attribute.KeyValue
|
||||||
|
events []tracesdk.Event
|
||||||
|
links []tracesdk.Link
|
||||||
|
status tracesdk.Status
|
||||||
|
droppedAttributes int
|
||||||
|
droppedEvents int
|
||||||
|
droppedLinks int
|
||||||
|
childSpanCount int
|
||||||
|
resource *resource.Resource
|
||||||
|
instrumentationLibrary instrumentation.Library
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s spanSnapshot) Name() string { return s.name }
|
||||||
|
func (s spanSnapshot) SpanContext() trace.SpanContext { return s.spanContext }
|
||||||
|
func (s spanSnapshot) Parent() trace.SpanContext { return s.parent }
|
||||||
|
func (s spanSnapshot) SpanKind() trace.SpanKind { return s.spanKind }
|
||||||
|
func (s spanSnapshot) StartTime() time.Time { return s.startTime }
|
||||||
|
func (s spanSnapshot) EndTime() time.Time { return s.endTime }
|
||||||
|
func (s spanSnapshot) Attributes() []attribute.KeyValue { return s.attributes }
|
||||||
|
func (s spanSnapshot) Links() []tracesdk.Link { return s.links }
|
||||||
|
func (s spanSnapshot) Events() []tracesdk.Event { return s.events }
|
||||||
|
func (s spanSnapshot) Status() tracesdk.Status { return s.status }
|
||||||
|
func (s spanSnapshot) DroppedAttributes() int { return s.droppedAttributes }
|
||||||
|
func (s spanSnapshot) DroppedLinks() int { return s.droppedLinks }
|
||||||
|
func (s spanSnapshot) DroppedEvents() int { return s.droppedEvents }
|
||||||
|
func (s spanSnapshot) ChildSpanCount() int { return s.childSpanCount }
|
||||||
|
func (s spanSnapshot) Resource() *resource.Resource { return s.resource }
|
||||||
|
func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library {
|
||||||
|
return s.instrumentationLibrary
|
||||||
|
}
|
Loading…
Reference in New Issue