Skip to content

Commit 3d33d80

Browse files
authored
add start_stop_order to VersionedConfig.__slots__ (#1149)
This ensures that the attribute is set on VersionedConfig itself, not on the proxied Config object. The later works, but only until the configuration is updated and the Config object is switched out with a new one that doesn't have the attribute. fixes #1147
1 parent c5fe646 commit 3d33d80

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

elasticapm/conf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ class VersionedConfig(ThreadManager):
647647
"transport",
648648
"_update_thread",
649649
"pid",
650+
"start_stop_order",
650651
)
651652

652653
def __init__(self, config_object, version, transport=None):

tests/config/tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,13 @@ def test_valid_values_validator():
428428
assert v("Bar", "foo") == "Bar"
429429
with pytest.raises(ConfigurationError):
430430
v("foobar", "foo")
431+
432+
433+
def test_versioned_config_attribute_access(elasticapm_client):
434+
# see https://github.com/elastic/apm-agent-python/issues/1147
435+
val = elasticapm_client.config.start_stop_order
436+
assert isinstance(val, int)
437+
# update config to ensure start_stop_order isn't read from the proxied Config object
438+
elasticapm_client.config.update("2", capture_body=True)
439+
val = elasticapm_client.config.start_stop_order
440+
assert isinstance(val, int)

0 commit comments

Comments
 (0)