Skip to content
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

fix(core): prevents CentralizedSamplingStrategy from instatiating extraneous recorders when no origin set #59

Merged
merged 2 commits into from
Feb 5, 2019

Conversation

chrisradek
Copy link
Contributor

Issue #, if available:
#46

Description of changes:

Problem

Currently, when the CentralizedSamplingStrategy is used, the shouldTrace method checks if the provided samplingRequest has a service type provided. If it does not, a default AWSXRayRecorder will be instantiated, and its origin retrieved. This leads to a new recorder being instantiated for every invocation as a worst case.

Background

The origin that gets passed as the serviceType to the SamplingRequest can either be explicitly set on an AWSXRayRecorder, or set by a plugin that is provided to the recorder.

In the current implementation, the user does not have access to the newly created recorder, and so can not explicitly set the origin or add any plugins. The default recorder also does not contain any plugins. This means that we can be sure the origin is never present on the instantiated recorder.

Solution

This change removes the getServiceType() check, and stops attempting to set the service type on the samplingRequest. This has no change on behavior apart from reducing the number of recorders instantiated.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@chrisradek chrisradek merged commit f227f20 into aws:master Feb 5, 2019
@chrisradek chrisradek deleted the fix-spurious-recorders branch February 5, 2019 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants