-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small cleanup in Logs SDK. #1850
Conversation
Could we just remove those methods instead of force using them just to avoid the "unused" warnings? |
Yes, thought of doing that, but just kept it to be consistent with recent traces changes #1755. And open to remove from both signals if we see them bloating the code. |
I would be in favor of removing unused methods instead of keeping them around. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1850 +/- ##
=======================================
- Coverage 74.4% 74.4% -0.1%
=======================================
Files 122 122
Lines 19800 19802 +2
=======================================
- Hits 14750 14749 -1
- Misses 5050 5053 +3 ☔ View full report in Codecov by Sentry. |
I have some code rely on this API: for processor in provider.log_processors() {
let record = record.clone();
let mut data = opentelemetry_sdk::export::logs::LogData {
record,
instrumentation: self.instrumentation_library().clone(),
};
processor.emit(&mut data);
} It seems no migration is provided? |
Rewrite with let provider = self.provider.clone();
let logger = provider.library_logger(self.library.clone());
let mut record = opentelemetry_sdk::logs::LogRecord::default();
record.observed_timestamp = Some(SystemTime::now());
record.severity_number = Some(log_level_to_otel_severity(log_record.level()));
record.severity_text = Some(log_record.level().as_str().into());
record.body = Some(AnyValue::from(log_record.args().to_string()));
logger.emit(record);
Ok(()) |
@tisonkun OTel Logging Bridge is NOT meant for end users to use. It is only meant for authoring log-bridges(appenders) only. Are you using OTel Logging Bridge to report logs in your application? |
Changes
LoggerProvider::log_processors()
visibility to crate scope.LoggerProvider::resource()
visibility to crate scope.LoggerProvider
, and then propagate the resource to the processor, to address below warning after above scope changes:Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes