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

opencensus-ext-azure trace_exported request.success value is always False on Python2 #764

Closed
arkataev opened this issue Aug 16, 2019 · 10 comments
Assignees
Labels
azure Microsoft Azure bug

Comments

@arkataev
Copy link

  • Python 2.7.13
  • django==1.11.20
  • opencensus == 0.7.1
  • opencensus-ext-django == 0.7.0
  • opencensus-ext-azure == 0.7.0

Looks like on Python2 exported request success status is wrong, because of objects comparison on this line

Steps to reproduce.
data.success = (status_code >= 200 and status_code <= 399)

if status_code type is string, than:

>>> ("200" >= 200 and "200" <= 399)
>>> False

since in python2 int is always less than str

Otherwise:
>>> (200 >= 200 and 200 <= 399)
>>> True

This mainly affects all requests success status displayed in Azure Monitor Log which is set to False

@arkataev arkataev added the bug label Aug 16, 2019
@reyang
Copy link
Contributor

reyang commented Aug 16, 2019

This is a known issue, which is being fixed by #755.

@reyang reyang added the azure Microsoft Azure label Aug 16, 2019
@reyang
Copy link
Contributor

reyang commented Aug 16, 2019

@victoraugustolls FYI.

@RocketPuppy
Copy link

I realize this issue is for Python2, but I think in Python3 the same issue manifests as an exception, TypeError: '>=' not supported between instances of 'str' and 'int', right? Or am I encountering something else?

@reyang
Copy link
Contributor

reyang commented Aug 16, 2019

@RocketPuppy you're right.

@victoraugustolls
Copy link
Contributor

@RocketPuppy yes, but the main issue is that status code is being sent as a string, but it should be ant int. This is fixed in #755 !

@RocketPuppy
Copy link

While that PR is in progress, is there a workaround available?

@reyang
Copy link
Contributor

reyang commented Aug 21, 2019

@RocketPuppy #755 got merged today. We will do a hotfix release. Closing the issue now.
If you cannot wait for the hotfix release, there is a way to install the package from master branch directly:

pip install "git+https://github.com/census-instrumentation/opencensus-python.git@master#subdirectory=context/opencensus-context"
pip install "git+https://github.com/census-instrumentation/opencensus-python.git@master"
# add your packages (e.g. opencensus-ext-azure) based on what's needed
...

@lzchen need your help to do a hotfix release. Thanks.

@reyang reyang closed this as completed Aug 21, 2019
@RocketPuppy
Copy link

@reyang I'd like to plan when I can go live with my application monitoring in production. Do you know when that release is going to be done? I don't see anything updated on pypi or the github releases yet.

@lzchen
Copy link
Contributor

lzchen commented Aug 26, 2019

@RocketPuppy I will be doing a release today!

@lzchen
Copy link
Contributor

lzchen commented Aug 26, 2019

@RocketPuppy Packages are up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure Microsoft Azure bug
Projects
None yet
Development

No branches or pull requests

5 participants