Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ endif::[]
* Fix for Starlette/FastAPI to correctly capture request bodies as strings {pull}1042[#1041]
* Fix transaction names for Starlette Mount routes {pull}1037[#1037]
* Fix for elastic excepthook arguments {pull}1050[#1050]
* Fix issue with remote configuration when resetting config values {pull}1068[#1068]


[[release-notes-6.x]]
Expand Down
2 changes: 1 addition & 1 deletion elasticapm/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def reset(self):
"""
callbacks = []
for key in compat.iterkeys(self._config.values):
if self._config.values[key] != self._first_config.values[key]:
if key in self._first_config.values and self._config.values[key] != self._first_config.values[key]:
callbacks.append((key, self._config.values[key], self._first_config.values[key]))

with self._lock:
Expand Down
13 changes: 13 additions & 0 deletions tests/config/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,19 @@ class MyConfig(_ConfigBase):
assert test_var["foo"] == 3


def test_reset_after_adding_config():
class MyConfig(_ConfigBase):
foo = _ConfigValue("foo")
bar = _ConfigValue("bar")

c = VersionedConfig(MyConfig({"foo": "baz"}), version=1)

c.update(version=2, bar="bazzinga")

c.reset()
assert c.bar is None


def test_valid_values_validator():
# Case sensitive
v = EnumerationValidator(["foo", "Bar", "baz"], case_sensitive=False)
Expand Down