Skip to content

Commit aa65b03

Browse files
committed
ext to instrumentation naming
1 parent 94783ea commit aa65b03

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ext/opentelemetry-instrumentation-utils/src/opentelemetry/instrumentation/utils/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
from opentelemetry.trace.status import Status, StatusCanonicalCode
2222

2323

24-
def http_status_to_canonical_code(status: int) -> StatusCanonicalCode:
24+
def http_status_to_canonical_code(
25+
status: int, allow_redirect: bool = True
26+
) -> StatusCanonicalCode:
2527
"""Converts an HTTP status code to an OpenTelemetry canonical status code
2628
2729
Args:
@@ -30,8 +32,12 @@ def http_status_to_canonical_code(status: int) -> StatusCanonicalCode:
3032
# pylint:disable=too-many-branches,too-many-return-statements
3133
if status < 100:
3234
return StatusCanonicalCode.UNKNOWN
33-
if status <= 399:
35+
if status <= 299:
3436
return StatusCanonicalCode.OK
37+
if status <= 399:
38+
if allow_redirect:
39+
return StatusCanonicalCode.OK
40+
return StatusCanonicalCode.DEADLINE_EXCEEDED
3541
if status <= 499:
3642
if status == 401: # HTTPStatus.UNAUTHORIZED:
3743
return StatusCanonicalCode.UNAUTHENTICATED

ext/opentelemetry-instrumentation-utils/src/opentelemetry/instrumentation/utils/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.8.dev0"
15+
__version__ = "0.9.dev0"

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ envlist =
9292
pypy3-test-ext-sqlite3
9393

9494
; opentelemetry-instrumentation-utils
95-
py3{5,6,7,8}-test-ext-utils
96-
pypy3-test-ext-utils
95+
py3{5,6,7,8}-test-instrumentation-utils
96+
pypy3-test-instrumentation-utils
9797

9898
; opentelemetry-ext-wsgi
9999
py3{4,5,6,7,8}-test-ext-wsgi
@@ -168,7 +168,7 @@ changedir =
168168
test-ext-pymysql: ext/opentelemetry-ext-pymysql/tests
169169
test-ext-asgi: ext/opentelemetry-ext-asgi/tests
170170
test-ext-sqlite3: ext/opentelemetry-ext-sqlite3/tests
171-
test-ext-utils: ext/opentelemetry-instrumentation-utils/tests
171+
test-instrumentation-utils: ext/opentelemetry-instrumentation-utils/tests
172172
test-ext-wsgi: ext/opentelemetry-ext-wsgi/tests
173173
test-ext-zipkin: ext/opentelemetry-ext-zipkin/tests
174174
test-ext-boto: ext/opentelemetry-ext-boto/tests
@@ -187,7 +187,7 @@ commands_pre =
187187
; cases but it saves a lot of boilerplate in this file.
188188
test: pip install {toxinidir}/opentelemetry-api {toxinidir}/opentelemetry-sdk {toxinidir}/tests/util
189189
; Install common utils package for all ext/ tests
190-
ext: pip install {toxinidir}/ext/opentelemetry-instrumentation-utils
190+
ext,instrumentation: pip install {toxinidir}/ext/opentelemetry-instrumentation-utils
191191

192192
test-auto-instrumentation: pip install {toxinidir}/opentelemetry-auto-instrumentation
193193

0 commit comments

Comments
 (0)