Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

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

@arkataev

Description

@arkataev
  • 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions