An OpenTelemetry library for Scala based on Cats-Effect
APACHE-2.0 License
Bot releases are visible (Hide)
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 the0.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:[email protected]:otel4s-scalafix:0.5.0"
For better clarity, we decided to rename the following artifacts:
otel4s-java
to otel4s-oteljava
otel4s-testkit-metrics
to otel4s-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._
localForIOLocal
is moved to a new package- import org.typelevel.otel4s.java.instances._
+ import org.typelevel.otel4s.instances.local._
Status
is renamed to the StatusCode
- import org.typelevel.otel4s.trace.Status
+ import org.typelevel.otel4s.trace.StatusCode
1.24.0
There are several major breaking changes:
semconv-experimental
.ResourceAttributes
and SemanticAttributes
.http.request.header
attribute lives in the HttpAttributes
object.org.typelevel.otel4s.semconv.trace
to org.typelevel.otel4s.semconv
.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"
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 ()
Meter[F]
.histogram("service.latency")
.withExplicitBucketBoundaries(BucketBoundaries(Vector(0.005, 0.05, 0.5, 1.0, 1.5)))
.create
Tracer#currentSpanOrThrow
APIcurrentSpanOrThrow
throws an exception if no span is available.
val span: F[Span[F]] = Tracer[F].currentSpanOrThrow
SpanOps.Res
extractorIt provides access to the span and trace (natural transformation).
tracer.span("resource").resource.use { case SpanOps.Res(span, trace) =>
???
}
Seq
under the hoodPreviously, 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])
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
collectionAttributes
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.autoConfigured
APIA 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()))
}
OtelJava.noop
APIA handy option to get a no-op instance:
val otelJava: F[OtelJava[F]] = OtelJava.noop[F]
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:
Local[F, Context]
available in the scopeLocal
from IOLocal[Context]
and LiftIO[F]
available in the scopeLocal[F, Context]
by creating IOLocal[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)))
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
???
}
java
to oteljava
by @NthPortal in https://github.com/typelevel/otel4s/pull/412
Attributes
to core-common by @NthPortal in https://github.com/typelevel/otel4s/pull/411
instances
to the core-common
package by @iRevive in https://github.com/typelevel/otel4s/pull/414
Attributes#{updated,concat}
by @NthPortal in https://github.com/typelevel/otel4s/pull/416
OtelJava.autoConfigured()
by @NthPortal in https://github.com/typelevel/otel4s/pull/420
Resource
-> TelemetryResource
by @iRevive in https://github.com/typelevel/otel4s/pull/439
OtelJava
's LocalContext
by @NthPortal in https://github.com/typelevel/otel4s/pull/464
Attributes#{removed,removedAll,-,--}
by @NthPortal in https://github.com/typelevel/otel4s/pull/465
LocalProvider
by @iRevive in https://github.com/typelevel/otel4s/pull/441
otel4s-testkit
with otel4s-oteljava-testkit
by @iRevive in https://github.com/typelevel/otel4s/pull/475
sdk-trace-testkit
module by @iRevive in https://github.com/typelevel/otel4s/pull/487
oteljava-trace-testkit
module by @iRevive in https://github.com/typelevel/otel4s/pull/488
Attributes
by @NthPortal in https://github.com/typelevel/otel4s/pull/494
OtelJavaTestkit
by @iRevive in https://github.com/typelevel/otel4s/pull/491
SdkTracingExample
by @iRevive in https://github.com/typelevel/otel4s/pull/509
Status
to StatusCode
by @iRevive in https://github.com/typelevel/otel4s/pull/521
Builder
trait for Counter
and UpDownCounter
by @iRevive in https://github.com/typelevel/otel4s/pull/436
Meter
API generic by @iRevive in https://github.com/typelevel/otel4s/pull/449
Measurement
as a sealed trait by @iRevive in https://github.com/typelevel/otel4s/pull/455
Meter[F].observableGauge
generic by @iRevive in https://github.com/typelevel/otel4s/pull/453
Meter[F].observableCounter
generic by @iRevive in https://github.com/typelevel/otel4s/pull/456
Meter[F].observableUpDownCounter
generic by @iRevive in https://github.com/typelevel/otel4s/pull/457
ObservableInstrumentBuilder
by @iRevive in https://github.com/typelevel/otel4s/pull/458
Meter[F].batchCallback
by @iRevive in https://github.com/typelevel/otel4s/pull/459
withExplicitBucketBoundaries
by @iRevive in https://github.com/typelevel/otel4s/pull/435
addExporterConfigurer
to addSpanExporterConfigurer
by @iRevive in https://github.com/typelevel/otel4s/pull/531
KeySelect
to AttributeKey
by @iRevive in https://github.com/typelevel/otel4s/pull/530
JOpenTelemetry
by @iRevive in https://github.com/typelevel/otel4s/pull/539
Attributes
by @NthPortal in https://github.com/typelevel/otel4s/pull/529
PropagatorConverters
by @NthPortal in https://github.com/typelevel/otel4s/pull/545
AttributeConverters
by @NthPortal in https://github.com/typelevel/otel4s/pull/544
SpanOps.Res
extractor by @NthPortal in https://github.com/typelevel/otel4s/pull/564
OtelJava.noop
by @iRevive in https://github.com/typelevel/otel4s/pull/543
Hash
and Show
for BucketBoundaries
by @iRevive in https://github.com/typelevel/otel4s/pull/558
Tracer#currentSpanOrThrow
by @NthPortal in https://github.com/typelevel/otel4s/pull/555
List
AttributeType
s to Seq
by @NthPortal in https://github.com/typelevel/otel4s/pull/512
sdk
moduleSdkTraceScope
by @iRevive in https://github.com/typelevel/otel4s/pull/400
SdkSpanBuilder
by @iRevive in https://github.com/typelevel/otel4s/pull/403
BatchSpanProcessor
by @iRevive in https://github.com/typelevel/otel4s/pull/390
SdkTracer
, SdkTracerBuilder
, SdkTracerProvider
by @iRevive in https://github.com/typelevel/otel4s/pull/418
B3Propagator
by @iRevive in https://github.com/typelevel/otel4s/pull/440
W3CTraceContextPropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/442
W3CTraceContextPropagator
to the context.propagation
package by @iRevive in https://github.com/typelevel/otel4s/pull/461
W3CBaggagePropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/462
JaegerPropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/463
ContextPropagatorsAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/469
ContextPropagatorsAutoConfigure
- cleanup, add more tests by @iRevive in https://github.com/typelevel/otel4s/pull/476
SamplerAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/471
SamplerAutoConfigure
extendable by @iRevive in https://github.com/typelevel/otel4s/pull/492
SpanExportersAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/477
TracerProviderAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/498
SdkTraces
by @iRevive in https://github.com/typelevel/otel4s/pull/500
Baggage
by @iRevive in https://github.com/typelevel/otel4s/pull/452
AutoConfigure
- use config keys in the error message by @iRevive in https://github.com/typelevel/otel4s/pull/472
OpenTelemetrySdk
by @iRevive in https://github.com/typelevel/otel4s/pull/501
AutoConfigure
and Config
by @iRevive in https://github.com/typelevel/otel4s/pull/445
extra
attributes in tests by @iRevive in https://github.com/typelevel/otel4s/pull/444
SdkSpanBackendSuite
by @NthPortal in https://github.com/typelevel/otel4s/pull/438
BatchSpanProcessorAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/485
1.1.0-alpha
by @iRevive in https://github.com/typelevel/otel4s/pull/479
OtlpHttpSpanExporter
by @iRevive in https://github.com/typelevel/otel4s/pull/421
OtlpHttpClientAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/478
CrossType.Pure
by @iRevive in https://github.com/typelevel/otel4s/pull/483
OtlpSpanExporterAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/484
OtlpSpanExporterAutoConfigure
to the src
folder by @iRevive in https://github.com/typelevel/otel4s/pull/486
TelemetryResource.default
as an initial resource by @iRevive in https://github.com/typelevel/otel4s/pull/532
AggregationTemporality
by @iRevive in https://github.com/typelevel/otel4s/pull/541
InstrumentType
by @iRevive in https://github.com/typelevel/otel4s/pull/562
ExemplarData
by @iRevive in https://github.com/typelevel/otel4s/pull/561
TimeWindow
by @iRevive in https://github.com/typelevel/otel4s/pull/559
Arbitrary
, Gen
, and Cogen
instances by @iRevive in https://github.com/typelevel/otel4s/pull/423
cats.effect.std.Console
in tests by @iRevive in https://github.com/typelevel/otel4s/pull/443
TraceScope
between sdk
and oteljava
modules by @iRevive in https://github.com/typelevel/otel4s/pull/482
TracerSuite
between oteljava
and sdk
modules by @iRevive in https://github.com/typelevel/otel4s/pull/490
.to(Attributes)
instead of .fromSpecific
by @iRevive in https://github.com/typelevel/otel4s/pull/516
otel4s-java
-> otel4s-oteljava
by @iRevive in https://github.com/typelevel/otel4s/pull/525
@threadUnsafe
annotation by @armanbilge in https://github.com/typelevel/otel4s/pull/425
otel4s-java-common
by @armanbilge in https://github.com/typelevel/otel4s/pull/410
sdk
modules by @iRevive in https://github.com/typelevel/otel4s/pull/547
opentelemetry-semconv
to 1.24.0-alpha
by @iRevive in https://github.com/typelevel/otel4s/pull/568
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.4.0...v0.5.0
Published by iRevive 7 months ago
otel4s-sdk
module had a missing dependency in 0.5.0-RC2
. 0.5.0-RC3
addresses this issue.
sdk-metrics
dependency from the sdk
by @iRevive in https://github.com/typelevel/otel4s/pull/557
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.5.0-RC2...v0.5.0-RC3
Published by iRevive 7 months ago
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.
There are several improvements. Kudos to @NthPortal for the dedicated work!
Attributes
collectionAttributes
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)
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
???
}
addExporterConfigurer
to addSpanExporterConfigurer
by @iRevive in https://github.com/typelevel/otel4s/pull/531
KeySelect
to AttributeKey
by @iRevive in https://github.com/typelevel/otel4s/pull/530
JOpenTelemetry
by @iRevive in https://github.com/typelevel/otel4s/pull/539
TelemetryResource.default
as an initial resource by @iRevive in https://github.com/typelevel/otel4s/pull/532
Attributes
by @NthPortal in https://github.com/typelevel/otel4s/pull/529
PropagatorConverters
by @NthPortal in https://github.com/typelevel/otel4s/pull/545
AttributeConverters
by @NthPortal in https://github.com/typelevel/otel4s/pull/544
AggregationTemporality
by @iRevive in https://github.com/typelevel/otel4s/pull/541
sdk
modules by @iRevive in https://github.com/typelevel/otel4s/pull/547
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.5.0-RC1...v0.5.0-RC2
Published by iRevive 8 months ago
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 the0.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:[email protected]:otel4s-scalafix:0.5.0-RC1"
For better clarity, we decided to rename the following artifacts:
otel4s-java
to otel4s-oteljava
otel4s-testkit-metrics
to otel4s-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._
localForIOLocal
is moved to a new package- import org.typelevel.otel4s.java.instances._
+ import org.typelevel.otel4s.instances.local._
Status
is renamed to the StatusCode
- import org.typelevel.otel4s.trace.Status
+ import org.typelevel.otel4s.trace.StatusCode
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 ()
Meter[F]
.histogram("service.latency")
.withExplicitBucketBoundaries(BucketBoundaries(Vector(0.005, 0.05, 0.5, 1.0, 1.5)))
.create
OtelJava.autoConfigured
APIA 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()))
}
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:
Local[F, Context]
available in the scopeLocal
from IOLocal[Context]
and LiftIO[F]
available in the scopeLocal[F, Context]
by creating IOLocal[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)))
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
java
to oteljava
by @NthPortal in https://github.com/typelevel/otel4s/pull/412
Attributes
to core-common by @NthPortal in https://github.com/typelevel/otel4s/pull/411
instances
to the core-common
package by @iRevive in https://github.com/typelevel/otel4s/pull/414
Attributes#{updated,concat}
by @NthPortal in https://github.com/typelevel/otel4s/pull/416
OtelJava.autoConfigured()
by @NthPortal in https://github.com/typelevel/otel4s/pull/420
Resource
-> TelemetryResource
by @iRevive in https://github.com/typelevel/otel4s/pull/439
OtelJava
's LocalContext
by @NthPortal in https://github.com/typelevel/otel4s/pull/464
Attributes#{removed,removedAll,-,--}
by @NthPortal in https://github.com/typelevel/otel4s/pull/465
LocalProvider
by @iRevive in https://github.com/typelevel/otel4s/pull/441
otel4s-testkit
with otel4s-oteljava-testkit
by @iRevive in https://github.com/typelevel/otel4s/pull/475
sdk-trace-testkit
module by @iRevive in https://github.com/typelevel/otel4s/pull/487
oteljava-trace-testkit
module by @iRevive in https://github.com/typelevel/otel4s/pull/488
Attributes
by @NthPortal in https://github.com/typelevel/otel4s/pull/494
OtelJavaTestkit
by @iRevive in https://github.com/typelevel/otel4s/pull/491
SdkTracingExample
by @iRevive in https://github.com/typelevel/otel4s/pull/509
Status
to StatusCode
by @iRevive in https://github.com/typelevel/otel4s/pull/521
Builder
trait for Counter
and UpDownCounter
by @iRevive in https://github.com/typelevel/otel4s/pull/436
Meter
API generic by @iRevive in https://github.com/typelevel/otel4s/pull/449
Measurement
as a sealed trait by @iRevive in https://github.com/typelevel/otel4s/pull/455
Meter[F].observableGauge
generic by @iRevive in https://github.com/typelevel/otel4s/pull/453
Meter[F].observableCounter
generic by @iRevive in https://github.com/typelevel/otel4s/pull/456
Meter[F].observableUpDownCounter
generic by @iRevive in https://github.com/typelevel/otel4s/pull/457
ObservableInstrumentBuilder
by @iRevive in https://github.com/typelevel/otel4s/pull/458
Meter[F].batchCallback
by @iRevive in https://github.com/typelevel/otel4s/pull/459
withExplicitBucketBoundaries
by @iRevive in https://github.com/typelevel/otel4s/pull/435
sdk
module - unpublished yetSdkTraceScope
by @iRevive in https://github.com/typelevel/otel4s/pull/400
SdkSpanBuilder
by @iRevive in https://github.com/typelevel/otel4s/pull/403
BatchSpanProcessor
by @iRevive in https://github.com/typelevel/otel4s/pull/390
SdkTracer
, SdkTracerBuilder
, SdkTracerProvider
by @iRevive in https://github.com/typelevel/otel4s/pull/418
B3Propagator
by @iRevive in https://github.com/typelevel/otel4s/pull/440
W3CTraceContextPropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/442
W3CTraceContextPropagator
to the context.propagation
package by @iRevive in https://github.com/typelevel/otel4s/pull/461
W3CBaggagePropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/462
JaegerPropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/463
ContextPropagatorsAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/469
ContextPropagatorsAutoConfigure
- cleanup, add more tests by @iRevive in https://github.com/typelevel/otel4s/pull/476
SamplerAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/471
SamplerAutoConfigure
extendable by @iRevive in https://github.com/typelevel/otel4s/pull/492
SpanExportersAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/477
TracerProviderAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/498
SdkTraces
by @iRevive in https://github.com/typelevel/otel4s/pull/500
Baggage
by @iRevive in https://github.com/typelevel/otel4s/pull/452
AutoConfigure
- use config keys in the error message by @iRevive in https://github.com/typelevel/otel4s/pull/472
OpenTelemetrySdk
by @iRevive in https://github.com/typelevel/otel4s/pull/501
AutoConfigure
and Config
by @iRevive in https://github.com/typelevel/otel4s/pull/445
extra
attributes in tests by @iRevive in https://github.com/typelevel/otel4s/pull/444
SdkSpanBackendSuite
by @NthPortal in https://github.com/typelevel/otel4s/pull/438
BatchSpanProcessorAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/485
1.1.0-alpha
by @iRevive in https://github.com/typelevel/otel4s/pull/479
OtlpHttpSpanExporter
by @iRevive in https://github.com/typelevel/otel4s/pull/421
OtlpHttpClientAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/478
CrossType.Pure
by @iRevive in https://github.com/typelevel/otel4s/pull/483
OtlpSpanExporterAutoConfigure
by @iRevive in https://github.com/typelevel/otel4s/pull/484
OtlpSpanExporterAutoConfigure
to the src
folder by @iRevive in https://github.com/typelevel/otel4s/pull/486
Arbitrary
, Gen
, and Cogen
instances by @iRevive in https://github.com/typelevel/otel4s/pull/423
cats.effect.std.Console
in tests by @iRevive in https://github.com/typelevel/otel4s/pull/443
TraceScope
between sdk
and oteljava
modules by @iRevive in https://github.com/typelevel/otel4s/pull/482
TracerSuite
between oteljava
and sdk
modules by @iRevive in https://github.com/typelevel/otel4s/pull/490
.to(Attributes)
instead of .fromSpecific
by @iRevive in https://github.com/typelevel/otel4s/pull/516
otel4s-java
-> otel4s-oteljava
by @iRevive in https://github.com/typelevel/otel4s/pull/525
@threadUnsafe
annotation by @armanbilge in https://github.com/typelevel/otel4s/pull/425
otel4s-java-common
by @armanbilge in https://github.com/typelevel/otel4s/pull/410
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.4.0...v0.5.0-RC1
Published by iRevive 10 months ago
We are happy to announce the 0.4.0
release.
[!WARNING]
This version has several breaking changes and is binary incompatible with the0.3.0
lineage.
1.23.1
1.23.0
release of the semantic conventions marks HTTP conventions stable.
Attributes
is a collection nowThe 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)
@threadUnsafe3
annotation to lazy val
s by @armanbilge in https://github.com/typelevel/otel4s/pull/364
SpanContext
sealed by @iRevive in https://github.com/typelevel/otel4s/pull/359
Builder
of Attributes
. Documentation improvements by @iRevive in https://github.com/typelevel/otel4s/pull/382
Resource
as a sealed trait by @iRevive in https://github.com/typelevel/otel4s/pull/383
Attributes
collection type by @NthPortal in https://github.com/typelevel/otel4s/pull/389
Attribute
creation ergonomics by @NthPortal in https://github.com/typelevel/otel4s/pull/406
1.23.1-alpha
semantic convention by @iRevive in https://github.com/typelevel/otel4s/pull/408
StatusData
by @iRevive in https://github.com/typelevel/otel4s/pull/360
LinkData
by @iRevive in https://github.com/typelevel/otel4s/pull/367
EventData
by @iRevive in https://github.com/typelevel/otel4s/pull/369
IdGenerator
by @iRevive in https://github.com/typelevel/otel4s/pull/370
SpanData
by @iRevive in https://github.com/typelevel/otel4s/pull/372
SpanProcessor
by @iRevive in https://github.com/typelevel/otel4s/pull/374
SpanExporter
by @iRevive in https://github.com/typelevel/otel4s/pull/373
SdkSpanBackend
by @iRevive in https://github.com/typelevel/otel4s/pull/395
Context
by @iRevive in https://github.com/typelevel/otel4s/pull/391
SimpleSpanProcessor
by @iRevive in https://github.com/typelevel/otel4s/pull/388
SpanProcessor
- rethrow a composite failure on multiple errors by @iRevive in https://github.com/typelevel/otel4s/pull/386
Published by iRevive 12 months ago
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 the0.2.0
lineage.
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())
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, *]]
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
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])
SpanBuilder#wrapResource
Unfortunately, this API makes implementing a natural transformation for Tracer
impossible.
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 ()
}
Tracer#propagate
by @NthPortal in https://github.com/typelevel/otel4s/pull/285
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/207
{Contra;In}variant
instances for TextMap{Get;Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/225
Tracer
and SpanBuilder
: change type constraint from MonadCancelThrow
to Applicative
by @iRevive in https://github.com/typelevel/otel4s/pull/282
TracerProvider.noop
by @iRevive in https://github.com/typelevel/otel4s/pull/319
updateName
to Span
by @iRevive in https://github.com/typelevel/otel4s/pull/327
mapK
to Tracer
, SpanBuilder
, etc. by @NthPortal in https://github.com/typelevel/otel4s/pull/284
KindTransformer
for identity by @NthPortal in https://github.com/typelevel/otel4s/pull/335
Tracer{Provider,Builder}#mapK
by @NthPortal in https://github.com/typelevel/otel4s/pull/338
Hash
and Show
for Key
by @NthPortal in https://github.com/typelevel/otel4s/pull/337
TextMapPropagator
by @iRevive in https://github.com/typelevel/otel4s/pull/332
Hash
and Show
instances by @iRevive in https://github.com/typelevel/otel4s/pull/331
Tracer#currentSpanOrNoop
by @NthPortal in https://github.com/typelevel/otel4s/pull/349
TraceState
by @iRevive in https://github.com/typelevel/otel4s/pull/356
InstrumentationScope
by @iRevive in https://github.com/typelevel/otel4s/pull/354
Tracer#joinOrRoot
- propagate extracted headers downstream by @iRevive in https://github.com/typelevel/otel4s/pull/301
TextMapGetter#keys
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/221
Customization
section by @iRevive in https://github.com/typelevel/otel4s/pull/279
Modules structure
page. Update index pages by @iRevive in https://github.com/typelevel/otel4s/pull/346
Tracing instrumentation
page by @iRevive in https://github.com/typelevel/otel4s/pull/352
Tracing context propagation
page by @iRevive in https://github.com/typelevel/otel4s/pull/348
Tracing - interop with Java-instrumented libraries
page by @iRevive in https://github.com/typelevel/otel4s/pull/353
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/222
Tracer.Meta#noopResSpan
by @NthPortal in https://github.com/typelevel/otel4s/pull/228
SpanBuilder#wrapResource
API by @NthPortal in https://github.com/typelevel/otel4s/pull/273
Published by iRevive about 1 year ago
KindTransformer
for identity by @NthPortal in https://github.com/typelevel/otel4s/pull/335
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.3.0-RC1...v0.3.0-RC2
Published by iRevive about 1 year ago
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 the0.2.0
lineage.
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())
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, *]]
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])
SpanBuilder#wrapResource
Unfortunately, this API makes implementing a natural transformation for Tracer
impossible.
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 ()
}
Tracer#propagate
by @NthPortal in https://github.com/typelevel/otel4s/pull/285
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/207
{Contra;In}variant
instances for TextMap{Get;Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/225
Tracer
and SpanBuilder
: change type constraint from MonadCancelThrow
to Applicative
by @iRevive in https://github.com/typelevel/otel4s/pull/282
TracerProvider.noop
by @iRevive in https://github.com/typelevel/otel4s/pull/319
updateName
to Span
by @iRevive in https://github.com/typelevel/otel4s/pull/327
mapK
to Tracer
, SpanBuilder
, etc. by @NthPortal in https://github.com/typelevel/otel4s/pull/284
Tracer#joinOrRoot
- propagate extracted headers downstream by @iRevive in https://github.com/typelevel/otel4s/pull/301
TextMapGetter#keys
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/221
Customization
section by @iRevive in https://github.com/typelevel/otel4s/pull/279
TextMap{Get,Set,Upda}ter
by @AprilAtBanno in https://github.com/typelevel/otel4s/pull/222
Tracer.Meta#noopResSpan
by @NthPortal in https://github.com/typelevel/otel4s/pull/228
SpanBuilder#wrapResource
API by @NthPortal in https://github.com/typelevel/otel4s/pull/273
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.2.1...v0.3.0-RC1
Published by rossabaker over 1 year ago
otel4s-v0.2.1 is a breaking change from v0.1.0. It contains mutliple bugfixes and new features, highlighted by propagation.
The tag hit a non-deterministic test on publish. v0.2.1 is the first release in this series.
SpanRunner
outside SpanBuilderImpl
by @iRevive in https://github.com/typelevel/otel4s/pull/122
sdk.shutdown()
to shut all providers down by @iRevive in https://github.com/typelevel/otel4s/pull/138
Tracer#joinOrRoot
utility method by @iRevive in https://github.com/typelevel/otel4s/pull/149
observable*
methods by @iRevive in https://github.com/typelevel/otel4s/pull/172
We are continuing the original discussion from v0.2.0.
Full Changelog: https://github.com/typelevel/otel4s/compare/v0.1.0...v0.2.1
Published by rossabaker over 1 year ago
Cursed tag, didn't release. Please proceed to v0.2.1.
Published by rossabaker over 1 year ago
This is the first public release of otel4s, an OpenTelemetry implementation for Cats Effect. Rather than another ad hoc metrics or tracing abstraction, we are leaning fully into the OpenTelemetry specification. By embracing this ecosystem:
Meanwhile, the API is purely functional, built on core Cats Effect abstractions, making it a natural fit into the Typelevel Scala ecosystem.
The API is highly experimental, but already capable of exporting traces and metrics. We welcome all library and application developers who want to try it on for size, but discourage making it a dependency of a binary-stable library at this point in time. We welcome your feedback in the form of issues, discussions, and pull requests.