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

Sentry exporter: missing library_version for Sentry error #35307

Open
afifurrohman-id opened this issue Sep 20, 2024 · 3 comments
Open

Sentry exporter: missing library_version for Sentry error #35307

afifurrohman-id opened this issue Sep 20, 2024 · 3 comments
Labels
bug Something isn't working exporter/sentry

Comments

@afifurrohman-id
Copy link

afifurrohman-id commented Sep 20, 2024

Component(s)

exporter/sentry

What happened?

Description

base on this picture library_version is invalid in Sentry error because is empty
{57D8B281-558A-49C9-B87B-9065F17042EB}

Steps to Reproduce

  • Trigger error to sentry using otel record error and set otel status to error
package main

import (
	"context"
	"errors"
	"fmt"

	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/codes"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
	"go.opentelemetry.io/otel/propagation"
	"go.opentelemetry.io/otel/sdk/resource"
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
	semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
)

func check(err error) {
	if err != nil {
		panic(err)
	}
}

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	exporter, err := otlptrace.New(
		ctx,
		otlptracegrpc.NewClient(otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint("localhost:4317")),
	)
	check(err)

	tp := sdktrace.NewTracerProvider(
		sdktrace.WithSampler(sdktrace.AlwaysSample()),
		sdktrace.WithBatcher(exporter),
		sdktrace.WithResource(resource.NewWithAttributes(
			semconv.SchemaURL,
			semconv.ServiceNameKey.String("foo service"),
		)),
	)
	defer tp.Shutdown(ctx)

	otel.SetTracerProvider(tp)
	otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))

	ctx, span := otel.GetTracerProvider().Tracer("trace foo").Start(ctx, "span foo")
	defer span.End()

	err = errors.New("error foo")
	span.RecordError(err)
	span.SetStatus(codes.Error, err.Error())
}

Expected Result

library_version it should not empty in sentry UI

Actual Result

give error say: library_version is empty

Collector version

Docker image: otel/opentelemetry-collector-contrib:0.106.1

Environment information

Environment

OS: Linux 🦀 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 GNU/Linux

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "0.0.0.0:${env:OTLP_GRPC_PORT}"
processors:
  batch:

exporters:
  sentry:
    dsn: "${env:SENTRY_DSN}"
    insecure_skip_verify: true
  logging:
        verbosity: detailed

extensions:
  health_check:
  pprof:
  zpages:

service:
  extensions:
    - health_check
    - pprof
    - zpages
  pipelines:
    traces:
      receivers:
        - otlp
      processors:
      - batch
      exporters: [logging, sentry]
  telemetry:
    logs:
      level: DEBUG

Log output

none

Additional context

none

@afifurrohman-id afifurrohman-id added bug Something isn't working needs triage New item requiring triage labels Sep 20, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@AbhiPrasad
Copy link
Member

We probably want to do some extra validation here:

tags["library_name"] = library.Name()
tags["library_version"] = library.Version()

@afifurrohman-id would you be open to create a PR?

@crobert-1
Copy link
Member

Removing needs triage based on response from code owner validating that this is a real issue.

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter/sentry
Projects
None yet
Development

No branches or pull requests

3 participants