You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-08-10 22:31:50 +02:00
chore: enable unused-receiver rule from revive (#7130)
#### Description Enable and fixes [unused-receiver](https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver) rule from revive Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -181,6 +181,7 @@ linters:
|
||||
- fmt.Printf
|
||||
- fmt.Println
|
||||
- name: unused-parameter
|
||||
- name: unused-receiver
|
||||
- name: unnecessary-stmt
|
||||
- name: use-any
|
||||
- name: useless-break
|
||||
|
@@ -53,12 +53,12 @@ func (o *Tracer) StartSpanWithRemoteParent(
|
||||
}
|
||||
|
||||
// FromContext returns the Span stored in a context.
|
||||
func (o *Tracer) FromContext(ctx context.Context) *octrace.Span {
|
||||
func (*Tracer) FromContext(ctx context.Context) *octrace.Span {
|
||||
return NewSpan(trace.SpanFromContext(ctx))
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Span attached.
|
||||
func (o *Tracer) NewContext(parent context.Context, s *octrace.Span) context.Context {
|
||||
func (*Tracer) NewContext(parent context.Context, s *octrace.Span) context.Context {
|
||||
if otSpan, ok := s.Internal().(*Span); ok {
|
||||
return trace.ContextWithSpan(parent, otSpan.otelSpan)
|
||||
}
|
||||
|
@@ -139,7 +139,7 @@ type differentSpan struct {
|
||||
octrace.SpanInterface
|
||||
}
|
||||
|
||||
func (s *differentSpan) String() string { return "testing span" }
|
||||
func (*differentSpan) String() string { return "testing span" }
|
||||
|
||||
func TestTracerNewContextErrors(t *testing.T) {
|
||||
h, restore := withHandler()
|
||||
|
@@ -832,12 +832,12 @@ func newTextMapWrapperForInject(carrier any) (*textMapWrapper, error) {
|
||||
|
||||
type textMapWriter struct{}
|
||||
|
||||
func (t *textMapWriter) Set(string, string) {
|
||||
func (*textMapWriter) Set(string, string) {
|
||||
// maybe print a warning log.
|
||||
}
|
||||
|
||||
type textMapReader struct{}
|
||||
|
||||
func (t *textMapReader) ForeachKey(func(string, string) error) error {
|
||||
func (*textMapReader) ForeachKey(func(string, string) error) error {
|
||||
return nil // maybe print a warning log.
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ func newTestOnlyTextMapReader() *testOnlyTextMapReader {
|
||||
return &testOnlyTextMapReader{}
|
||||
}
|
||||
|
||||
func (t *testOnlyTextMapReader) ForeachKey(handler func(key, val string) error) error {
|
||||
func (*testOnlyTextMapReader) ForeachKey(handler func(key, val string) error) error {
|
||||
_ = handler("key1", "val1")
|
||||
_ = handler("key2", "val2")
|
||||
|
||||
@@ -134,7 +134,7 @@ var (
|
||||
|
||||
type testTextMapPropagator struct{}
|
||||
|
||||
func (t testTextMapPropagator) Inject(_ context.Context, carrier propagation.TextMapCarrier) {
|
||||
func (testTextMapPropagator) Inject(_ context.Context, carrier propagation.TextMapCarrier) {
|
||||
carrier.Set(testHeader, traceID.String()+":"+spanID.String())
|
||||
|
||||
// Test for panic
|
||||
@@ -142,7 +142,7 @@ func (t testTextMapPropagator) Inject(_ context.Context, carrier propagation.Tex
|
||||
_ = carrier.Keys()
|
||||
}
|
||||
|
||||
func (t testTextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
|
||||
func (testTextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
|
||||
traces := carrier.Get(testHeader)
|
||||
|
||||
str := strings.Split(traces, ":")
|
||||
@@ -179,7 +179,7 @@ func (t testTextMapPropagator) Extract(ctx context.Context, carrier propagation.
|
||||
return trace.ContextWithRemoteSpanContext(ctx, sc)
|
||||
}
|
||||
|
||||
func (t testTextMapPropagator) Fields() []string {
|
||||
func (testTextMapPropagator) Fields() []string {
|
||||
return []string{"test"}
|
||||
}
|
||||
|
||||
|
@@ -145,7 +145,7 @@ func (st *simpleTest) runOTOtelOT(t *testing.T, ctx context.Context) {
|
||||
runOTOtelOT(t, ctx, "simple", st.noop)
|
||||
}
|
||||
|
||||
func (st *simpleTest) noop(_ *testing.T, ctx context.Context) context.Context {
|
||||
func (*simpleTest) noop(_ *testing.T, ctx context.Context) context.Context {
|
||||
return ctx
|
||||
}
|
||||
|
||||
|
@@ -132,7 +132,7 @@ func (t *mockTracer) getParentSpanID(ctx context.Context, config *trace.SpanConf
|
||||
return trace.SpanID{}
|
||||
}
|
||||
|
||||
func (t *mockTracer) getParentSpanContext(ctx context.Context, config *trace.SpanConfig) trace.SpanContext {
|
||||
func (*mockTracer) getParentSpanContext(ctx context.Context, config *trace.SpanConfig) trace.SpanContext {
|
||||
if !config.NewRoot() {
|
||||
return trace.SpanContextFromContext(ctx)
|
||||
}
|
||||
@@ -309,4 +309,4 @@ func (s *mockSpan) OverrideTracer(tracer trace.Tracer) {
|
||||
s.officialTracer = tracer
|
||||
}
|
||||
|
||||
func (s *mockSpan) TracerProvider() trace.TracerProvider { return noop.NewTracerProvider() }
|
||||
func (*mockSpan) TracerProvider() trace.TracerProvider { return noop.NewTracerProvider() }
|
||||
|
@@ -21,7 +21,7 @@ type namedMockTracerProvider struct{ embedded.TracerProvider }
|
||||
var _ trace.TracerProvider = (*namedMockTracerProvider)(nil)
|
||||
|
||||
// Tracer returns the WrapperTracer associated with the WrapperTracerProvider.
|
||||
func (p *namedMockTracerProvider) Tracer(name string, _ ...trace.TracerOption) trace.Tracer {
|
||||
func (*namedMockTracerProvider) Tracer(name string, _ ...trace.TracerOption) trace.Tracer {
|
||||
return &namedMockTracer{
|
||||
name: name,
|
||||
mockTracer: newMockTracer(),
|
||||
|
@@ -217,9 +217,9 @@ func newNoopClient() *noopClient {
|
||||
return &noopClient{}
|
||||
}
|
||||
|
||||
func (c *noopClient) UploadLogs(context.Context, []*logpb.ResourceLogs) error { return nil }
|
||||
func (*noopClient) UploadLogs(context.Context, []*logpb.ResourceLogs) error { return nil }
|
||||
|
||||
func (c *noopClient) Shutdown(context.Context) error { return nil }
|
||||
func (*noopClient) Shutdown(context.Context) error { return nil }
|
||||
|
||||
// retryable returns if err identifies a request that can be retried and a
|
||||
// duration to wait for if an explicit throttle time is included in err.
|
||||
|
@@ -89,6 +89,6 @@ func (e *Exporter) Shutdown(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ForceFlush does nothing. The Exporter holds no state.
|
||||
func (e *Exporter) ForceFlush(context.Context) error {
|
||||
func (*Exporter) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -353,7 +353,7 @@ func (c *httpCollector) record(r *http.Request) exportResult {
|
||||
return exportResult{Err: err}
|
||||
}
|
||||
|
||||
func (c *httpCollector) readBody(r *http.Request) (body []byte, err error) {
|
||||
func (*httpCollector) readBody(r *http.Request) (body []byte, err error) {
|
||||
var reader io.ReadCloser
|
||||
switch r.Header.Get("Content-Encoding") {
|
||||
case "gzip":
|
||||
|
@@ -68,6 +68,6 @@ func (e *Exporter) Shutdown(context.Context) error {
|
||||
}
|
||||
|
||||
// ForceFlush does nothing. The Exporter holds no state.
|
||||
func (e *Exporter) ForceFlush(context.Context) error {
|
||||
func (*Exporter) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e
|
||||
// This method returns an error if the method is canceled by the passed context.
|
||||
//
|
||||
// This method is safe to call concurrently.
|
||||
func (e *Exporter) ForceFlush(ctx context.Context) error {
|
||||
func (*Exporter) ForceFlush(ctx context.Context) error {
|
||||
// The exporter and client hold no state, nothing to flush.
|
||||
return ctx.Err()
|
||||
}
|
||||
@@ -120,7 +120,7 @@ var errShutdown = errors.New("gRPC exporter is shutdown")
|
||||
|
||||
type shutdownClient struct{}
|
||||
|
||||
func (c shutdownClient) err(ctx context.Context) error {
|
||||
func (shutdownClient) err(ctx context.Context) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -136,7 +136,7 @@ func (c shutdownClient) Shutdown(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// MarshalLog returns logging data about the Exporter.
|
||||
func (e *Exporter) MarshalLog() any {
|
||||
func (*Exporter) MarshalLog() any {
|
||||
return struct{ Type string }{Type: "OTLP/gRPC"}
|
||||
}
|
||||
|
||||
|
@@ -92,7 +92,7 @@ func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e
|
||||
// This method returns an error if the method is canceled by the passed context.
|
||||
//
|
||||
// This method is safe to call concurrently.
|
||||
func (e *Exporter) ForceFlush(ctx context.Context) error {
|
||||
func (*Exporter) ForceFlush(ctx context.Context) error {
|
||||
// The exporter and client hold no state, nothing to flush.
|
||||
return ctx.Err()
|
||||
}
|
||||
@@ -120,7 +120,7 @@ var errShutdown = errors.New("HTTP exporter is shutdown")
|
||||
|
||||
type shutdownClient struct{}
|
||||
|
||||
func (c shutdownClient) err(ctx context.Context) error {
|
||||
func (shutdownClient) err(ctx context.Context) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -136,7 +136,7 @@ func (c shutdownClient) Shutdown(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// MarshalLog returns logging data about the Exporter.
|
||||
func (e *Exporter) MarshalLog() any {
|
||||
func (*Exporter) MarshalLog() any {
|
||||
return struct{ Type string }{Type: "OTLP/HTTP"}
|
||||
}
|
||||
|
||||
|
@@ -21,11 +21,11 @@ type client struct {
|
||||
|
||||
var _ otlptrace.Client = &client{}
|
||||
|
||||
func (c *client) Start(context.Context) error {
|
||||
func (*client) Start(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) Stop(context.Context) error {
|
||||
func (*client) Stop(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -104,7 +104,7 @@ func NewClient(opts ...Option) otlptrace.Client {
|
||||
}
|
||||
|
||||
// Start does nothing in a HTTP client.
|
||||
func (d *client) Start(ctx context.Context) error {
|
||||
func (*client) Start(ctx context.Context) error {
|
||||
// nothing to do
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
@@ -143,7 +143,7 @@ func New(opts ...Option) (*Exporter, error) {
|
||||
}
|
||||
|
||||
// Describe implements prometheus.Collector.
|
||||
func (c *collector) Describe(chan<- *prometheus.Desc) {
|
||||
func (*collector) Describe(chan<- *prometheus.Desc) {
|
||||
// The Opentelemetry SDK doesn't have information on which will exist when the collector
|
||||
// is registered. By returning nothing we are an "unchecked" collector in Prometheus,
|
||||
// and assume responsibility for consistency of the metrics produced.
|
||||
@@ -529,7 +529,7 @@ func (c *collector) getName(m metricdata.Metrics) string {
|
||||
return c.metricNamer.Build(translatorMetric)
|
||||
}
|
||||
|
||||
func (c *collector) metricType(m metricdata.Metrics) *dto.MetricType {
|
||||
func (*collector) metricType(m metricdata.Metrics) *dto.MetricType {
|
||||
switch v := m.Data.(type) {
|
||||
case metricdata.ExponentialHistogram[int64], metricdata.ExponentialHistogram[float64]:
|
||||
return dto.MetricType_HISTOGRAM.Enum()
|
||||
|
@@ -67,6 +67,6 @@ func (e *Exporter) Shutdown(context.Context) error {
|
||||
}
|
||||
|
||||
// ForceFlush performs no action.
|
||||
func (e *Exporter) ForceFlush(context.Context) error {
|
||||
func (*Exporter) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ func (e *exporter) Export(ctx context.Context, data *metricdata.ResourceMetrics)
|
||||
return e.encVal.Load().(encoderHolder).Encode(data)
|
||||
}
|
||||
|
||||
func (e *exporter) ForceFlush(context.Context) error {
|
||||
func (*exporter) ForceFlush(context.Context) error {
|
||||
// exporter holds no state, nothing to flush.
|
||||
return nil
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (e *exporter) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *exporter) MarshalLog() any {
|
||||
func (*exporter) MarshalLog() any {
|
||||
return struct{ Type string }{Type: "STDOUT"}
|
||||
}
|
||||
|
||||
|
@@ -106,22 +106,22 @@ func (*altRegistration) Unregister() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (am *altMeter) Int64Counter(name string, _ ...metric.Int64CounterOption) (metric.Int64Counter, error) {
|
||||
func (*altMeter) Int64Counter(name string, _ ...metric.Int64CounterOption) (metric.Int64Counter, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Int64Counter(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Int64UpDownCounter(
|
||||
func (*altMeter) Int64UpDownCounter(
|
||||
name string,
|
||||
_ ...metric.Int64UpDownCounterOption,
|
||||
) (metric.Int64UpDownCounter, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Int64UpDownCounter(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Int64Histogram(name string, _ ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
||||
func (*altMeter) Int64Histogram(name string, _ ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Int64Histogram(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Int64Gauge(name string, _ ...metric.Int64GaugeOption) (metric.Int64Gauge, error) {
|
||||
func (*altMeter) Int64Gauge(name string, _ ...metric.Int64GaugeOption) (metric.Int64Gauge, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Int64Gauge(name)
|
||||
}
|
||||
|
||||
@@ -152,25 +152,25 @@ func (am *altMeter) Int64ObservableGauge(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (am *altMeter) Float64Counter(name string, _ ...metric.Float64CounterOption) (metric.Float64Counter, error) {
|
||||
func (*altMeter) Float64Counter(name string, _ ...metric.Float64CounterOption) (metric.Float64Counter, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Float64Counter(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Float64UpDownCounter(
|
||||
func (*altMeter) Float64UpDownCounter(
|
||||
name string,
|
||||
_ ...metric.Float64UpDownCounterOption,
|
||||
) (metric.Float64UpDownCounter, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Float64UpDownCounter(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Float64Histogram(
|
||||
func (*altMeter) Float64Histogram(
|
||||
name string,
|
||||
_ ...metric.Float64HistogramOption,
|
||||
) (metric.Float64Histogram, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Float64Histogram(name)
|
||||
}
|
||||
|
||||
func (am *altMeter) Float64Gauge(name string, _ ...metric.Float64GaugeOption) (metric.Float64Gauge, error) {
|
||||
func (*altMeter) Float64Gauge(name string, _ ...metric.Float64GaugeOption) (metric.Float64Gauge, error) {
|
||||
return noop.NewMeterProvider().Meter("noop").Float64Gauge(name)
|
||||
}
|
||||
|
||||
|
@@ -442,7 +442,7 @@ type failingRegisterCallbackMeter struct {
|
||||
noop.Meter
|
||||
}
|
||||
|
||||
func (m *failingRegisterCallbackMeter) RegisterCallback(
|
||||
func (*failingRegisterCallbackMeter) RegisterCallback(
|
||||
metric.Callback,
|
||||
...metric.Observable,
|
||||
) (metric.Registration, error) {
|
||||
|
@@ -182,14 +182,14 @@ type observationRecorder struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o observationRecorder) ObserveFloat64(i metric.Float64Observable, _ float64, _ ...metric.ObserveOption) {
|
||||
func (observationRecorder) ObserveFloat64(i metric.Float64Observable, _ float64, _ ...metric.ObserveOption) {
|
||||
iImpl, ok := i.(*testCountingFloatInstrument)
|
||||
if ok {
|
||||
iImpl.observe()
|
||||
}
|
||||
}
|
||||
|
||||
func (o observationRecorder) ObserveInt64(i metric.Int64Observable, _ int64, _ ...metric.ObserveOption) {
|
||||
func (observationRecorder) ObserveInt64(i metric.Int64Observable, _ int64, _ ...metric.ObserveOption) {
|
||||
iImpl, ok := i.(*testCountingIntInstrument)
|
||||
if ok {
|
||||
iImpl.observe()
|
||||
|
@@ -20,7 +20,7 @@ type Baggage struct{}
|
||||
var _ TextMapPropagator = Baggage{}
|
||||
|
||||
// Inject sets baggage key-values from ctx into the carrier.
|
||||
func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
func (Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
bStr := baggage.FromContext(ctx).String()
|
||||
if bStr != "" {
|
||||
carrier.Set(baggageHeader, bStr)
|
||||
@@ -30,7 +30,7 @@ func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
// Extract returns a copy of parent with the baggage from the carrier added.
|
||||
// If carrier implements [ValuesGetter] (e.g. [HeaderCarrier]), Values is invoked
|
||||
// for multiple values extraction. Otherwise, Get is called.
|
||||
func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context {
|
||||
func (Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context {
|
||||
if multiCarrier, ok := carrier.(ValuesGetter); ok {
|
||||
return extractMultiBaggage(parent, multiCarrier)
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context
|
||||
}
|
||||
|
||||
// Fields returns the keys who's values are set with Inject.
|
||||
func (b Baggage) Fields() []string {
|
||||
func (Baggage) Fields() []string {
|
||||
return []string{baggageHeader}
|
||||
}
|
||||
|
||||
|
@@ -20,9 +20,9 @@ var ctxKey ctxKeyType
|
||||
|
||||
type carrier []string
|
||||
|
||||
func (c *carrier) Keys() []string { return nil }
|
||||
func (*carrier) Keys() []string { return nil }
|
||||
|
||||
func (c *carrier) Get(string) string { return "" }
|
||||
func (*carrier) Get(string) string { return "" }
|
||||
|
||||
func (c *carrier) Set(setter, _ string) {
|
||||
*c = append(*c, setter)
|
||||
|
@@ -36,7 +36,7 @@ var (
|
||||
)
|
||||
|
||||
// Inject injects the trace context from ctx into carrier.
|
||||
func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
func (TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||
sc := trace.SpanContextFromContext(ctx)
|
||||
if !sc.IsValid() {
|
||||
return
|
||||
@@ -77,7 +77,7 @@ func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) cont
|
||||
return trace.ContextWithRemoteSpanContext(ctx, sc)
|
||||
}
|
||||
|
||||
func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
func (TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
h := carrier.Get(traceparentHeader)
|
||||
if h == "" {
|
||||
return trace.SpanContext{}
|
||||
@@ -151,6 +151,6 @@ func extractPart(dst []byte, h *string, n int) bool {
|
||||
}
|
||||
|
||||
// Fields returns the keys who's values are set with Inject.
|
||||
func (tc TraceContext) Fields() []string {
|
||||
func (TraceContext) Fields() []string {
|
||||
return []string{traceparentHeader, tracestateHeader}
|
||||
}
|
||||
|
@@ -128,57 +128,57 @@ func BenchmarkProcessor(b *testing.B) {
|
||||
|
||||
type timestampProcessor struct{}
|
||||
|
||||
func (p timestampProcessor) OnEmit(_ context.Context, r *Record) error {
|
||||
func (timestampProcessor) OnEmit(_ context.Context, r *Record) error {
|
||||
r.SetObservedTimestamp(time.Date(1988, time.November, 17, 0, 0, 0, 0, time.UTC))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p timestampProcessor) Enabled(context.Context, Record) bool {
|
||||
func (timestampProcessor) Enabled(context.Context, Record) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (p timestampProcessor) Shutdown(context.Context) error {
|
||||
func (timestampProcessor) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p timestampProcessor) ForceFlush(context.Context) error {
|
||||
func (timestampProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type attrAddProcessor struct{}
|
||||
|
||||
func (p attrAddProcessor) OnEmit(_ context.Context, r *Record) error {
|
||||
func (attrAddProcessor) OnEmit(_ context.Context, r *Record) error {
|
||||
r.AddAttributes(log.String("add", "me"))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p attrAddProcessor) Enabled(context.Context, Record) bool {
|
||||
func (attrAddProcessor) Enabled(context.Context, Record) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (p attrAddProcessor) Shutdown(context.Context) error {
|
||||
func (attrAddProcessor) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p attrAddProcessor) ForceFlush(context.Context) error {
|
||||
func (attrAddProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type attrSetDecorator struct{}
|
||||
|
||||
func (p attrSetDecorator) OnEmit(_ context.Context, r *Record) error {
|
||||
func (attrSetDecorator) OnEmit(_ context.Context, r *Record) error {
|
||||
r.SetAttributes(log.String("replace", "me"))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p attrSetDecorator) Enabled(context.Context, Record) bool {
|
||||
func (attrSetDecorator) Enabled(context.Context, Record) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (p attrSetDecorator) Shutdown(context.Context) error {
|
||||
func (attrSetDecorator) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p attrSetDecorator) ForceFlush(context.Context) error {
|
||||
func (attrSetDecorator) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -135,7 +135,7 @@ type RedactTokensProcessor struct{}
|
||||
|
||||
// OnEmit redacts values from attributes containing "token" in the key
|
||||
// by replacing them with a REDACTED value.
|
||||
func (p *RedactTokensProcessor) OnEmit(_ context.Context, record *log.Record) error {
|
||||
func (*RedactTokensProcessor) OnEmit(_ context.Context, record *log.Record) error {
|
||||
record.WalkAttributes(func(kv logapi.KeyValue) bool {
|
||||
if strings.Contains(strings.ToLower(kv.Key), "token") {
|
||||
record.AddAttributes(logapi.String(kv.Key, "REDACTED"))
|
||||
@@ -146,11 +146,11 @@ func (p *RedactTokensProcessor) OnEmit(_ context.Context, record *log.Record) er
|
||||
}
|
||||
|
||||
// Shutdown returns nil.
|
||||
func (p *RedactTokensProcessor) Shutdown(context.Context) error {
|
||||
func (*RedactTokensProcessor) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ForceFlush returns nil.
|
||||
func (p *RedactTokensProcessor) ForceFlush(context.Context) error {
|
||||
func (*RedactTokensProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -54,11 +54,11 @@ func (e exporter) Export(_ context.Context, records []log.Record) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e exporter) Shutdown(context.Context) error {
|
||||
func (exporter) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// appropriate error should be returned in these situations.
|
||||
func (e exporter) ForceFlush(context.Context) error {
|
||||
func (exporter) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -278,7 +278,7 @@ type logSink struct {
|
||||
keysAndValues []any
|
||||
}
|
||||
|
||||
func (l *logSink) Enabled(int) bool { return true }
|
||||
func (*logSink) Enabled(int) bool { return true }
|
||||
|
||||
func (l *logSink) Info(level int, msg string, keysAndValues ...any) {
|
||||
l.level, l.msg, l.keysAndValues = level, msg, keysAndValues
|
||||
|
@@ -77,11 +77,11 @@ func (e *writerExporter) Export(_ context.Context, records []log.Record) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *writerExporter) Shutdown(context.Context) error {
|
||||
func (*writerExporter) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *writerExporter) ForceFlush(context.Context) error {
|
||||
func (*writerExporter) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ func newFixedSizeReservoir(s *storage) *FixedSizeReservoir {
|
||||
|
||||
// randomFloat64 returns, as a float64, a uniform pseudo-random number in the
|
||||
// open interval (0.0,1.0).
|
||||
func (r *FixedSizeReservoir) randomFloat64() float64 {
|
||||
func (*FixedSizeReservoir) randomFloat64() float64 {
|
||||
// TODO: Use an algorithm that avoids rejection sampling. For example:
|
||||
//
|
||||
// const precision = 1 << 53 // 2^53
|
||||
|
@@ -18,10 +18,10 @@ func dropReservoir[N int64 | float64](attribute.Set) FilteredExemplarReservoir[N
|
||||
type dropRes[N int64 | float64] struct{}
|
||||
|
||||
// Offer does nothing, all measurements offered will be dropped.
|
||||
func (r *dropRes[N]) Offer(context.Context, N, []attribute.KeyValue) {}
|
||||
func (*dropRes[N]) Offer(context.Context, N, []attribute.KeyValue) {}
|
||||
|
||||
// Collect resets dest. No exemplars will ever be returned.
|
||||
func (r *dropRes[N]) Collect(dest *[]exemplar.Exemplar) {
|
||||
func (*dropRes[N]) Collect(dest *[]exemplar.Exemplar) {
|
||||
clear(*dest) // Erase elements to let GC collect objects
|
||||
*dest = (*dest)[:0]
|
||||
}
|
||||
|
@@ -466,7 +466,7 @@ func (i *inserter[N]) logConflict(id instID) {
|
||||
global.Warn(msg, args...)
|
||||
}
|
||||
|
||||
func (i *inserter[N]) instID(kind InstrumentKind, stream Stream) instID {
|
||||
func (*inserter[N]) instID(kind InstrumentKind, stream Stream) instID {
|
||||
var zero N
|
||||
return instID{
|
||||
Name: stream.Name,
|
||||
|
@@ -117,7 +117,7 @@ type produceHolder struct {
|
||||
type shutdownProducer struct{}
|
||||
|
||||
// produce returns an ErrReaderShutdown error.
|
||||
func (p shutdownProducer) produce(context.Context, *metricdata.ResourceMetrics) error {
|
||||
func (shutdownProducer) produce(context.Context, *metricdata.ResourceMetrics) error {
|
||||
return ErrReaderShutdown
|
||||
}
|
||||
|
||||
|
@@ -796,7 +796,7 @@ func TestResourceConcurrentSafe(t *testing.T) {
|
||||
|
||||
type fakeDetector struct{}
|
||||
|
||||
func (f fakeDetector) Detect(context.Context) (*resource.Resource, error) {
|
||||
func (fakeDetector) Detect(context.Context) (*resource.Resource, error) {
|
||||
// A bit pedantic, but resource.NewWithAttributes returns an empty Resource when
|
||||
// no attributes specified. We want to make sure that this is concurrent-safe.
|
||||
return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0"), nil
|
||||
|
@@ -121,7 +121,7 @@ func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorO
|
||||
}
|
||||
|
||||
// OnStart method does nothing.
|
||||
func (bsp *batchSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (*batchSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
|
||||
// OnEnd method enqueues a ReadOnlySpan for later processing.
|
||||
func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) {
|
||||
@@ -169,7 +169,7 @@ type forceFlushSpan struct {
|
||||
flushed chan struct{}
|
||||
}
|
||||
|
||||
func (f forceFlushSpan) SpanContext() trace.SpanContext {
|
||||
func (forceFlushSpan) SpanContext() trace.SpanContext {
|
||||
return trace.NewSpanContext(trace.SpanContextConfig{TraceFlags: trace.FlagsSampled})
|
||||
}
|
||||
|
||||
|
@@ -525,7 +525,7 @@ func newIndefiniteExporter(t *testing.T) indefiniteExporter {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e indefiniteExporter) Shutdown(context.Context) error {
|
||||
func (indefiniteExporter) Shutdown(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ type randomIDGenerator struct{}
|
||||
var _ IDGenerator = &randomIDGenerator{}
|
||||
|
||||
// NewSpanID returns a non-zero span ID from a randomly-chosen sequence.
|
||||
func (gen *randomIDGenerator) NewSpanID(context.Context, trace.TraceID) trace.SpanID {
|
||||
func (*randomIDGenerator) NewSpanID(context.Context, trace.TraceID) trace.SpanID {
|
||||
sid := trace.SpanID{}
|
||||
for {
|
||||
binary.NativeEndian.PutUint64(sid[:], rand.Uint64())
|
||||
@@ -45,7 +45,7 @@ func (gen *randomIDGenerator) NewSpanID(context.Context, trace.TraceID) trace.Sp
|
||||
|
||||
// NewIDs returns a non-zero trace ID and a non-zero span ID from a
|
||||
// randomly-chosen sequence.
|
||||
func (gen *randomIDGenerator) NewIDs(context.Context) (trace.TraceID, trace.SpanID) {
|
||||
func (*randomIDGenerator) NewIDs(context.Context) (trace.TraceID, trace.SpanID) {
|
||||
tid := trace.TraceID{}
|
||||
sid := trace.SpanID{}
|
||||
for {
|
||||
|
@@ -33,8 +33,8 @@ func (t *basicSpanProcessor) Shutdown(context.Context) error {
|
||||
return t.injectShutdownError
|
||||
}
|
||||
|
||||
func (t *basicSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (t *basicSpanProcessor) OnEnd(ReadOnlySpan) {}
|
||||
func (*basicSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (*basicSpanProcessor) OnEnd(ReadOnlySpan) {}
|
||||
func (t *basicSpanProcessor) ForceFlush(context.Context) error {
|
||||
t.flushed = true
|
||||
return nil
|
||||
@@ -48,9 +48,9 @@ func (t *shutdownSpanProcessor) Shutdown(ctx context.Context) error {
|
||||
return t.shutdown(ctx)
|
||||
}
|
||||
|
||||
func (t *shutdownSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (t *shutdownSpanProcessor) OnEnd(ReadOnlySpan) {}
|
||||
func (t *shutdownSpanProcessor) ForceFlush(context.Context) error {
|
||||
func (*shutdownSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (*shutdownSpanProcessor) OnEnd(ReadOnlySpan) {}
|
||||
func (*shutdownSpanProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -110,14 +110,14 @@ func TraceIDRatioBased(fraction float64) Sampler {
|
||||
|
||||
type alwaysOnSampler struct{}
|
||||
|
||||
func (as alwaysOnSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
func (alwaysOnSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
return SamplingResult{
|
||||
Decision: RecordAndSample,
|
||||
Tracestate: trace.SpanContextFromContext(p.ParentContext).TraceState(),
|
||||
}
|
||||
}
|
||||
|
||||
func (as alwaysOnSampler) Description() string {
|
||||
func (alwaysOnSampler) Description() string {
|
||||
return "AlwaysOnSampler"
|
||||
}
|
||||
|
||||
@@ -131,14 +131,14 @@ func AlwaysSample() Sampler {
|
||||
|
||||
type alwaysOffSampler struct{}
|
||||
|
||||
func (as alwaysOffSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
func (alwaysOffSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
return SamplingResult{
|
||||
Decision: Drop,
|
||||
Tracestate: trace.SpanContextFromContext(p.ParentContext).TraceState(),
|
||||
}
|
||||
}
|
||||
|
||||
func (as alwaysOffSampler) Description() string {
|
||||
func (alwaysOffSampler) Description() string {
|
||||
return "AlwaysOffSampler"
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor {
|
||||
}
|
||||
|
||||
// OnStart does nothing.
|
||||
func (ssp *simpleSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (*simpleSpanProcessor) OnStart(context.Context, ReadWriteSpan) {}
|
||||
|
||||
// OnEnd immediately exports a ReadOnlySpan.
|
||||
func (ssp *simpleSpanProcessor) OnEnd(s ReadOnlySpan) {
|
||||
@@ -104,7 +104,7 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ForceFlush does nothing as there is no data to flush.
|
||||
func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error {
|
||||
func (*simpleSpanProcessor) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ type snapshot struct {
|
||||
|
||||
var _ ReadOnlySpan = snapshot{}
|
||||
|
||||
func (s snapshot) private() {}
|
||||
func (snapshot) private() {}
|
||||
|
||||
// Name returns the name of the span.
|
||||
func (s snapshot) Name() string {
|
||||
|
@@ -129,10 +129,10 @@ func TestSettingSpanLimits(t *testing.T) {
|
||||
|
||||
type recorder []ReadOnlySpan
|
||||
|
||||
func (r *recorder) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (r *recorder) OnEnd(s ReadOnlySpan) { *r = append(*r, s) }
|
||||
func (r *recorder) ForceFlush(context.Context) error { return nil }
|
||||
func (r *recorder) Shutdown(context.Context) error { return nil }
|
||||
func (*recorder) OnStart(context.Context, ReadWriteSpan) {}
|
||||
func (r *recorder) OnEnd(s ReadOnlySpan) { *r = append(*r, s) }
|
||||
func (*recorder) ForceFlush(context.Context) error { return nil }
|
||||
func (*recorder) Shutdown(context.Context) error { return nil }
|
||||
|
||||
func testSpanLimits(t *testing.T, limits SpanLimits) ReadOnlySpan {
|
||||
rec := new(recorder)
|
||||
|
@@ -34,9 +34,9 @@ type Annotator struct {
|
||||
}
|
||||
|
||||
func (a Annotator) OnStart(_ context.Context, s ReadWriteSpan) { s.SetAttributes(a.AttrsFunc()...) }
|
||||
func (a Annotator) Shutdown(context.Context) error { return nil }
|
||||
func (a Annotator) ForceFlush(context.Context) error { return nil }
|
||||
func (a Annotator) OnEnd(s ReadOnlySpan) {
|
||||
func (Annotator) Shutdown(context.Context) error { return nil }
|
||||
func (Annotator) ForceFlush(context.Context) error { return nil }
|
||||
func (Annotator) OnEnd(s ReadOnlySpan) {
|
||||
attr := s.Attributes()[0]
|
||||
fmt.Printf("%s: %s\n", attr.Key, attr.Value.AsString())
|
||||
}
|
||||
|
@@ -161,7 +161,7 @@ func (ts *testSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
}
|
||||
}
|
||||
|
||||
func (ts testSampler) Description() string {
|
||||
func (testSampler) Description() string {
|
||||
return "testSampler"
|
||||
}
|
||||
|
||||
@@ -1799,7 +1799,7 @@ func (s *stateSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
return SamplingResult{Decision: decision, Tracestate: ts}
|
||||
}
|
||||
|
||||
func (s stateSampler) Description() string {
|
||||
func (stateSampler) Description() string {
|
||||
return "stateSampler"
|
||||
}
|
||||
|
||||
@@ -2641,7 +2641,7 @@ func RecordingOnly() Sampler {
|
||||
type recordOnlySampler struct{}
|
||||
|
||||
// ShouldSample implements Sampler interface. It always returns Record but not Sample.
|
||||
func (s recordOnlySampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
func (recordOnlySampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
psc := trace.SpanContextFromContext(p.ParentContext)
|
||||
return SamplingResult{
|
||||
Decision: RecordOnly,
|
||||
|
@@ -25,10 +25,10 @@ func NewNoopExporter() *NoopExporter {
|
||||
type NoopExporter struct{}
|
||||
|
||||
// ExportSpans handles export of spans by dropping them.
|
||||
func (nsb *NoopExporter) ExportSpans(context.Context, []trace.ReadOnlySpan) error { return nil }
|
||||
func (*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 }
|
||||
func (*NoopExporter) Shutdown(context.Context) error { return nil }
|
||||
|
||||
var _ trace.SpanExporter = (*InMemoryExporter)(nil)
|
||||
|
||||
|
@@ -47,14 +47,14 @@ func (sr *SpanRecorder) OnEnd(s sdktrace.ReadOnlySpan) {
|
||||
// Shutdown does nothing.
|
||||
//
|
||||
// This method is safe to be called concurrently.
|
||||
func (sr *SpanRecorder) Shutdown(context.Context) error {
|
||||
func (*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 {
|
||||
func (*SpanRecorder) ForceFlush(context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -298,7 +298,7 @@ func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue {
|
||||
return c.header("http.response.header", h)
|
||||
}
|
||||
|
||||
func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
func (*HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
key := func(k string) attribute.Key {
|
||||
k = strings.ToLower(k)
|
||||
k = strings.ReplaceAll(k, "-", "_")
|
||||
@@ -315,7 +315,7 @@ func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
|
||||
// ClientStatus returns a span status code and message for an HTTP status code
|
||||
// value received by a client.
|
||||
func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
@@ -326,7 +326,7 @@ func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
// ServerStatus returns a span status code and message for an HTTP status code
|
||||
// value returned by a server. Status codes in the 400-499 range are not
|
||||
// returned as errors.
|
||||
func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
|
@@ -298,7 +298,7 @@ func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue {
|
||||
return c.header("http.response.header", h)
|
||||
}
|
||||
|
||||
func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
func (*HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
key := func(k string) attribute.Key {
|
||||
k = strings.ToLower(k)
|
||||
k = strings.ReplaceAll(k, "-", "_")
|
||||
@@ -315,7 +315,7 @@ func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
|
||||
// ClientStatus returns a span status code and message for an HTTP status code
|
||||
// value received by a client.
|
||||
func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
@@ -326,7 +326,7 @@ func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
// ServerStatus returns a span status code and message for an HTTP status code
|
||||
// value returned by a server. Status codes in the 400-499 range are not
|
||||
// returned as errors.
|
||||
func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
|
@@ -299,7 +299,7 @@ func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue {
|
||||
return c.header("http.response.header", h)
|
||||
}
|
||||
|
||||
func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
func (*HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
key := func(k string) attribute.Key {
|
||||
k = strings.ToLower(k)
|
||||
k = strings.ReplaceAll(k, "-", "_")
|
||||
@@ -316,7 +316,7 @@ func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||
|
||||
// ClientStatus returns a span status code and message for an HTTP status code
|
||||
// value received by a client.
|
||||
func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
@@ -327,7 +327,7 @@ func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||
// ServerStatus returns a span status code and message for an HTTP status code
|
||||
// value returned by a server. Status codes in the 400-499 range are not
|
||||
// returned as errors.
|
||||
func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
func (*HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||
stat, valid := validateHTTPStatusCode(code)
|
||||
if !valid {
|
||||
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||
|
@@ -39,7 +39,7 @@ type autoTracerProvider struct{ embedded.TracerProvider }
|
||||
|
||||
var _ TracerProvider = autoTracerProvider{}
|
||||
|
||||
func (p autoTracerProvider) Tracer(name string, opts ...TracerOption) Tracer {
|
||||
func (autoTracerProvider) Tracer(name string, opts ...TracerOption) Tracer {
|
||||
cfg := NewTracerConfig(opts...)
|
||||
return autoTracer{
|
||||
name: name,
|
||||
@@ -81,7 +81,7 @@ func (t autoTracer) Start(ctx context.Context, name string, opts ...SpanStartOpt
|
||||
// Expected to be implemented in eBPF.
|
||||
//
|
||||
//go:noinline
|
||||
func (t *autoTracer) start(
|
||||
func (*autoTracer) start(
|
||||
ctx context.Context,
|
||||
spanPtr *autoSpan,
|
||||
psc *SpanContext,
|
||||
|
@@ -26,7 +26,7 @@ type noopTracerProvider struct{ embedded.TracerProvider }
|
||||
var _ TracerProvider = noopTracerProvider{}
|
||||
|
||||
// Tracer returns noop implementation of Tracer.
|
||||
func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer {
|
||||
func (noopTracerProvider) Tracer(string, ...TracerOption) Tracer {
|
||||
return noopTracer{}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ var _ Tracer = noopTracer{}
|
||||
|
||||
// Start carries forward a non-recording Span, if one is present in the context, otherwise it
|
||||
// creates a no-op Span.
|
||||
func (t noopTracer) Start(ctx context.Context, _ string, _ ...SpanStartOption) (context.Context, Span) {
|
||||
func (noopTracer) Start(ctx context.Context, _ string, _ ...SpanStartOption) (context.Context, Span) {
|
||||
span := SpanFromContext(ctx)
|
||||
if _, ok := span.(nonRecordingSpan); !ok {
|
||||
// span is likely already a noopSpan, but let's be sure
|
||||
|
@@ -51,7 +51,7 @@ type Tracer struct{ embedded.Tracer }
|
||||
// If ctx contains a span context, the returned span will also contain that
|
||||
// span context. If the span context in ctx is for a non-recording span, that
|
||||
// span instance will be returned directly.
|
||||
func (t Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||
func (Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||
span := trace.SpanFromContext(ctx)
|
||||
|
||||
// If the parent context contains a non-zero span context, that span
|
||||
|
Reference in New Issue
Block a user