...

Source file src/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/data.go

Documentation: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest

     1  // Code created by gotmpl. DO NOT MODIFY.
     2  // source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl
     3  
     4  // Copyright The OpenTelemetry Authors
     5  //
     6  // Licensed under the Apache License, Version 2.0 (the "License");
     7  // you may not use this file except in compliance with the License.
     8  // You may obtain a copy of the License at
     9  //
    10  //     http://www.apache.org/licenses/LICENSE-2.0
    11  //
    12  // Unless required by applicable law or agreed to in writing, software
    13  // distributed under the License is distributed on an "AS IS" BASIS,
    14  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  // See the License for the specific language governing permissions and
    16  // limitations under the License.
    17  
    18  package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest"
    19  
    20  import (
    21  	"time"
    22  
    23  	"go.opentelemetry.io/otel/attribute"
    24  	"go.opentelemetry.io/otel/codes"
    25  	"go.opentelemetry.io/otel/sdk/instrumentation"
    26  	"go.opentelemetry.io/otel/sdk/resource"
    27  	tracesdk "go.opentelemetry.io/otel/sdk/trace"
    28  	"go.opentelemetry.io/otel/sdk/trace/tracetest"
    29  	"go.opentelemetry.io/otel/trace"
    30  )
    31  
    32  // SingleReadOnlySpan returns a one-element slice with a read-only span. It
    33  // may be useful for testing driver's trace export.
    34  func SingleReadOnlySpan() []tracesdk.ReadOnlySpan {
    35  	return tracetest.SpanStubs{
    36  		{
    37  			SpanContext: trace.NewSpanContext(trace.SpanContextConfig{
    38  				TraceID:    trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9},
    39  				SpanID:     trace.SpanID{3, 4, 5, 6, 7, 8, 9, 0},
    40  				TraceFlags: trace.FlagsSampled,
    41  			}),
    42  			Parent: trace.NewSpanContext(trace.SpanContextConfig{
    43  				TraceID:    trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9},
    44  				SpanID:     trace.SpanID{1, 2, 3, 4, 5, 6, 7, 8},
    45  				TraceFlags: trace.FlagsSampled,
    46  			}),
    47  			SpanKind:          trace.SpanKindInternal,
    48  			Name:              "foo",
    49  			StartTime:         time.Date(2020, time.December, 8, 20, 23, 0, 0, time.UTC),
    50  			EndTime:           time.Date(2020, time.December, 0, 20, 24, 0, 0, time.UTC),
    51  			Attributes:        []attribute.KeyValue{},
    52  			Events:            []tracesdk.Event{},
    53  			Links:             []tracesdk.Link{},
    54  			Status:            tracesdk.Status{Code: codes.Ok},
    55  			DroppedAttributes: 0,
    56  			DroppedEvents:     0,
    57  			DroppedLinks:      0,
    58  			ChildSpanCount:    0,
    59  			Resource:          resource.NewSchemaless(attribute.String("a", "b")),
    60  			InstrumentationLibrary: instrumentation.Library{
    61  				Name:    "bar",
    62  				Version: "0.0.0",
    63  			},
    64  		},
    65  	}.Snapshots()
    66  }
    67  

View as plain text