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

Example run error #5652

Closed
onenewcode opened this issue Jul 29, 2024 · 5 comments
Closed

Example run error #5652

onenewcode opened this issue Jul 29, 2024 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@onenewcode
Copy link

Description

example/namedtracer/main.go

An error in the file regarding the usage of baggage

The following code in the example does not create a new object and returns an error.

fooKey     = attribute.Key("ex.com/foo")
m0, _ := baggage.NewMemberRaw(string(fooKey), "foo1")

Because when the validateKeyChar method in baggage checks for '/', it returns an error.

Because safeKeyCharset in baggage doesn't contain '/'。

Expected behavior

Example run

@onenewcode onenewcode added the bug Something isn't working label Jul 29, 2024
@pellared
Copy link
Member

This is may be fixed by #5132

However, notice that W3C baggage propagator would not handle such keys.

@onenewcode
Copy link
Author

This is may be fixed by #5132

However, notice that W3C baggage propagator would not handle such keys.

I see

@pellared
Copy link
Member

What do you expect?

@onenewcode
Copy link
Author

As a new user of the framework, I had little knowledge of the w3c specification. I just want the functionality shown by example to work. Just example/namedtracer/main. go show usage is not correct. That bothers me

@dmathieu
Copy link
Member

With #5132 being merged, this issue appear to be solved.

package main

import (
	"fmt"
	"os"

	"go.opentelemetry.io/otel/attribute"
	"go.opentelemetry.io/otel/baggage"
)

func main() {
	fooKey := attribute.Key("ex.com/foo")
	m0, _ := baggage.NewMemberRaw(string(fooKey), "foo1")
	fmt.Fprintf(os.Stdout, "%#v", m0)
}

go run main.go
baggage.Member{key:"ex.com/foo", value:"foo1", properties:baggage.properties(nil), hasData:true}%

@XSAM XSAM added this to the untracked milestone Nov 7, 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
Projects
None yet
Development

No branches or pull requests

4 participants