opentelemetry-ruby icon indicating copy to clipboard operation
opentelemetry-ruby copied to clipboard

Optionally trim attribute keys & values?

Open fbogsany opened this issue 3 years ago • 3 comments

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).

fbogsany avatar Aug 26 '20 19:08 fbogsany

I believe this issue has been addressed. Should we close or is there more to do here?

plantfansam avatar Mar 03 '22 16:03 plantfansam

I think #1136 is relevant here.

fbogsany avatar Mar 08 '22 15:03 fbogsany

👋 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.

github-actions[bot] avatar Apr 27 '24 01:04 github-actions[bot]