Skip to content

fix: separate pylint config for opentracing example to resolve FIXME - #5037

Closed
chimchim89 wants to merge 27 commits into
open-telemetry:mainfrom
chimchim89:fix/separate-pylint-config
Closed

fix: separate pylint config for opentracing example to resolve FIXME#5037
chimchim89 wants to merge 27 commits into
open-telemetry:mainfrom
chimchim89:fix/separate-pylint-config

Conversation

@chimchim89

@chimchim89 chimchim89 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves the FIXME in docs/examples/opentracing/rediscache.py.

The FIXME noted that # pylint: disable=import-error was needed because the example code was being linted under the main project's tox environment which did not have redis and redis_opentracing installed.

Changes made:

  • Removed FIXME comment and # pylint: disable=import-error from rediscache.py
  • Added lint-opentelemetry-opentracing-example to envlist in tox.ini
  • Added dedicated [testenv:lint-opentelemetry-opentracing-example] section with:
    • Dependencies from docs/examples/opentracing/requirements.txt
    • PYTHONPATH set to example folder so local module rediscache resolves correctly
    • Clean pylint command using root .pylintrc

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Ran the new lint environment:

tox -e lint-opentelemetry-opentracing-example

Result: Your code has been rated at 10.00/10

Ran ruff:

tox -e ruff

Result: all checks passed.

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@chimchim89
chimchim89 requested a review from a team as a code owner April 3, 2026 10:22
@xrmx

xrmx commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@chimchim89 I think you haven't pushed part of what the description says

@xrmx xrmx moved this to Reviewed PRs that need fixes in Python PR digest Apr 3, 2026
@chimchim89

chimchim89 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

@chimchim89 I think you haven't pushed part of what the description says

sorry for the confusion. that was a mistake on my side.

i have pushed the fix.

Comment thread tox.ini Outdated
Comment thread tox.ini Outdated
@chimchim89
chimchim89 force-pushed the fix/separate-pylint-config branch from 8d2c385 to f86bdf0 Compare April 4, 2026 04:55
@tammy-baylis-swi

Copy link
Copy Markdown
Contributor

Thanks! Please also add Changelog entry.

chimchim89 added a commit to chimchim89/opentelemetry-python that referenced this pull request Apr 14, 2026
@chimchim89

Copy link
Copy Markdown
Contributor Author

Thanks! Please also add Changelog entry.

yes, added changelog entry.

@github-project-automation github-project-automation Bot moved this from Reviewed PRs that need fixes to Approved PRs in Python PR digest Apr 14, 2026
MikeGoldsmith and others added 14 commits April 15, 2026 10:27
…-telemetry#4985)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* add TracerProvider creation from declarative config

Implements create_tracer_provider() and configure_tracer_provider() for
the declarative configuration pipeline (tracking issue open-telemetry#3631 step 5).

Key behaviors:
- Never reads OTEL_TRACES_SAMPLER or OTEL_SPAN_*_LIMIT env vars; absent
  config fields use OTel spec defaults (matching Java SDK behavior)
- Default sampler is ParentBased(root=ALWAYS_ON) per the OTel spec
- SpanLimits absent fields use hardcoded defaults (128) not env vars
- configure_tracer_provider(None) is a no-op per spec/Java/JS behavior
- OTLP exporter fields pass None through so the exporter reads its own
  env vars for unspecified values
- Lazy imports for optional OTLP packages with ConfigurationError on missing
- Supports all 4 ParentBased delegate samplers

Assisted-by: Claude Sonnet 4.6

* add changelog entry for PR open-telemetry#4985

Assisted-by: Claude Sonnet 4.6

* fix CI lint/type failures in tracer provider config

- add # noqa: PLC0415 to lazy OTLP imports (ruff also enforces this)
- move SDK imports to top-level (BatchSpanProcessor, etc.)
- convert test helper methods to @staticmethod to satisfy no-self-use
- add pylint: disable=protected-access for private member access in tests
- fix return type annotation on _create_span_processor

Assisted-by: Claude Sonnet 4.6

* fix pylint no-self-use on TestCreateSampler._make_provider

Assisted-by: Claude Sonnet 4.6

* use allowlist for bool coercion in declarative config resource

Assisted-by: Claude Sonnet 4.6

* address review feedback: simplify resource filter and propagator loading

Assisted-by: Claude Sonnet 4.6

* fix ruff formatting

Assisted-by: Claude Sonnet 4.6

* fix pyright: wrap EntryPoints in iter() for next() compatibility

Assisted-by: Claude Sonnet 4.6
open-telemetry#5004)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* wire container resource detector in declarative config

When `resource.detection_development.detectors[].container` is set in
the config file, attempt to use `ContainerResourceDetector` from the
`opentelemetry-resource-detector-containerid` contrib package. Unlike
the process, host, and service detectors which are implemented in the
core SDK, container detection is not available in core. Rather than
adding a hard dependency on the contrib package, we use a lazy import:
if the package is installed it is used transparently; if absent a
warning is logged with an actionable install instruction.

This mirrors the approach taken by other SDKs: JS explicitly skips
container detection when no implementation is available, and PHP also
defers container detection to a contrib package.

See: open-telemetry/opentelemetry-configuration#570

Assisted-by: Claude Sonnet 4.6

* add changelog entry for container resource detector (open-telemetry#5004)

Assisted-by: Claude Sonnet 4.6

* add pylint disables for lazy container import in _resource.py

Assisted-by: Claude Sonnet 4.6

* load container detector via entry point instead of lazy import

Matches the env-var config counterpart (OTEL_EXPERIMENTAL_RESOURCE_DETECTORS)
and avoids a hard import dependency on the contrib package. Tests updated
to mock entry_points instead of sys.modules.

Assisted-by: Claude Sonnet 4.6
…ig (open-telemetry#5002)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* wire host resource detector in declarative config

Makes _HostResourceDetector public as HostResourceDetector and wires
it to detection_development.detectors[].host in _run_detectors().

Assisted-by: Claude Sonnet 4.6

* add changelog entry for host resource detector (open-telemetry#5002)

Assisted-by: Claude Sonnet 4.6

* fix import sort in test_resources.py (ruff)

Assisted-by: Claude Sonnet 4.6

* revert HostResourceDetector to private _HostResourceDetector

Assisted-by: Claude Sonnet 4.6

* Apply suggestion from @xrmx

* Update test_resources.py

* Update _resource.py

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…telemetry#4987)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* add MeterProvider creation from declarative config

Implements create_meter_provider() and configure_meter_provider()
following the same patterns as _tracer_provider.py.

- PeriodicExportingMetricReader with explicit interval/timeout defaults
  (60s/30s) to suppress env var reading
- OTLP HTTP and gRPC metric exporters (lazy imports)
- Console metric exporter
- Temporality preference mapping (cumulative/delta/low_memory) with
  explicit dicts to suppress OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- Default histogram aggregation mapping with env var suppression
- View creation with selector (instrument type/name/unit/meter info)
  and stream (name/description/aggregation/attribute_keys)
- ExemplarFilter mapping; default = TraceBasedExemplarFilter (spec default)
- configure_meter_provider(None) is a no-op per spec/Java/JS behavior
- attribute_keys.excluded logs a warning (SDK View only supports inclusion)
- Pull readers raise ConfigurationError (marked _development in spec)

Assisted-by: Claude Sonnet 4.6

* add changelog entry for meter provider declarative config (open-telemetry#4987)

Assisted-by: Claude Sonnet 4.6

* fix linter errors

* address review feedback: simplify resource filter, propagator loading, and type annotations

Assisted-by: Claude Sonnet 4.6

* fix ruff formatting

Assisted-by: Claude Sonnet 4.6

* fix pyright: wrap EntryPoints in iter() for next() compatibility

Assisted-by: Claude Sonnet 4.6
* chore: update readme

* fix plural
* feat: add experimental LoggerConfigurator

* update SDK configuration to utilize logger configurator

* generalize rule based configurator

* add safe logger configurator application

* add unit tests

* update CHANGELOG.md

* update type annotation for active loggers

* Address PR comments.

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Update version to 1.42.0.dev/0.63b0.dev

* Update __init__.py

---------

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…5062)

While at it remove an excluded file from typechecking that has no errors.
…onfig (open-telemetry#5003)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* wire service resource detector in declarative config

Adds service detector support to _run_detectors(): sets a random UUID
for service.instance.id and reads OTEL_SERVICE_NAME for service.name
if set. Explicit config attributes still take priority (merged last).

Assisted-by: Claude Sonnet 4.6

* add changelog entry for service resource detector (open-telemetry#5003)

Assisted-by: Claude Sonnet 4.6

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
…ne test more robust (open-telemetry#5081)

Instead of sleeping mock time_ns so that we can exercise the path
more deterministically. Hopefully it'll help on platforms were time is
not so precise like PyPy / windows.

Assisted-by: Copilot
emdneto and others added 5 commits April 15, 2026 10:27
* Drop python 3.9 support

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* fix

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* fix exporter requirements.txt

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* do not skip  in pypy+windows

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* pin requirements

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* pin based on py version

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* revert argument name

* fix broken links in README.md

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* fix sdk configuration models

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* fix codegen and opentelemetry-proto-json

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* add changelo

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* remove helper script to fix typealias for datamodel-codegen

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* revert proto-json version

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* Apply suggestion from @emdneto

* Apply suggestion from @xrmx

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Add logger exception support for logs API/SDK

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Apply changes requested in code review

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix CI

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix ci

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Apply feedback from code review

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix lint

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Remove unrelated entry from changelog

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix lint

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix lint

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

---------

Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Mike Goldsmith <goldsmith.mike@gmail.com>
…-telemetry#4990)

* config: add resource and propagator creation from declarative config

Implements create_resource() and create_propagator()/configure_propagator()
for the declarative file configuration. Resource creation does not read
OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior).
Propagator configuration always calls set_global_textmap to override Python's
default tracecontext+baggage, setting a noop CompositePropagator when no
propagator is configured.

Assisted-by: Claude Sonnet 4.6

* update changelog with PR number

Assisted-by: Claude Sonnet 4.6

* fix pylint, pyright and ruff errors in resource/propagator config

- _resource.py: refactor _coerce_attribute_value to dispatch table to
  avoid too-many-return-statements; fix short variable names k/v ->
  attr_key/attr_val; fix return type of _sdk_default_attributes to
  dict[str, str] to satisfy pyright
- _propagator.py: rename short variable names e -> exc, p -> propagator
- test_resource.py: move imports to top level; split TestCreateResource
  (25 methods) into three focused classes to satisfy too-many-public-methods
- test_propagator.py: add pylint disable for protected-access

Assisted-by: Claude Sonnet 4.6

* address review feedback: use _DEFAULT_RESOURCE, fix bool_array coercion

- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module
- move _coerce_bool into dispatch tables for both scalar and array bool types,
  fixing a bug where bool_array with string values like "false" would coerce
  incorrectly via plain bool() (non-empty string -> True)
- add test for bool_array with string values to cover the bug

Assisted-by: Claude Sonnet 4.6

* fix linter

* address review feedback: single coercion table, simplify attributes merge

- collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS
  dict using an _array() factory, reducing _coerce_attribute_value to two lines
- process attributes_list before attributes so explicit attributes naturally
  overwrite list entries without needing an explicit guard

Assisted-by: Claude Sonnet 4.6

* use Callable type annotation on _array helper

Assisted-by: Claude Sonnet 4.6

* add detection infrastructure foundations for resource detectors

Adds _run_detectors() stub and _filter_attributes() to create_resource(),
providing the shared scaffolding for detector PRs to build on. Detectors
are opt-in: nothing runs unless explicitly listed under
detection_development.detectors in the config. The include/exclude
attribute filter mirrors other SDK behaviour.

Assisted-by: Claude Sonnet 4.6

* move service.name default into base resource

Merges service.name=unknown_service into base before running detectors,
so detectors (e.g. service) can override it. Previously it was added to
config_attrs and merged last, which would have silently overridden any
detector-provided service.name.

Assisted-by: Claude Sonnet 4.6

* remove unused logging import from _propagator.py

Assisted-by: Claude Sonnet 4.6

* add create_logger_provider/configure_logger_provider for declarative config

Implements LoggerProvider instantiation from declarative config files,
following the same env-var-suppression pattern as create_meter_provider.
BatchLogRecordProcessor defaults use spec values (1000ms schedule_delay),
overriding the Python SDK's incorrect 5000ms env-var default.

Assisted-by: Claude Sonnet 4.6

* add changelog entry for logger provider declarative config (open-telemetry#4990)

Assisted-by: Claude Sonnet 4.6

* fix linter errors

* add test verifying OTEL_PROPAGATORS env var is ignored by configure_propagator

Assisted-by: Claude Sonnet 4.6

* remove backwards compat re-export of ConfigurationError from _loader.py

Import directly from _exceptions.py since this is new code with no existing
dependents on the _loader module path.

Assisted-by: Claude Sonnet 4.6

* address review feedback: simplify resource filter and propagator loading

Assisted-by: Claude Sonnet 4.6

* fix ruff formatting

Assisted-by: Claude Sonnet 4.6

* fix pyright: wrap EntryPoints in iter() for next() compatibility

Assisted-by: Claude Sonnet 4.6

* remove stale SDK bug note fixed in v1.41.0

Assisted-by: Claude Sonnet 4.6

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
@chimchim89
chimchim89 force-pushed the fix/separate-pylint-config branch from 0800fea to 40c54fb Compare April 15, 2026 06:58
Comment thread CHANGELOG.md
([#5076](https://github.com/open-telemetry/opentelemetry-python/pull/5076))
- `opentelemetry-semantic-conventions`: use `X | Y` union annotation
([#5096](https://github.com/open-telemetry/opentelemetry-python/pull/5096))
- Fix separate pylint config for opentracing example to resolve `# pylint: disable=import-error` workaround

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should now be put into .changelog/5037.fixed, please refer to CONTRIBUTING.md

@xrmx xrmx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, not sure we gained much with linting those files though 😅

@aabmass aabmass moved this from Approved PRs to Approved PRs that need fixes in Python PR digest May 20, 2026
@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label May 30, 2026
@github-actions

Copy link
Copy Markdown

This PR has been closed due to inactivity. Please reopen if you would like to continue working on it.

@github-actions github-actions Bot closed this Jun 13, 2026
@github-project-automation github-project-automation Bot moved this from Approved PRs that need fixes to Done in Python PR digest Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants