@@ -280,6 +280,22 @@ this crate.
280
280
## Performance
281
281
282
282
// Call out things done specifically for performance
283
+ // Rough draft
284
+
285
+ 1 . ` LogRecord ` is stack allocated and not Boxed unless required by the component
286
+ needing to store it beyond the logging call. (eg: BatchProcessor)
287
+ 2 . LogRecords's Attribute storage is specially designed struct, that holds up to
288
+ five attributes in stack.
289
+ 3 . When passing ` LogRecord ` s to processor, a mutable ref is passed. This allows
290
+ calling multiple processors one after another, without the need for cloning.
291
+ 4 . ` Logger ` provides a ` Enabled ` check which can optimize performance when
292
+ no-one is interested in the log. The check is passed from ` Logger ` to the
293
+ processor, which may consult its exporter to make the decision. An example use
294
+ case - an ETW or user-events exporter can check for the presence of listener and
295
+ convey that decision back to logger, allowing appender to avoid even the cost of
296
+ creating a ` LogRecord ` in the first place if there is no listener. This check is
297
+ done for each log emission, and can react dynamically to changes in interest, by
298
+ enabling/disabling ETW/user-event listener.
283
299
284
300
### Perf test - benchmarks
285
301
@@ -289,6 +305,23 @@ this crate.
289
305
290
306
// Share ~~ numbers
291
307
308
+ ## Internal logs
309
+
310
+ OTel itself is instrumented with ` tracing ` crate to emit internal logs about its
311
+ operations. This is feature gated under "internal-logs", and is enabled by
312
+ default for all components. The ` opentelemetry ` provide few helper macros
313
+ ` otel_warn ` etc., which in turn invokes various ` tracing ` macros like ` warn! `
314
+ etc. The cargo package name will be set as ` target ` when using ` tracing ` . For
315
+ example, logs from ` opentelemetry-otlp ` will have target set to
316
+ "opentelemetry-otlp".
317
+
318
+ The helper macros are part of public API, so can be used by anyone. But it is
319
+ only meant for OTel components itself and anyone writing extensions like custom
320
+ Exporters etc.
321
+
322
+ // TODO: Document the principles followed when selecting severity for internal
323
+ logs // TODO: Document how this can cause circular loop and plans to address it.
324
+
292
325
## Summary
293
326
294
327
- OpenTelemetry Logs does not provide a user-facing logging API.
0 commit comments