Skip to content

Commit

Permalink
Merge pull request #175 from trace4cats/fix/preserve-time-precision
Browse files Browse the repository at this point in the history
Preserve microsecond precision
  • Loading branch information
ybasket authored Jul 19, 2023
2 parents 51ee750 + 5b55050 commit e834750
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.8"
services:
jaeger:
image: jaegertracing/all-in-one:1.36.0
image: jaegertracing/all-in-one:1.46.0
ports:
- "5775:5775/udp"
- "6831:6831/udp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package trace4cats.jaeger

import java.nio.ByteBuffer
import java.util.concurrent.TimeUnit
import java.time.Instant
import java.time.temporal.ChronoUnit

import cats.data.NonEmptyList
import cats.syntax.show._
Expand Down Expand Up @@ -55,8 +56,8 @@ private[jaeger] object JaegerSpan {
def convert(span: CompletedSpan): Span = {
val (traceIdHigh, traceIdLow) = traceIdToLongs(span.context.traceId)

val startMicros = TimeUnit.MILLISECONDS.toMicros(span.start.toEpochMilli)
val endMicros = TimeUnit.MILLISECONDS.toMicros(span.end.toEpochMilli)
val startMicros = ChronoUnit.MICROS.between(Instant.EPOCH, span.start)
val duration = ChronoUnit.MICROS.between(span.start, span.end)

val thriftSpan = new Span(
traceIdLow,
Expand All @@ -69,7 +70,7 @@ private[jaeger] object JaegerSpan {
case SampleDecision.Drop => 1
},
startMicros,
endMicros - startMicros
duration
)

thriftSpan
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package trace4cats.jaeger

import java.time.Instant

import cats.effect.IO
import fs2.Chunk
import org.http4s.blaze.client.BlazeClientBuilder
import trace4cats.model.{Batch, CompletedSpan, TraceProcess}
import trace4cats.test.jaeger.BaseJaegerSpec
import trace4cats.{CompleterConfig, SemanticTags}

import java.time.Instant
import scala.concurrent.duration._

class JaegerHttpSpanCompleterSpec extends BaseJaegerSpec {
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ object Dependencies {
val scala213 = "2.13.8"
val scala3 = "3.3.0"

val trace4cats = "0.14.0"
val trace4cats = "0.14.4"
val trace4catsExporterHttp = "0.14.0"
val trace4catsJaegerIntegrationTest = "0.14.0"
val trace4catsJaegerIntegrationTest = "0.14.2"

val collectionCompat = "2.11.0"
val jaeger = "1.8.1"
Expand Down

0 comments on commit e834750

Please sign in to comment.