rajeshkumarchandolu commented on code in PR #12145:
URL: https://github.com/apache/ozone/pull/12145#discussion_r4694765195
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -623,6 +627,13 @@ public static void addAttributesToCurrentSpan(String key,
boolean value) {
}
}
+ public static void addAttributesToCurrentSpan(Map<String, String>
attributes) {
+ if (attributes == null) {
+ return;
+ }
+ attributes.forEach(TracingUtil::addAttributesToCurrentSpan);
Review Comment:
Thanks. Fixed the first point in 3adc9150ca
(https://github.com/apache/ozone/pull/12145/commits/3adc9150cac59c151c455073af4c7f585378b51a):
addAttributesToCurrentSpan(Map) now looks up the current span once and returns
before iterating when it isn't recording, so an unsampled request pays a single
context lookup per audit message, independent of the number of fields.
For sampled spans, the cost of many attributes is covered by the
OpenTelemetry Java SDK's own published benchmark, SpanRecordBenchmark, which
records spans with 0, 10 and 100 attributes through a BatchSpanProcessor:
results at https://open-telemetry.github.io/opentelemetry-java/benchmarks/
(source:
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/all/src/jmh/java/io/opentelemetry/sdk/SpanRecordBenchmark.java).
Our audit maps are well within that range.
For a single large value such as KeyBlockToDelete, the extra cost applies
only to sampled spans, and the audit log already builds the same string for
every delete batch, so tracing adds no extra formatting. I'd rather not bound
it until traces show a real impact; if they do, we can cap audit values copied
to spans at 1024 characters in this one method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]