Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Recorder.configure: don't overwrite plugins unless specified #38

Merged
merged 2 commits into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ unreleased
==========
* feature: Use the official middleware pattern for Aiohttp ext. `PR29 <https://github.com/aws/aws-xray-sdk-python/pull/29>`_.
* bugfix: SQLAlcemy plugin would cause warning messages with some db connection strings that contained invalid characters for a segment/subsegment name.
* bugfix: Aiohttp middleware serialized URL values incorrectly `PR37 <https://github.com/aws/aws-xray-sdk-python/pull/37>`_
* bugfix: Aiohttp middleware serialized URL values incorrectly. `PR37 <https://github.com/aws/aws-xray-sdk-python/pull/37>`_
* bugfix: Don't overwrite plugins list on each `.configure` call. `PR38 <https://github.com/aws/aws-xray-sdk-python/pull/38>`_

0.96
====
Expand Down
15 changes: 9 additions & 6 deletions aws_xray_sdk/core/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def configure(self, sampling=None, plugins=None,
:param tuple plugins: plugins that add extra metadata to each segment.
Currently available plugins are EC2Plugin, ECS plugin and
ElasticBeanstalkPlugin.
If you want to disable all previously enabled plugins,
pass an empty tuple ``()``.
:param str context_missing: recorder behavior when it tries to mutate
a segment or add a subsegment but there is no active segment.
RUNTIME_ERROR means the recorder will raise an exception.
Expand Down Expand Up @@ -117,12 +119,13 @@ def configure(self, sampling=None, plugins=None,
if streaming_threshold:
self.streaming_threshold = streaming_threshold

plugin_modules = None
if plugins:
plugin_modules = get_plugin_modules(plugins)
for module in plugin_modules:
module.initialize()
self._plugins = plugin_modules
if plugins is not None:
plugin_modules = None
if plugins:
plugin_modules = get_plugin_modules(plugins)
for module in plugin_modules:
module.initialize()
self._plugins = plugin_modules

def begin_segment(self, name=None, traceid=None,
parent_id=None, sampling=None):
Expand Down