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

calculate_sampling_decision has changed input fields. #1

Open
bendog opened this issue Feb 20, 2019 · 0 comments · May be fixed by #2
Open

calculate_sampling_decision has changed input fields. #1

bendog opened this issue Feb 20, 2019 · 0 comments · May be fixed by #2

Comments

@bendog
Copy link

bendog commented Feb 20, 2019

Hey,

I know this probably won't get a lot of traction as apistar is pretty much abandoned now, but i've noticed an incompatibility with aws-xray-sdk and your code.

error message:

TypeError: calculate_sampling_decision() got an unexpected keyword argument 'service_name'

call in apistar-aws-xray.AWSXrayEventHook

sampling_decision = calculate_sampling_decision(
            trace_header=xray_header,
            recorder=self._recorder,
            service_name=host,
            method=method,
            path=path
        )

in aws_xray_sdk.ext.util

def calculate_sampling_decision(trace_header, recorder, sampling_req):
    """
    Return 1 or the matched rule name if should sample and 0 if should not.
    The sampling decision coming from ``trace_header`` always has
    the highest precedence. If the ``trace_header`` doesn't contain
    sampling decision then it checks if sampling is enabled or not
    in the recorder. If not enbaled it returns 1. Otherwise it uses user
    defined sampling rules to decide.
    """
    if trace_header.sampled is not None and trace_header.sampled != '?':
        return trace_header.sampled
    elif not recorder.sampling:
        return 1
    else:
        decision = recorder.sampler.should_trace(sampling_req)
    return decision if decision else 0
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 a pull request may close this issue.

1 participant