opentelemetry-ruby
opentelemetry-ruby copied to clipboard
Optionally trim attribute keys & values?
Related to https://github.com/open-telemetry/opentelemetry-specification/issues/504
Java provides optional attribute value truncation: https://github.com/open-telemetry/opentelemetry-java/blob/a021a59b9433691c06ab2265b4c574eab825b0ed/sdk/tracing/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java#L195-L197
if (traceConfig.shouldTruncateStringAttributeValues()) {
value = StringUtils.truncateToSize(value, traceConfig.getMaxLengthOfAttributeValues());
}
We have some ad-hoc truncation and UTF8 validation in the Redis instrumentation, for example: https://github.com/open-telemetry/opentelemetry-ruby/blob/1a680bbd489eee18cdf78b24a99e3cc0333c41e5/instrumentation/redis/lib/opentelemetry/instrumentation/redis/utils.rb#L60-L80
It is likely worth extracting this into a common utility module, and implementing attribute truncation in a single place with a configurable limit (most likely in the SDK Span
class).
I believe this issue has been addressed. Should we close or is there more to do here?
I think #1136 is relevant here.
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep
label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.