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

fix: OpenTelemetry schema URL panic #2012

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions serve/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ import (

// newResource returns a resource describing this application.
func newResource(p *plugin.Plugin) *resource.Resource {
def := resource.Default()
schemaURL := def.SchemaURL()
if schemaURL == "" {
schemaURL = semconv.SchemaURL
}
r, err := resource.Merge(
Copy link
Member Author

@disq disq Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method always returns r (even with err, which the single value can be ErrSchemaURLConflict) so we could also do if r != nil { return r } panic(err) but in that case the resource's schema URL could be empty.

resource.Default(),
def,
resource.NewWithAttributes(
semconv.SchemaURL,
schemaURL,
semconv.ServiceName("cloudquery-"+p.Name()),
semconv.ServiceVersion(p.Version()),
),
Expand Down
Loading