Replies: 2 comments 4 replies
-
There is an attribute.StringSlice for arrays of strings. IntSlice exists too. Maps are a bit different, as otel doesn't explicitly say how nested hash keys should be represented (they will have to end up being flattened). So you will have to setup your own helper method which will loop through each entry and set the proper key/value. |
Beta Was this translation helpful? Give feedback.
-
AFAIK most people do marshal JSON and pass it as a string attribute. Also a heads up, that OTel Go Logs (which is in design phase) will allow complex, structured attributes. |
Beta Was this translation helpful? Give feedback.
-
I've used structured loggers like zap and logrus where I can set maps or structs. How can I do this with opentelemetry traces? I feel like it is possible since I am using datadog and https://github.com/connectrpc/otelconnect-go which results in traces with nested attributes that look like this in datadog. (Apologies if this is too datadog specific)
![image](https://private-user-images.githubusercontent.com/14320477/301400072-2c8e0c24-cce3-41cd-a728-23ef2a8d9e05.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0NjQ3NTksIm5iZiI6MTcyNDQ2NDQ1OSwicGF0aCI6Ii8xNDMyMDQ3Ny8zMDE0MDAwNzItMmM4ZTBjMjQtY2NlMy00MWNkLWE3MjgtMjNlZjJhOGQ5ZTA1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDAxNTQxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVhNWE1YWZjYTAyZTIzYjkyZjEyYmQ5ZjBiMDliZmZjYTljN2U0MWQzOWRlZDY4MDYxZmRhNjE2YWI3ZGJhYzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.y3SuNf0rI2mkc1H0GTRlZPpE3iZk3KC3tEQ5I14figw)
However, I can't seem to find anything in this package that looks like
attribute.Map
orattribute.Any
.What strategies are people using?
Beta Was this translation helpful? Give feedback.
All reactions