-
Notifications
You must be signed in to change notification settings - Fork 691
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
Add configuration of log level and formatting for Auto Instrumentation #4203
base: main
Are you sure you want to change the base?
Conversation
a0b79f8
to
e641e75
Compare
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
According to the specification, The logging config should only apply to the |
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
d8924e5
to
e7f0f9e
Compare
I see your point. I'll bring up in the next sig. Since this is a broader matter, I have also made an issue to make sure we tackle this before logging stability. |
Added tests. |
opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py
Outdated
Show resolved
Hide resolved
e7f0f9e
to
526b640
Compare
@@ -665,9 +677,151 @@ def test_logging_init_exporter(self): | |||
getLogger(__name__).error("hello") | |||
self.assertTrue(provider.processor.exporter.export_called) | |||
|
|||
@patch.dict(environ, {}, clear=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a test passing an invalid log level value and getting INFO set.
{"OTEL_RESOURCE_ATTRIBUTES": "service.name=otlp-service"}, | ||
{ | ||
"OTEL_RESOURCE_ATTRIBUTES": "service.name=otlp-service", | ||
"OTEL_LOG_LEVEL": "CUSTOM_LOG_LEVEL", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this line have an effect since the next line is patching _get_log_level
?
) | ||
self.assertEqual(self.set_provider_mock.call_count, 1) | ||
provider = self.set_provider_mock.call_args[0][0] | ||
self.assertIsInstance(provider, DummyLoggerProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about these assertions? Do we want to keep just the ones that test the changes in this PR?
Description
DRAFT: Proposal for adding configuration of log level and formatting for Auto Instrumentation. Main subject to decide on is which env vars to use:
OTEL_LOG_LEVEL: Exists in the SDK but unused
OTEL_PYTHON_LOG_LEVEL: Currently only used by Python Logging Instrumentation
OTEL_PYTHON_LOG_FORMAT: Currently only used by Python Logging Instrumentation
Fixes #4034
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: