Releases: typelevel/otel4s
v0.6.0
We are happy to announce the 0.6.0
release.
Apart from the API improvements and dependency upgrades, there are several new documentation articles:
Note
The otel4s-core
and otel4s-oteljava
modules are binary compatible with 0.5.0
lineage.
Warning
The otel4s-sdk-exporter
has several breaking changes and is binary incompatible with the 0.5.0
lineage.
New API
Span#addLink
You can add a link to another span by using addLink
:
val span: Span[F] = ???
val link: SpanContext = ???
span.addLink(link)
OtlpSpanExporterAutoConfigure.customClient
You can supply a preconfigured http4s client to use with the OTLP span exporter. For example, you can provide a JDK11 HTTP client with configured proxy support:
import java.net.{InetSocketAddress, ProxySelector}
import java.net.http.HttpClient
import org.http4s.jdkhttpclient.JdkHttpClient
val jdkHttpClient = HttpClient
.newBuilder()
.proxy(ProxySelector.of(InetSocketAddress.createUnresolved("localhost", 3312)))
.build()
OpenTelemetrySdk.autoConfigured[IO](
_.addSpanExporterConfigurer(
OtlpSpanExporterAutoConfigure.customClient[IO](JdkHttpClient(jdkHttpClient))
)
).use { sdk =>
???
}
New stable semantic conventions
The semantic conventions have been updated to 1.25.0-alpha. There are several attributes are stable now:
What's Changed
Improvements and enhancements
- sdk-exporter: allow passing a custom client to the
OtlpSpanExporterAutoConfigure
by @iRevive in #578 - trace: add
addLink
toSpan
by @iRevive in #587
Documentation
- Mention the noop tracer for people who just want to use a otel4s enabled library by @benhutchison in #577
- docs: use
otlp/jaeger
exporter in the 'Grafana - All-in-one' example by @iRevive in #580 - docs: add
Metrics
doc to the instrumentation section by @iRevive in #581 - docs: add
Metrics | JVM Runtime
doc to the instrumentation section by @iRevive in #582 - docs: advice on Honeycomb environments and datasets by @jessitron in #597
- Docs: separate Scala 2 / Scala 3 examples of the no-op tracer by @iRevive in #590
Internal
sdk-metrics
module (unpublished yet)
- sdk-metrics: add
InstrumentDescriptor
by @iRevive in #572 - sdk-metrics: add
PointData
by @iRevive in #566 - sdk-metrics: add
InstrumentSelector
by @iRevive in #571 - sdk-metrics: add
AttributesProcessor
by @iRevive in #574 - sdk-metrics: add
MetricPoints
by @iRevive in #583
Upgrades
- Update opentelemetry-api, ... to 1.37.0 by @typelevel-steward in #584
- Update sbt-scalajs, scalajs-compiler, ... to 1.16.0 by @typelevel-steward in #576
- Update opentelemetry-semconv to 1.25.0-alpha by @typelevel-steward in #585
- Update opentelemetry-javaagent to 2.3.0 by @typelevel-steward in #593
- Update opentelemetry-instrumentation-annotations to 2.3.0 by @typelevel-steward in #592
- Update munit-cats-effect to 2.0.0-M5 by @typelevel-steward in #595
New Contributors
- @benhutchison made their first contribution in #577
- @jessitron made their first contribution in #597
Full Changelog: v0.5.0...v0.6.0
v0.5.0
We are happy to announce the 0.5.0
release.
This release brings new features, significant API improvements, and breaking changes.
The SDK tracing modules are now publicly available. Check out the documentation.
Kudos to @NthPortal for numerous API improvements and for making this release happen.
Warning
This version has several breaking changes and is binary incompatible with the 0.4.0
lineage.
Note
Public Scala Steward will rename the artifacts automatically (see the changes below).
Tip
Use the scalafix rule to simplify the migration:
$ sbt "scalafix dependency:V0_5_0Rewrites@org.typelevel:otel4s-scalafix:0.5.0"
Artifacts replacement and package changes
For better clarity, we decided to rename the following artifacts:
otel4s-java
tootel4s-oteljava
otel4s-testkit-metrics
tootel4s-oteljava-metrics-testkit
- libraryDependencies += "org.typelevel" %% "otel4s-java" % "0.4.0"
+ libraryDependencies += "org.typelevel" %% "otel4s-oteljava" % "0.5.0-RC1"
- libraryDependencies += "org.typelevel" %% "otel4s-testkit-metrics" % "0.4.0"
+ libraryDependencies += "org.typelevel" %% "otel4s-oteljava-metrics-testkit" % "0.5.0-RC1"
The package is renamed, too:
- import org.typelevel.otel4s.java._
+ import org.typelevel.otel4s.oteljava._
The localForIOLocal
is moved to a new package
- import org.typelevel.otel4s.java.instances._
+ import org.typelevel.otel4s.instances.local._
Trace Status
is renamed to the StatusCode
- import org.typelevel.otel4s.trace.Status
+ import org.typelevel.otel4s.trace.StatusCode
Semantic conventions updated to the 1.24.0
There are several major breaking changes:
- The experimental (incubating) attributes are moved to a separate module
semconv-experimental
. - Attributes are organized by root namespaces.
Previously, there were two super-objectsResourceAttributes
andSemanticAttributes
.
Now,http.request.header
attribute lives in theHttpAttributes
object. - The package has changed from
org.typelevel.otel4s.semconv.trace
toorg.typelevel.otel4s.semconv
. - All old attributes that were removed from semantic-conventions (without being deprecated there) have been removed
The stable attributes (for exampleJvmAttributes.scala) are distributed in the otel4s-semconv
package:
libraryDependencies += "org.typelevel" %% "otel4s-semconv" % "0.5.0"
However, If you want to use experimental attributes, for example GraphqlExperimentalAttributes.scala, the following dependency is mandatory:
libraryDependencies += "org.typelevel" %% "otel4s-semconv-experimental" % "0.5.0"
Metrics API changes
New generic instrument builders
The instrument builders now require an explicit instrument type:
- val counter = Meter[F].counter("counter").create
+ val counter = Meter[F].counter[Long]("counter").create
- val histogram = Meter[F].histogram("histogram").create
+ val histogram = Meter[F].histogram[Double]("histogram").create
While there is a drawback, this approach allows us to provide a flexible API:
val longCounter: F[Counter[F, Long]] = Meter[F].counter[Long]("counter").create
val doubleCounter: F[Counter[F, Double]] = Meter[F].counter[Double]("counter").create
val longHistogram: F[Histogram[F, Long]] = Meter[F].histogram[Long]("histogram").create
val doubleHistogram: F[Histogram[F, Double]] = Meter[F].histogram[Double]("histogram").create
val doubleGauge: Resource[F, ObservableGauge] =
Meter[F].observableGauge[Double]("double-gauge").create(Sync[F].delay(List(Measurement(1.0))))
val longGauge: Resource[F, ObservableGauge] =
Meter[F].observableGauge[Long]("long-gauge").create(Sync[F].delay(List(Measurement(1L))))
As a result, instruments are also available for (almost) any type now.
The underlying type still denotes to either Long
or Double
. But you can still use a wrapper type:
final case class OpaqueWrapper(value: Long)
implicit val measurementValue: MeasurementValue[OpaqueWrapper] = MeasurementValue[Long].contramap(_.value)
for {
counter <- Meter[F].counter[OpaqueWrapper]("counter").create
_ <- counter.add(OpaqueWrapper(42L))
} yield ()
Custom bucket boundaries can be configured via the histogram builder
Meter[F]
.histogram("service.latency")
.withExplicitBucketBoundaries(BucketBoundaries(Vector(0.005, 0.05, 0.5, 1.0, 1.5)))
.create
Tracer API improvements
New Tracer#currentSpanOrThrow
API
currentSpanOrThrow
throws an exception if no span is available.
val span: F[Span[F]] = Tracer[F].currentSpanOrThrow
SpanOps.Res
extractor
It provides access to the span and trace (natural transformation).
tracer.span("resource").resource.use { case SpanOps.Res(span, trace) =>
???
}
Array-like attributes use Seq
under the hood
Previously, an array-like attribute could be made only with the List
collection:
val attribute: Attribute[List[String]] = Attribute("key", List("a", "b"))
We relaxed the type constraint to the Seq
:
val seq: Attribute[Seq[String]] = Attribute("key", Seq("a", "b"))
val vectorAsSeq: Attribute[Seq[String]] = Attribute("key", Vector("a", "b"): Seq[String])
Overloaded alternatives to pass attributes
There are overloaded alternatives that take varargs and a collection:
Tracer[F].span("span", Attribute("key", "value")) // varargs
Tracer[F].span("span", List(Attribute("key", "value"))) // collection
Attributes
collection
Attributes
is a typesafe collection of attributes with handy methods (get
, added
, concat
):
val attributes = Attributes(Attribute("key", "value"), Attribute("frequency", 12.1))
val frequency: Option[Attribute[Double]] = attributes.get[Double]("frequency")
val withAttribute = attributes.added("some.attribute", 123L)
Attributes
can be used with Tracer
API too:
val attributes = Attributes(Attribute("http.latency", 0.123d), Attribute("user.id", 1L))
Tracer[IO].span("span", attributes)
OtelJava API improvements
New OtelJava.autoConfigured
API
A handy option to get an autoconfigured instance which can be customized:
val otelJava: Resource[F, OtelJava[F]] = OtelJava.autoConfigured[F] { builder =>
builder.addTracerProviderCustomizer((b, _) => b.setSampler(Sampler.alwaysOn()))
}
New OtelJava.noop
API
A handy option to get a no-op instance:
val otelJava: F[OtelJava[F]] = OtelJava.noop[F]
New LocalProvider
LocalProvider
simplifies the creation of the Local[F, Context]
. It automatically detects an available instance or creates a new one. The priorities are the following:
- Uses
Local[F, Context]
available in the scope - Creates
Local
fromIOLocal[Context]
andLiftIO[F]
available in the scope - Creates new
Local[F, Context]
by creatingIOLocal[Context]
In most cases, you will be unaffected by this change.
OtelJava.localContext
provides access to the Local[F, Context]
Now you can access the Local[F, Context]
that OtelJava
uses for context propagation.
For example, you can inject a baggage:
val otel4s: OtelJava[F] = ???
val program: F[Unit] = ???
val baggage = Baggage.builder().put("key", "value").build()
otel4s.localContext.local(program)(ctx => Context.wrap(ctx.underlying.`with`(baggage)))
Simplified conversion between OpenTelemetry Java and otel4s Attributes
import io.opentelemetry.api.common.{Attributes => JAttributes}
import org.typelevel.otel4s.Attributes
import org.typelevel.otel4s.oteljava.AttributeConverters._
val asOtel4s: Attributes =
JAttributes.builder().put("key", "value").build().toScala
val asOpenTelemetry: JAttributes =
Attributes(Attribute("key", "value")).toJava
OtelJava.underlying
provides access to the JOpenTelemetry
Now you can access the JOpenTelemetry
that OtelJava
uses under the hood:
OtelJava.autoConfigured[IO]() { otel4s =>
val openTelemetry: io.opentelemetry.api.OpenTelemetry = otel4s.underlying
???
}
What's Changed
Improvements and enhancements
- Rename
java
tooteljava
by @NthPortal in #412 - Move
Attributes
to core-common by @NthPortal in #411 - Move
instances
to thecore-common
package by @iRevive in #414 - Add
Attributes#{updated,concat}
by @NthPortal in #416 - Add
OtelJava.autoConfigured()
by @NthPortal in #420 - Rename
Resource
->TelemetryResource
by @iRevive in #439 - Expose
OtelJava
'sLocalContext
by @NthPortal in #464 - Add
Attributes#{removed,removedAll,-,--}
by @NthPortal in #465 - Add
LocalProvider
by @iRevive in #441 - Replace
otel4s-testkit
withotel4s-oteljava-testkit
by @iRevive in #475 - Add
sdk-trace-testkit
module by @iRevive in #487 - Add `ot...
v0.5.0-RC3
otel4s-sdk
module had a missing dependency in 0.5.0-RC2
. 0.5.0-RC3
addresses this issue.
What's Changed
- site: add SDK section by @iRevive in #533
- remove
sdk-metrics
dependency from thesdk
by @iRevive in #557 - Update opentelemetry-javaagent to 2.2.0 by @typelevel-steward in #549
- Update opentelemetry-instrumentation-annotations to 2.2.0 by @typelevel-steward in #548
- Update fs2-core to 3.10.0 by @typelevel-steward in #552
- Update sbt-buildinfo to 0.12.0 by @typelevel-steward in #554
Full Changelog: v0.5.0-RC2...v0.5.0-RC3
v0.5.0-RC2
We are happy to announce the second candidate for the upcoming 0.5.0 release.
The SDK tracing modules are now publicly available. Check out the documentation.
API improvements
There are several improvements. Kudos to @NthPortal for the dedicated work!
1) Attributes
collection
Attributes
is a typesafe collection of attributes with handy methods (get
, added
, concat
):
val attributes = Attributes(Attribute("key", "value"), Attribute("frequency", 12.1))
val frequency: Option[Attribute[Double]] = attributes.get[Double]("frequency")
val withAttribute = attributes.added("some.attribute", 123L)
Attributes
can be used with Tracer
API too:
val attributes = Attributes(Attribute("http.latency", 0.123d), Attribute("user.id", 1L))
Tracer[IO].span("span", attributes)
2) Simplified conversion between OpenTelemetry Java and otel4s Attributes
import io.opentelemetry.api.common.{Attributes => JAttributes}
import org.typelevel.otel4s.Attributes
import org.typelevel.otel4s.oteljava.AttributeConverters._
val asOtel4s: Attributes =
JAttributes.builder().put("key", "value").build().toScala
val asOpenTelemetry: JAttributes =
Attributes(Attribute("key", "value")).toJava
3) OtelJava.underlying
provides access to the JOpenTelemetry
Now you can access the JOpenTelemetry
that OtelJava
uses under the hood:
OtelJava.autoConfigured[IO]() { otel4s =>
val openTelemetry: io.opentelemetry.api.OpenTelemetry = otel4s.underlying
???
}
What's Changed
Improvements and enhancements
- Remove unused files by @iRevive in #526
- OpenTelemetrySdk: rename
addExporterConfigurer
toaddSpanExporterConfigurer
by @iRevive in #531 - Move
KeySelect
toAttributeKey
by @iRevive in #530 - OtelJava: expose underlying
JOpenTelemetry
by @iRevive in #539 - sdk: use
TelemetryResource.default
as an initial resource by @iRevive in #532 - Partially redesign
Attributes
by @NthPortal in #529 - Simplify
PropagatorConverters
by @NthPortal in #545 - Add
AttributeConverters
by @NthPortal in #544 - sdk-metrics: add
AggregationTemporality
by @iRevive in #541
Internal
Upgrades
- Update cats-effect, cats-effect-kernel, ... to 3.5.4 by @typelevel-steward in #538
- Update http4s-circe, http4s-ember-client to 0.23.26 by @typelevel-steward in #537
- Update scala3-library, ... to 3.3.3 by @typelevel-steward in #528
- Update opentelemetry-api, ... to 1.36.0 by @typelevel-steward in #540
- flake.lock: Update by @typelevel-steward in #546
- Update scala-library, scala-reflect to 2.13.13 by @typelevel-steward in #523
Full Changelog: v0.5.0-RC1...v0.5.0-RC2
v0.5.0-RC1
We are happy to announce the first candidate for the upcoming 0.5.0
release.
This release brings significant API improvements and breaking changes.
Warning
This version has several breaking changes and is binary incompatible with the 0.4.0
lineage.
Note
Public Scala Steward will rename the artifacts automatically (see the changes below).
Tip
Use the scalafix rule to simplify the migration:
$ sbt "scalafix dependency:V0_5_0Rewrites@org.typelevel:otel4s-scalafix:0.5.0-RC1"
Artifacts replacement and package changes
For better clarity, we decided to rename the following artifacts:
otel4s-java
tootel4s-oteljava
otel4s-testkit-metrics
tootel4s-oteljava-metrics-testkit
- libraryDependencies += "org.typelevel" %% "otel4s-java" % "0.4.0"
+ libraryDependencies += "org.typelevel" %% "otel4s-oteljava" % "0.5.0-RC1"
- libraryDependencies += "org.typelevel" %% "otel4s-testkit-metrics" % "0.4.0"
+ libraryDependencies += "org.typelevel" %% "otel4s-oteljava-metrics-testkit" % "0.5.0-RC1"
The package is renamed, too:
- import org.typelevel.otel4s.java._
+ import org.typelevel.otel4s.oteljava._
The localForIOLocal
is moved to a new package
- import org.typelevel.otel4s.java.instances._
+ import org.typelevel.otel4s.instances.local._
Trace Status
is renamed to the StatusCode
- import org.typelevel.otel4s.trace.Status
+ import org.typelevel.otel4s.trace.StatusCode
Notable API changes
Metrics. New generic instrument builders
The instrument builders now require an explicit instrument type:
- val counter = Meter[F].counter("counter").create
+ val counter = Meter[F].counter[Long]("counter").create
- val histogram = Meter[F].histogram("histogram").create
+ val histogram = Meter[F].histogram[Double]("histogram").create
While there is a drawback, this approach allows us to provide a flexible API:
val longCounter: F[Counter[F, Long]] = Meter[F].counter[Long]("counter").create
val doubleCounter: F[Counter[F, Double]] = Meter[F].counter[Double]("counter").create
val longHistogram: F[Histogram[F, Long]] = Meter[F].histogram[Long]("histogram").create
val doubleHistogram: F[Histogram[F, Double]] = Meter[F].histogram[Double]("histogram").create
val doubleGauge: Resource[F, ObservableGauge] =
Meter[F].observableGauge[Double]("double-gauge").create(Sync[F].delay(List(Measurement(1.0))))
val longGauge: Resource[F, ObservableGauge] =
Meter[F].observableGauge[Long]("long-gauge").create(Sync[F].delay(List(Measurement(1L))))
As a result, instruments are also available for (almost) any type now.
The underlying type still denotes to either Long
or Double
. But you can still use a wrapper type:
final case class OpaqueWrapper(value: Long)
implicit val measurementValue: MeasurementValue[OpaqueWrapper] = MeasurementValue[Long].contramap(_.value)
for {
counter <- Meter[F].counter[OpaqueWrapper]("counter").create
_ <- counter.add(OpaqueWrapper(42L))
} yield ()
Metrics. Custom bucket boundaries can be configured via the histogram builder
Meter[F]
.histogram("service.latency")
.withExplicitBucketBoundaries(BucketBoundaries(Vector(0.005, 0.05, 0.5, 1.0, 1.5)))
.create
New OtelJava.autoConfigured
API
A handy option to get an autoconfigured which can be customized:
val otelJava: Resource[F, OtelJava[F]] = OtelJava.autoConfigured[F] { builder =>
builder.addTracerProviderCustomizer((b, _) => b.setSampler(Sampler.alwaysOn()))
}
New LocalProvider
LocalProvider
simplifies the creation of the Local[F, Context]
. It automatically detects an available instance or creates a new one. The priorities are the following:
- Uses
Local[F, Context]
available in the scope - Creates
Local
fromIOLocal[Context]
andLiftIO[F]
available in the scope - Creates new
Local[F, Context]
by creatingIOLocal[Context]
In most cases, you will be unaffected by this change.
OtelJava.localContext
provides access to the Local[F, Context]
Now you can access the Local[F, Context]
that OtelJava
uses for context propagation.
For example, you can inject a baggage:
val otel4s: OtelJava[F] = ???
val program: F[Unit] = ???
val baggage = Baggage.builder().put("key", "value").build()
otel4s.localContext.local(program)(ctx => Context.wrap(ctx.underlying.`with`(baggage)))
Improved Tracer API
There are overloaded alternatives that take varargs and a collection:
Tracer[F].span("span", Attribute("key", "value")) // varargs
Tracer[F].span("span", List(Attribute("key", "value"))) // collection
What's Changed
Improvements and enhancements
- Rename
java
tooteljava
by @NthPortal in #412 - Move
Attributes
to core-common by @NthPortal in #411 - Move
instances
to thecore-common
package by @iRevive in #414 - Add
Attributes#{updated,concat}
by @NthPortal in #416 - Add
OtelJava.autoConfigured()
by @NthPortal in #420 - Rename
Resource
->TelemetryResource
by @iRevive in #439 - Expose
OtelJava
'sLocalContext
by @NthPortal in #464 - Add
Attributes#{removed,removedAll,-,--}
by @NthPortal in #465 - Add
LocalProvider
by @iRevive in #441 - Replace
otel4s-testkit
withotel4s-oteljava-testkit
by @iRevive in #475 - Add
sdk-trace-testkit
module by @iRevive in #487 - Add
oteljava-trace-testkit
module by @iRevive in #488 - Enhance core APIs to support
Attributes
by @NthPortal in #494 - oteljava-testkit: add
OtelJavaTestkit
by @iRevive in #491 - examples: add
SdkTracingExample
by @iRevive in #509 - Add transformName to Attribute by @rossabaker in #503
- trace: rename
Status
toStatusCode
by @iRevive in #521 - metrics: use independent
Builder
trait forCounter
andUpDownCounter
by @iRevive in #436 - metrics: make
Meter
API generic by @iRevive in #449 - metrics: improve Scaladoc regarding supported measurement values by @iRevive in #454
- metrics: redefine
Measurement
as a sealed trait by @iRevive in #455 - metrics: make
Meter[F].observableGauge
generic by @iRevive in #453 - metrics: make
Meter[F].observableCounter
generic by @iRevive in #456 - metrics: make
Meter[F].observableUpDownCounter
generic by @iRevive in #457 - metrics: remove
ObservableInstrumentBuilder
by @iRevive in #458 - metrics: add
Meter[F].batchCallback
by @iRevive in #459 - Histogram builder: add
withExplicitBucketBoundaries
by @iRevive in #435
sdk
module - unpublished yet
- sdk-trace: add
SdkTraceScope
by @iRevive in #400 - sdk-trace: add
SdkSpanBuilder
by @iRevive in #403 - sdk-trace: add
BatchSpanProcessor
by @iRevive in #390 - sdk-trace: add
SdkTracer
,SdkTracerBuilder
,SdkTracerProvider
by @iRevive in #418 - sdk-trace: add
B3Propagator
by @iRevive in #440 - sdk-trace: add
W3CTraceContextPropagator
by @iRevive in #442 - sdk-trace: enable W3C propagators tests by @iRevive in #460
- sdk-trace: move
W3CTraceContextPropagator
to thecontext.propagation
package by @iRevive in #461 - sdk-trace: add
W3CBaggagePropagator
by @iRevive in #462 - sdk-trace: add
JaegerPropagator
by @iRevive in #463 - sdk-trace: add
ContextPropagatorsAutoConfigure
by @iRevive in #469 - sdk-trace:
ContextPropagatorsAutoConfigure
- cleanup, add more tests by @iRevive in #476 - sdk-trace: add
SamplerAutoConfigure
by @iRevive in #471 - sdk-trace: make
SamplerAutoConfigure
extendable by @iRevive in #492 - sdk-trace: add
SpanExportersAutoConfigure
by @iRevive in #477 - sdk-trace: add
TracerProviderAutoConfigure
by @iRevive in #498 - sdk-trace: add
SdkTraces
by @iRevive in #500 - sdk-common: add
Baggage
by @iRevive in #452 - sdk-common:
AutoConfigure
- use config keys in the error message by @iRevive in #472 - sdk: add
OpenTelemetrySdk
by @iRevive in https://github.com/typelevel/otel4s/pu...
v0.4.0
We are happy to announce the 0.4.0
release.
Warning
This version has several breaking changes and is binary incompatible with the 0.3.0
lineage.
Notable API changes
1) Upgraded semantic conventions to 1.23.1
1.23.0
release of the semantic conventions marks HTTP conventions stable.
2) Attributes
is a collection now
The Attributes
has been redefined as a collection. Now we can take advantages of the built-in methods:
// create using varargs
val attributs: Attributes =
Attributes(Attribute("key", "value"), Attribute("user_id", 42L))
// or from a collection
val attributs: Attributes =
Attributes.fromSpecific(Seq(Attribute("key", "value"), Attribute("user_id", 42L)))
// or using a builder
val attributes: Attributes =
Attributes.newBuilder.addOne("key", "value").addOne("user_id", 42L).result()
// iterable ops:
attributes.size
attributes.foreach(attribute => println(attribute))
attributes.contains(AttributeKey.string("key"))
// transform to Vector
val asVector: Vector[Attribute[_]] = attributes.to(Vector)
Improvements and clean-ups
- Apply
@threadUnsafe3
annotation tolazy val
s by @armanbilge in #364 - Make
SpanContext
sealed by @iRevive in #359 - Add
Builder
ofAttributes
. Documentation improvements by @iRevive in #382 - Redefine
Resource
as a sealed trait by @iRevive in #383 - Tweak
Attributes
collection type by @NthPortal in #389 - Improve
Attribute
creation ergonomics by @NthPortal in #406 - Generate semantic attributes using
1.23.1-alpha
semantic convention by @iRevive in #408 - Support using Scala propagators with Java backend by @NthPortal in #365
Upcoming trace SDK (not published yet)
- trace sdk: add samplers by @iRevive in #355
- trace sdk: add
StatusData
by @iRevive in #360 - sdk-trace: add
LinkData
by @iRevive in #367 - sdk-trace: add
EventData
by @iRevive in #369 - sdk-trace: add
IdGenerator
by @iRevive in #370 - sdk-trace: add
SpanData
by @iRevive in #372 - sdk-trace: add
SpanProcessor
by @iRevive in #374 - sdk-trace: add
SpanExporter
by @iRevive in #373 - sdk-trace: add
SdkSpanBackend
by @iRevive in #395 - sdk-common: add
Context
by @iRevive in #391 - sdk-trace: add
SimpleSpanProcessor
by @iRevive in #388 SpanProcessor
- rethrow a composite failure on multiple errors by @iRevive in #386
Behind the scene
- build.sbt: reorganize munit dependencies by @iRevive in #385
- IdGeneratorSuite: reduce the number of attempts by @iRevive in #380
Upgrades
- Update munit-cats-effect to 2.0.0-M4 by @typelevel-steward in #362
- Update scalafmt-core to 3.7.17 by @typelevel-steward in #376
- Update sbt-jmh to 0.4.7 by @typelevel-steward in #398
- Update opentelemetry-api, ... to 1.33.0 by @typelevel-steward in #397
- Update opentelemetry-instrumentation-annotations to 1.32.0 by @typelevel-steward in #377
- Update sbt to 1.9.8 by @typelevel-steward in #401
- Update opentelemetry-javaagent to 1.32.0 by @typelevel-steward in #378
- Update pekko-stream to 1.0.2 by @typelevel-steward in #392
- Update sbt-typelevel, ... to 0.6.4 by @typelevel-steward in #402
v0.3.0
We are happy to announce the 0.3.0
release. We are stabilizing the API, enhancing the documentation with practical, hands-on examples, and addressing the bugs to provide a more reliable experience.
Warning
This version has several breaking changes and is binary incompatible with the 0.2.0
lineage.
Notable API changes
1) New Tracer[F].propagate
Note
The propagation mechanism relies on the configured propagators.
The propagators can be enabled via environment variable, for example: OTEL_PROPAGATORS="tracecontext,baggage"
.
This enhancement allows users to inject the tracing information into the carrier conveniently:
val traceHeaders: IO[Map[String, String]] =
Tracer[IO].propagate(Map.empty[String, String])
The carrier can be of any type that has an instance of TextMapUpdater
. For example, the tracing information can be injected into the http4s Response
:
implicit def responseTextMapUpdater[F[_]]: TextMapUpdater[Response[F]] =
(carrier: Response[F], key: String, value: String) =>
carrier.withHeaders(carrier.headers.put(Header.Raw(CIString(key), value)))
val responseWithTraceInfo: IO[Response[IO]] =
Tracer[IO].propagate(Response())
2) New Tracer[F].mapK
This enhancement unblocks the implementation of various middleware, especially in the http4s.
val tracer: Tracer[IO] = ???
val eitherTTracer: Tracer[EitherT[IO, Error, *]] = tracer.mapK[EitherT[IO, Error, *]]
3) New Tracer[F].currentSpanOrNoop
Note
The no-op span will be returned if there is no active span in the local scope.
val tracer: Tracer[IO] = ???
val span: IO[Span[IO]] = tracer.currentSpanOrNoop
4) New OtelJava.global[F]
If you want to construct Otel4s
instance from the global OpenTelemetry, you can use:
val otel4s: IO[OtelJava[IO]] = OtelJava.global[IO]
It's a shortcut for:
def global[F[_]: LiftIO: Async]: F[OtelJava[F]] =
Sync[F].delay(GlobalOpenTelemetry.get).flatMap(forAsync[F])
5) Removed SpanBuilder#wrapResource
Unfortunately, this API makes implementing a natural transformation for Tracer
impossible.
6) Removed dependency on Vault
This change makes context implementation options more flexible for various backends.
If you want to supply your own IOLocal
instance, replace Vault.empty
with Context.root
:
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.java.instances._
IOLocal(Context.root).flatMap { implicit ioLocal =>
for {
otel4s <- IO.delay(GlobalOpenTelemetry.get).map(OtelJava.forAsync)
// ...
} yield ()
}
New site articles
- Integration with Grafana, Prometheus, and Jaeger - how to export metrics and traces, and visualize them in Grafana
- Customization of histogram buckets - how to set custom bucket boundaries for a specific histogram instrument
- Modules structure - the structure of the otel4s project
- Tracing context propagation - how the context propagation within the effect works
- Tracing instrumentation - how to instrument a library with tracing information
- Tracing - interop with Java-instrumented libraries - how to interoperate with OpenTelemetry Java libraries
The changes
Improvements and clean-ups
- Add
Tracer#propagate
by @NthPortal in #285 - Meter summoner by @buntec in #248
- Add method signature for implicit Tracer noop by @sherriesyt in #208
- Add implicits for
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in #207 - Basic reporting through toString by @sherriesyt in #220
- Add
{Contra;In}variant
instances forTextMap{Get;Upda}ter
by @AprilAtBanno in #225 - Make Local instance for IOLocal public and add law tests by @lacarvalho91 in #224
- Add OtelJava.global by @mpilquist in #267
Tracer
andSpanBuilder
: change type constraint fromMonadCancelThrow
toApplicative
by @iRevive in #282- Add
TracerProvider.noop
by @iRevive in #319 - Add
updateName
toSpan
by @iRevive in #327 - Add
mapK
toTracer
,SpanBuilder
, etc. by @NthPortal in #284 - Immutable injection in TextMapPropagator by @rossabaker in #182
- Add implicit
KindTransformer
for identity by @NthPortal in #335 - Add
Tracer{Provider,Builder}#mapK
by @NthPortal in #338 - Add
Hash
andShow
forKey
by @NthPortal in #337 - Remove effect constraint from
TextMapPropagator
by @iRevive in #332 - core and sdk: Add
Hash
andShow
instances by @iRevive in #331 - Add
Tracer#currentSpanOrNoop
by @NthPortal in #349 - trace core: add
TraceState
by @iRevive in #356 - sdk-common: add
InstrumentationScope
by @iRevive in #354
Bugfix
Tracer#joinOrRoot
- propagate extracted headers downstream by @iRevive in #301- Do not return duplicates in
TextMapGetter#keys
by @AprilAtBanno in #221 - Fix addAttributes not to remove previous attributes. by @ondrc in #250
Documentation
- Provide 'Histogram custom buckets' example by @iRevive in #260
- Histogram custom buckets doc: improve readability by @iRevive in #269
- Update site navigation layout: add
Customization
section by @iRevive in #279 - Minor docs improvements by @iRevive in #283
- Add grafana example by @keuhdall in #290
- site: add
Modules structure
page. Update index pages by @iRevive in #346 - site: add
Tracing instrumentation
page by @iRevive in #352 - site: add
Tracing context propagation
page by @iRevive in #348 - site: add
Tracing - interop with Java-instrumented libraries
page by @iRevive in #353
Behind the scene
- Add semconv module by @kovstas in #231
- Update .scalafmt.conf to allow trailing commas by @AprilAtBanno in #232
- Add properties tests for
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in #222 - Add new package with new type aliases by @sherriesyt in #217
- Typo: s/contentPropagators/contextPropagators/ by @rossabaker in #197
- Simplify
Tracer.Meta#noopResSpan
by @NthPortal in #228 - Fix testkit dependencies by @armanbilge in #252
- Remove unused parameter type by @iRevive in #255
- Fix compilation issue by @iRevive in #328
- Add LICENSE by @armanbilge in #262
- Add Resource entity by @kovstas in #240
- Replace
SpanBuilder#wrapResource
API by @NthPortal in #273 - New modules + span context maybe? by @sherriesyt in #236
- Verify the propagation of the trace state via W3C propagator by @iRevive in #329
- Redesign context implementation by @NthPortal in #291
- Generate semantic conventions using sbt by @iRevive in #336
Upgrades
- Update cats-effect, cats-effect-kernel, ... to 3.5.2 by @typelevel-steward in #323
- Update cats-core, cats-laws to 2.10.0 by @typelevel-steward in #295
- Update cats-mtl, cats-mtl-laws to 1.4.0 by @typelevel-steward in #344
- Update fs2-core to 3.9.3 by @typelevel-steward in #357
- Update scodec-bits to 1.1.38 by @typelevel-steward in #342
- Update opentelemetry-api, ... to 1.31.0 by @typelevel-steward in #333
- Update munit, munit-scalacheck to 1.0.0-M10 by @typelevel-steward in #317
- Update discipline-munit to 2.0.0-M3 by @typelevel-steward in #233
- Update scala-library, scala-reflect to 2.13.12 by @typelevel-steward in #310
- Update scala...
v0.3.0-RC2
What's Changed
The changes
- Add implicit
KindTransformer
for identity by @NthPortal in #335
Upgrades
- Update sbt-typelevel, ... to 0.5.4 by @typelevel-steward in #334
- Update opentelemetry-api, ... to 1.31.0 by @typelevel-steward in #333
Full Changelog: v0.3.0-RC1...v0.3.0-RC2
v0.3.0-RC1
We are happy to announce the first candidate for the upcoming 0.3.0
release. We are stabilizing the API, enhancing the documentation with practical, hands-on examples, and addressing the bugs to provide a more reliable experience.
Warning
This version has several breaking changes and is binary incompatible with the 0.2.0
lineage.
Notable API changes
1) New Tracer[F].propagate
Note
The propagation mechanism relies on the configured propagators.
The propagators can be enabled via environment variable, for example: OTEL_PROPAGATORS="tracecontext,baggage"
.
This enhancement allows users to inject the tracing information into the carrier conveniently:
val traceHeaders: IO[Map[String, String]] =
Tracer[IO].propagate(Map.empty[String, String])
The carrier can be of any type that has an instance of TextMapUpdater
. For example, the tracing information can be injected into the http4s Response
:
implicit def responseTextMapUpdater[F[_]]: TextMapUpdater[Response[F]] =
(carrier: Response[F], key: String, value: String) =>
carrier.withHeaders(carrier.headers.put(Header.Raw(CIString(key), value)))
val responseWithTraceInfo: IO[Response[IO]] =
Tracer[IO].propagate(Response())
2) New Tracer[F].mapK
This enhancement unblocks the implementation of various middleware, especially in the http4s.
val tracer: Tracer[IO] = ???
val eitherTTracer: Tracer[EitherT[IO, Error, *]] = tracer.mapK[EitherT[IO, Error, *]]
3) New OtelJava.global[F]
If you want to construct Otel4s
instance from the global OpenTelemetry, you can use:
val otel4s: IO[OtelJava[IO]] = OtelJava.global[IO]
It's a shortcut for:
def global[F[_]: LiftIO: Async]: F[OtelJava[F]] =
Sync[F].delay(GlobalOpenTelemetry.get).flatMap(forAsync[F])
4) Removed SpanBuilder#wrapResource
Unfortunately, this API makes implementing a natural transformation for Tracer
impossible.
5) Removed dependency on Vault
This change makes context implementation options more flexible for various backends.
If you want to supply your own IOLocal
instance, replace Vault.empty
with Context.root
:
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.java.instances._
IOLocal(Context.root).flatMap { implicit ioLocal =>
for {
otel4s <- IO.delay(GlobalOpenTelemetry.get).map(OtelJava.forAsync)
// ...
} yield ()
}
New site articles
- Integration with Grafana, Prometheus, and Jaeger - how to export metrics and traces, and visualize them in Grafana
- Customization of histogram buckets - how to set custom bucket boundaries for a specific histogram instrument
The changes
Improvements and clean-ups
- Add
Tracer#propagate
by @NthPortal in #285 - Meter summoner by @buntec in #248
- Add method signature for implicit Tracer noop by @sherriesyt in #208
- Add implicits for
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in #207 - Basic reporting through toString by @sherriesyt in #220
- Add
{Contra;In}variant
instances forTextMap{Get;Upda}ter
by @AprilAtBanno in #225 - Make Local instance for IOLocal public and add law tests by @lacarvalho91 in #224
- Add OtelJava.global by @mpilquist in #267
Tracer
andSpanBuilder
: change type constraint fromMonadCancelThrow
toApplicative
by @iRevive in #282- Add
TracerProvider.noop
by @iRevive in #319 - Add
updateName
toSpan
by @iRevive in #327 - Add
mapK
toTracer
,SpanBuilder
, etc. by @NthPortal in #284 - Immutable injection in TextMapPropagator by @rossabaker in #182
- Add Resource entity by @kovstas in #240
- Add new package with new type aliases by @sherriesyt in #217
Bugfix
Tracer#joinOrRoot
- propagate extracted headers downstream by @iRevive in #301- Do not return duplicates in
TextMapGetter#keys
by @AprilAtBanno in #221 - [#249] Fix addAttributes not to remove previous attributes. by @ondrc in #250
Documentation
- Provide 'Histogram custom buckets' example by @iRevive in #260
- Histogram custom buckets doc: improve readability by @iRevive in #269
- Update site navigation layout: add
Customization
section by @iRevive in #279 - Minor docs improvements by @iRevive in #283
- Add grafana example by @keuhdall in #290
Behind the scene
- Add semconv module by @kovstas in #231
- Update .scalafmt.conf to allow trailing commas by @AprilAtBanno in #232
- Add properties tests for
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in #222 - Typo: s/contentPropagators/contextPropagators/ by @rossabaker in #197
- Simplify
Tracer.Meta#noopResSpan
by @NthPortal in #228 - Fix testkit dependencies by @armanbilge in #252
- Remove unused parameter type by @iRevive in #255
- Fix compilation issue by @iRevive in #328
- Add LICENSE by @armanbilge in #262
- Replace
SpanBuilder#wrapResource
API by @NthPortal in #273 - New modules + span context maybe? by @sherriesyt in #236
- Verify the propagation of the trace state via W3C propagator by @iRevive in #329
- Redesign context implementation by @NthPortal in #291
Upgrades
- Update cats-effect, cats-effect-kernel, ... to 3.5.2 by @typelevel-steward in #323
- Update cats-core, cats-laws to 2.10.0 by @typelevel-steward in #295
- Update cats-mtl to 1.3.1 by @typelevel-steward in #189
- Update fs2-core to 3.9.2 by @typelevel-steward in #313
- Update opentelemetry-api, ... to 1.30.1 by @typelevel-steward in #311
- Update scalafmt-core to 3.7.14 by @typelevel-steward in #302
- Update scala-library, scala-reflect to 2.13.12 by @typelevel-steward in #310
- Update scala3-library, ... to 3.3.1 by @typelevel-steward in #305
- Update sbt-scalajs, scalajs-compiler, ... to 1.14.0 by @typelevel-steward in #321
- Update nscplugin, sbt-scala-native, ... to 0.4.15 by @typelevel-steward in #303
New Contributors
- @sherriesyt made their first contribution in #208
- @AprilAtBanno made their first contribution in #207
- @kovstas made their first contribution in #231
- @NthPortal made their first contribution in #228
- @lacarvalho91 made their first contribution in #224
- @buntec made their first contribution in #248
- @ondrc made their first contribution in #250
- @mpilquist made their first contribution in #267
- @keuhdall made their first contribution in #290
Full Changelog: v0.2.1...v0.3.0-RC1
v0.2.1
otel4s-v0.2.1 is a breaking change from v0.1.0. It contains mutliple bugfixes and new features, highlighted by propagation.
Where's v0.2.0?
The tag hit a non-deterministic test on publish. v0.2.1 is the first release in this series.
Noteworthy
- Move
SpanRunner
outsideSpanBuilderImpl
by @iRevive in #122 - Use
sdk.shutdown()
to shut all providers down by @iRevive in #138 - Fix resourceSpan surround by @rossabaker in #128
- Make Vault the top-level context by @rossabaker in #127
- Provide cats.mtl.Local instances by @rossabaker in #119
- ContextPropagators, Take 2 by @rossabaker in #125
- Observable instruments by @christiankjaer in #162
- Add alternative way of constructing observable instruments by @christiankjaer in #170
- Add
Tracer#joinOrRoot
utility method by @iRevive in #149
Upgrades
- Update scodec-bits to 1.1.37 by @typelevel-steward in #150
- Update opentelemetry-api, ... to 1.25.0 by @typelevel-steward in #165
- Update sbt-scalajs, scalajs-compiler, ... to 1.13.1 by @typelevel-steward in #166
- Update cats-effect, cats-effect-kernel, ... to 3.4.9 by @typelevel-steward in #175
Documentation
- Add propagators Scaladoc by @iRevive in #148
- Add another Trace Example by @zmccoy in #155
- Documentation: Render each item of an ordered list on a new line by @iRevive in #168
- Add Scaladoc for
observable*
methods by @iRevive in #172 - Add unidocs artifact by @armanbilge in #174
Behind the scenes
- Update opentelemetry-api, ... to 1.23.0 by @typelevel-steward in #131
- flake.lock: Update by @typelevel-steward in #129
- Update fs2-core to 3.6.1 by @typelevel-steward in #130
- Update sbt-scalajs, scalajs-compiler, ... to 1.13.0 by @typelevel-steward in #132
- Update scala3-library, ... to 3.2.2 by @typelevel-steward in #133
- Update nscplugin, sbt-scala-native, ... to 0.4.10 by @typelevel-steward in #134
- Update scodec-bits to 1.1.35 by @typelevel-steward in #135
- Update cats-effect, cats-effect-kernel, ... to 3.4.6 by @typelevel-steward in #136
- Update cats-effect, cats-effect-kernel, ... to 3.4.7 by @typelevel-steward in #140
- Update opentelemetry-api, ... to 1.23.1 by @typelevel-steward in #142
- Update scalafmt-core to 3.7.2 by @typelevel-steward in #145
- Update cats-effect, cats-effect-kernel, ... to 3.4.8 by @typelevel-steward in #144
- Update scodec-bits to 1.1.36 by @typelevel-steward in #146
- flake.lock: Update by @typelevel-steward in #143
- flake.lock: Update by @typelevel-steward in #153
- Update sbt-typelevel, ... to 0.4.19 by @typelevel-steward in #152
- Update opentelemetry-api, ... to 1.24.0 by @typelevel-steward in #151
- flake.lock: Update by @typelevel-steward in #160
- Update nscplugin, sbt-scala-native, ... to 0.4.12 by @typelevel-steward in #156
- flake.lock: Update by @typelevel-steward in #163
- Update scalafmt-core to 3.7.3 by @typelevel-steward in #161
- Update sbt-scala-native-crossproject to 1.3.0 by @typelevel-steward in #164
- flake.lock: Update by @typelevel-steward in #169
- Update sbt-scala-native-crossproject to 1.3.1 by @typelevel-steward in #176
- Fixed flaky observable test by @christiankjaer in #179
New Contributors
- @zmccoy made their first contribution in #155
- @christiankjaer made their first contribution in #162
Discussion
We are continuing the original discussion from v0.2.0.
Full Changelog: v0.1.0...v0.2.1