Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lightstep/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

# utils constants
SECONDS_TO_MICRO = 1000000
SECONDS_TO_NANOS = 1000000000

# Recorder constants
MAX_LOG_MEMORY = 1024
Expand Down
5 changes: 4 additions & 1 deletion lightstep/http_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from lightstep.collector_pb2 import Auth, ReportRequest, Span, Reporter, KeyValue, Reference, SpanContext
from lightstep.constants import SECONDS_TO_NANOS
from lightstep.converter import Converter
from . import util
from . import version as tracer_version
Expand Down Expand Up @@ -39,9 +40,11 @@ def create_runtime(self, component_name, tags, guid):
def create_span_record(self, span, guid):
span_context = SpanContext(trace_id=span.context.trace_id,
span_id=span.context.span_id)
seconds = int(span.start_time)
nanos = int((span.start_time - seconds) * SECONDS_TO_NANOS)
span_record = Span(span_context=span_context,
operation_name=util._coerce_str(span.operation_name),
start_timestamp=Timestamp(seconds=int(span.start_time)),
start_timestamp=Timestamp(seconds=seconds, nanos=nanos),
duration_micros=int(util._time_to_micros(span.duration)))
if span.parent_id is not None:
reference = span_record.references.add()
Expand Down