Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Make span tag key/value pairs to be utf-8 encoded #82

Closed
buxingzhe opened this issue Dec 29, 2020 · 7 comments
Closed

Make span tag key/value pairs to be utf-8 encoded #82

buxingzhe opened this issue Dec 29, 2020 · 7 comments
Assignees

Comments

@buxingzhe
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Our application shows the log like below due to the URL path contain non utf-8 encoded characters.
"go2sky-gRPC2020/12/28 18:49:46 send segment error rpc error: code = Internal desc = grpc: error while marshaling: proto: field "KeyStringValuePair.Value" contains invalid UTF-8"
Describe the solution you'd like
A clear and concise description of what you want to happen.
The sdk should always encode the key/value string for tags with utf-8.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@wu-sheng
Copy link
Member

the URL path contain non utf-8 encoded characters.

Why is that? If it is URL encoded, it should have UTF-8 encoded already.

@buxingzhe
Copy link
Author

As the log doesn't output the real string value, so I'm not sure why this happened.
I think it's probably related to the setting of "span.Tag(go2sky.TagURL, req.URL.String()). As the URL may have query parameters that contain characters like Chinese.

@wu-sheng
Copy link
Member

URL includes parameters? Which framework having this feature? URL should be encoded even for Chinese.

@buxingzhe
Copy link
Author

Here is a URL that with query parameters. Query parameters are the key value pairs after '?'.
https://www.baidu.com/s?wd=中文&rsv_spt=1&rsv_iqid=0xee4f0d5400029778

@wu-sheng
Copy link
Member

OK, we should use uri#encoding before put it into the tags.

@rainbend rainbend self-assigned this Jan 22, 2021
@rainbend
Copy link
Member

image
Hi @buxingzhe Can you give me more information? I didn't come across proto: field "KeyStringValuePair.Value" contains invalid UTF-8 :)

@buxingzhe
Copy link
Author

I just found such errors in our log, but I don't figure out how it happens.
Here are some links related to this issue, hope to help you.
golang/protobuf#1228
https://stackoverflow.com/questions/15139449/google-protocol-buffer-error-encountered-string-containing-invalid-utf-8-data

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants