Skip to content

Commit 140c697

Browse files
authored
Merge pull request #1158 from hughsimpson/bump_otel
Bump opentelemetry dependencies
2 parents a9b9f3c + ed28e43 commit 140c697

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

build.sbt

+4-2
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,10 @@ lazy val `kamon-opentelemetry` = (project in file("reporters/kamon-opentelemetry
748748
.settings(
749749
crossScalaVersions += `scala_3_version`,
750750
libraryDependencies ++= Seq(
751-
"io.opentelemetry" % "opentelemetry-exporter-otlp-http-trace" % "1.11.0",
752-
"io.opentelemetry" % "opentelemetry-exporter-otlp-trace" % "1.11.0",
751+
"io.opentelemetry" % "opentelemetry-exporter-otlp-http-trace" % "1.13.0",
752+
"io.opentelemetry" % "opentelemetry-exporter-otlp-trace" % "1.13.0",
753+
// Compile-time dependency required in scala 3
754+
"com.google.auto.value" % "auto-value-annotations" % "1.9" % "compile",
753755

754756
scalatest % "test",
755757
logbackClassic % "test"

reporters/kamon-opentelemetry/src/main/scala/kamon/otel/SpanConverter.scala

+7-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import scala.collection.JavaConverters._
2424

2525
import io.opentelemetry.api.common.{AttributeKey, Attributes}
2626
import io.opentelemetry.api.trace._
27-
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo
27+
import io.opentelemetry.sdk.common.{InstrumentationLibraryInfo, InstrumentationScopeInfo}
2828
import io.opentelemetry.sdk.resources.Resource
2929
import io.opentelemetry.sdk.trace.data.{EventData, LinkData, SpanData, StatusData}
3030
import kamon.tag.{Lookups, Tag, TagSet}
@@ -34,8 +34,8 @@ import kamon.trace.{Identifier, Span}
3434

3535

3636
class SpanWrapper(includeErrorEvent: Boolean, resource: Resource, kamonVersion: String, span: Span.Finished) extends SpanData {
37-
private val instrumentationLibraryInfo: InstrumentationLibraryInfo =
38-
InstrumentationLibraryInfo.create(span.metricTags.get(Lookups.option(Span.TagKeys.Component)) getOrElse "kamon-instrumentation", kamonVersion)
37+
private val instrumentationScopeInfo: InstrumentationScopeInfo =
38+
InstrumentationScopeInfo.create(span.metricTags.get(Lookups.option(Span.TagKeys.Component)) getOrElse "kamon-instrumentation", kamonVersion, null)
3939
private val sampled: Boolean = span.trace.samplingDecision == Sample
4040
private val attachErrorEvent: Boolean = includeErrorEvent && span.hasError
4141

@@ -78,7 +78,10 @@ class SpanWrapper(includeErrorEvent: Boolean, resource: Resource, kamonVersion:
7878

7979
override def getTotalAttributeCount: Int = getAttributes.size()
8080

81-
override def getInstrumentationLibraryInfo: InstrumentationLibraryInfo = instrumentationLibraryInfo
81+
override def getInstrumentationLibraryInfo: InstrumentationLibraryInfo =
82+
InstrumentationLibraryInfo.create(instrumentationScopeInfo.getName, instrumentationScopeInfo.getVersion)
83+
84+
override def getInstrumentationScopeInfo: InstrumentationScopeInfo = instrumentationScopeInfo
8285

8386
override def getResource: Resource = resource
8487
}

reporters/kamon-opentelemetry/src/test/scala/kamon/otel/OpenTelemetryTraceReporterSpec.scala

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ class OpenTelemetryTraceReporterSpec extends AnyWordSpec with Matchers with Opti
6868
instance should contain(s"kamon-test-application@${host.get}")
6969

7070
//assert instrumentation labels
71+
val instrumentationScopeInfo = spanData.getInstrumentationScopeInfo
72+
instrumentationScopeInfo.getName should be("kamon-instrumentation")
73+
instrumentationScopeInfo.getVersion should be(kamonVersion)
74+
instrumentationScopeInfo.getSchemaUrl should be(null)
75+
// deprecated
7176
val instrumentationLibraryInfo = spanData.getInstrumentationLibraryInfo
7277
instrumentationLibraryInfo.getName should be("kamon-instrumentation")
7378
instrumentationLibraryInfo.getVersion should be(kamonVersion)

reporters/kamon-opentelemetry/src/test/scala/kamon/otel/SpanConverterSpec.scala

+6-1
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ class SpanConverterSpec extends AnyWordSpec with Matchers with Utils {
147147
resourceSpans.head.getResource.getAttributes.asMap().asScala should contain(AttributeKey.stringKey("telemetry.sdk.language"), "scala")
148148
resourceSpans.head.getResource.getAttributes.asMap().asScala should contain(AttributeKey.stringKey("telemetry.sdk.version"), "0.0.0")
149149

150-
val instInfo = resourceSpans.head.getInstrumentationLibraryInfo
150+
val scopeInfo = resourceSpans.head.getInstrumentationScopeInfo
151151
//assert instrumentation labels
152+
scopeInfo.getName should be("some-instrumentation-library")
153+
scopeInfo.getVersion should be("0.0.0")
154+
scopeInfo.getSchemaUrl should be(null)
155+
// deprecated
156+
val instInfo = resourceSpans.head.getInstrumentationLibraryInfo
152157
instInfo.getName should be("some-instrumentation-library")
153158
instInfo.getVersion should be("0.0.0")
154159

0 commit comments

Comments
 (0)