I have been working on implementing SDK metrics. Currently, it is implemented to count only emitted logs in Java and I am working on the same implementation for other languages.
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLogRecordBuilder.java#L152
The question came up in JS on whether we should apply this to filtered logs or not
open-telemetry/opentelemetry-js#6433 (comment)
I suspect the answer for the current conventions that don't define attributes is no. But it seems reasonable that filtered logs are also counted somehow. A couple of approaches
- Define a new
otel.sdk.log.filtered metric for filtered logs
- Define an attribute,
otel.log.enabled to set to true or false for filtered or emitted logs.
The second proposal is more consistent with otel.sdk.span.started, however one can argue that spans are always started and ended, even when non-recording, while filtered logs are not actually created so shouldn't be in the counter.
I have been working on implementing SDK metrics. Currently, it is implemented to count only emitted logs in Java and I am working on the same implementation for other languages.
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLogRecordBuilder.java#L152
The question came up in JS on whether we should apply this to filtered logs or not
open-telemetry/opentelemetry-js#6433 (comment)
I suspect the answer for the current conventions that don't define attributes is no. But it seems reasonable that filtered logs are also counted somehow. A couple of approaches
otel.sdk.log.filteredmetric for filtered logsotel.log.enabledto set to true or false for filtered or emitted logs.The second proposal is more consistent with
otel.sdk.span.started, however one can argue that spans are alwaysstartedandended, even when non-recording, while filtered logs are not actuallycreatedso shouldn't be in the counter.