[PR #9482/cd2dbbaf backport][stable-10] opentelemetry callback plugin: remove code for Python < 3.7 (#9484)
opentelemetry callback plugin: remove code for Python < 3.7 (#9482)
* opentelemetry callback plugin: remove code for Python < 3.7
* add changelog frag
(cherry picked from commit cd2dbbafcd
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
pull/9488/head
parent
ec9b1fc503
commit
bd4112e87b
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- opentelemetry callback plugin - remove code handling Python versions prior to 3.7 (https://github.com/ansible-collections/community.general/pull/9482).
|
|
@ -137,9 +137,8 @@ import getpass
|
|||
import json
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
from time import time_ns
|
||||
|
||||
from collections import OrderedDict
|
||||
from os.path import basename
|
||||
|
@ -165,14 +164,6 @@ try:
|
|||
from opentelemetry.sdk.trace.export.in_memory_span_exporter import (
|
||||
InMemorySpanExporter
|
||||
)
|
||||
# Support for opentelemetry-api <= 1.12
|
||||
try:
|
||||
from opentelemetry.util._time import _time_ns
|
||||
except ImportError as imp_exc:
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = imp_exc
|
||||
else:
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = None
|
||||
|
||||
except ImportError as imp_exc:
|
||||
OTEL_LIBRARY_IMPORT_ERROR = imp_exc
|
||||
OTEL_LIBRARY_TIME_NS_ERROR = imp_exc
|
||||
|
@ -180,16 +171,6 @@ else:
|
|||
OTEL_LIBRARY_IMPORT_ERROR = None
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
time_ns = time.time_ns
|
||||
elif not OTEL_LIBRARY_TIME_NS_ERROR:
|
||||
time_ns = _time_ns
|
||||
else:
|
||||
def time_ns():
|
||||
# Support versions older than 3.7 with opentelemetry-api > 1.12
|
||||
return int(time.time() * 1e9)
|
||||
|
||||
|
||||
class TaskData:
|
||||
"""
|
||||
Data about an individual task.
|
||||
|
|
Loading…
Reference in New Issue