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

Add ability to set the default trace attributes #160

Merged

Conversation

filip-ph-johansson
Copy link
Contributor

Fix #156

This adds the missing WithDefaultTraceAttributes option.

Copy link
Contributor

@punya punya left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

newSD := *sd
for k, v := range e.traceExporter.o.DefaultTraceAttributes {
func createKeyValueAttributes(attr map[string]interface{}) []attribute.KeyValue {
kv := make([]attribute.KeyValue, len(attr))
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you are trying to reserve capacity in the slice, not create a slice with several zero elements.

Suggested change
kv := make([]attribute.KeyValue, len(attr))
kv := make([]attribute.KeyValue, 0, len(attr))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I missed that.
Fixed.

@punya punya merged commit 9780668 into GoogleCloudPlatform:main Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to set DefaultTraceAttributes of the trace exporter
2 participants