Skip to content

Commit

Permalink
Merge pull request #6 from jtjeferreira/master
Browse files Browse the repository at this point in the history
add support for DoubleSizeIdentifier
  • Loading branch information
ivantopo committed Jun 26, 2019
2 parents 380287a + 256c15a commit 368ab93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.2.8
3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
lazy val root: Project = project.in(file(".")).dependsOn(latestSbtUmbrella)
lazy val latestSbtUmbrella = uri("git://github.com/kamon-io/kamon-sbt-umbrella.git")
lazy val root: Project = project in file(".") dependsOn(RootProject(uri("git://github.com/kamon-io/kamon-sbt-umbrella.git")))
14 changes: 12 additions & 2 deletions src/main/scala/kamon/jaeger/JaegerReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ class JaegerClient(host: String,
val duration =
Math.floorDiv(Clock.nanosBetween(kamonSpan.from, kamonSpan.to), 1000)

val (traceIdHigh, traceIdLow) = convertDoubleSizeIdentifier(context.traceID)
val convertedSpan = new JaegerSpan(
convertIdentifier(context.traceID),
0L,
traceIdLow,
traceIdHigh,
convertIdentifier(context.spanID),
convertIdentifier(context.parentID),
kamonSpan.operationName,
Expand Down Expand Up @@ -136,4 +137,13 @@ class JaegerClient(host: String,
// Assumes that Kamon was configured to use the default identity generator.
ByteBuffer.wrap(identifier.bytes).getLong
}.getOrElse(0L)

private def convertDoubleSizeIdentifier(
identifier: Identifier): (Long, Long) =
Try {
val buffer = ByteBuffer.wrap(identifier.bytes)
(buffer.getLong, buffer.getLong)
}.getOrElse {
(0L, convertIdentifier(identifier))
}
}

0 comments on commit 368ab93

Please sign in to comment.