Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

otlptrace panics when array-type resource attributes are used #2220

Closed
axw opened this issue Sep 6, 2021 · 2 comments · Fixed by #2223
Closed

otlptrace panics when array-type resource attributes are used #2220

axw opened this issue Sep 6, 2021 · 2 comments · Fixed by #2223
Labels
area:trace Part of OpenTelemetry tracing bug Something isn't working pkg:exporter:otlp Related to the OTLP exporter package
Milestone

Comments

@axw
Copy link

axw commented Sep 6, 2021

Description

When exporting trace spans associated with a resource that has array-type attributes, otlptrace exporters panic (at least otlptracegrpc, but I think otlptracehttp too).

Environment

  • OS: Linux
  • Architecture: x86_64
  • Go Version: 1.16.5
  • opentelemetry-go version: v1.0.0-RC3

Steps To Reproduce

  1. Run this:
package main

import (
        "context"
        "log"

        "go.opentelemetry.io/otel/attribute"
        "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
        "go.opentelemetry.io/otel/sdk/resource"
        "go.opentelemetry.io/otel/sdk/trace"
)

func main() {
        exporter, err := otlptracegrpc.New(context.Background())
        if err != nil {
                log.Fatal(err)
        }

        tracerProvider := trace.NewTracerProvider(
                trace.WithSyncer(exporter),
                trace.WithResource(
                        resource.NewSchemaless(
                                attribute.StringSlice("string_array", []string{"a", "b"}),
                        ),
                ),
        )

        tracer := tracerProvider.Tracer("test")
        _, span := tracer.Start(context.Background(), "operation")
        span.End()
  1. Observe panic:
$ go run main.go
panic: runtime error: hash of unhashable type []string

goroutine 1 [running]:
type..hash.go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform.ilsKey·1(0xc0002df400, 0x0, 0x0)
        <autogenerated>:1 +0x35
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform.Spans(0xc0003702a0, 0x1, 0x1, 0x40fd98, 0x10, 0x907160)
        /home/andrew/go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/[email protected]!r!c3/internal/tracetransform/span.go:57 +0x433
go.opentelemetry.io/otel/exporters/otlp/otlptrace.(*Exporter).ExportSpans(0xc000090960, 0xa72670, 0xc0000240f8, 0xc0003702a0, 0x1, 0x1, 0x0, 0x0)
        /home/andrew/go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/[email protected]!r!c3/exporter.go:44 +0x45
go.opentelemetry.io/otel/sdk/trace.(*simpleSpanProcessor).OnEnd(0xc00007f3c0, 0xa78918, 0xc000386000)
        /home/andrew/go/pkg/mod/go.opentelemetry.io/otel/[email protected]!r!c3/trace/simple_span_processor.go:58 +0x142
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0xc000001e00, 0x0, 0x0, 0x0)
        /home/andrew/go/pkg/mod/go.opentelemetry.io/otel/[email protected]!r!c3/trace/span.go:280 +0x2d7
main.main()
        /tmp/otelgopanic/main.go:30 +0x473
exit status 2

Expected behavior

Should not panic.

@axw axw added the bug Something isn't working label Sep 6, 2021
@Aneurysm9 Aneurysm9 added area:trace Part of OpenTelemetry tracing pkg:exporter:otlp Related to the OTLP exporter package priority:p1 labels Sep 6, 2021
@pkwarren
Copy link
Contributor

When is the next release planned which will include this change? This caused all OTEL tracing to fail in apps we upgraded to 1.0.0-RC3 (using process resource detector which uses slices for command arguments).

@MrAlias
Copy link
Contributor

MrAlias commented Sep 17, 2021

When is the next release planned which will include this change? This caused all OTEL tracing to fail in apps we upgraded to 1.0.0-RC3 (using process resource detector which uses slices for command arguments).

Monday 2021-09-20.

@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:trace Part of OpenTelemetry tracing bug Something isn't working pkg:exporter:otlp Related to the OTLP exporter package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants