Skip to content

Commit

Permalink
Merge pull request #412 from NthPortal/rename-java-package/PR
Browse files Browse the repository at this point in the history
Rename `java` to `oteljava`
  • Loading branch information
NthPortal authored Dec 26, 2023
2 parents e42ddbd + fe58afd commit 65702c5
Show file tree
Hide file tree
Showing 61 changed files with 193 additions and 207 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p testkit/metrics/jvm/target java/metrics/target testkit/common/jvm/target core/trace/.js/target semconv/.jvm/target core/common/.jvm/target java/trace/target unidocs/target core/metrics/.native/target core/all/.native/target core/metrics/.jvm/target core/all/.js/target java/all/target java/common/target core/metrics/.js/target core/all/.jvm/target core/trace/.native/target semconv/.js/target core/trace/.jvm/target core/common/.native/target core/common/.js/target semconv/.native/target testkit/all/jvm/target project/target
run: mkdir -p testkit/metrics/jvm/target oteljava/metrics/target testkit/common/jvm/target core/trace/.js/target semconv/.jvm/target core/common/.jvm/target unidocs/target core/metrics/.native/target core/all/.native/target core/metrics/.jvm/target core/all/.js/target core/metrics/.js/target core/all/.jvm/target core/trace/.native/target semconv/.js/target oteljava/common/target core/trace/.jvm/target core/common/.native/target core/common/.js/target oteljava/trace/target semconv/.native/target testkit/all/jvm/target oteljava/all/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar testkit/metrics/jvm/target java/metrics/target testkit/common/jvm/target core/trace/.js/target semconv/.jvm/target core/common/.jvm/target java/trace/target unidocs/target core/metrics/.native/target core/all/.native/target core/metrics/.jvm/target core/all/.js/target java/all/target java/common/target core/metrics/.js/target core/all/.jvm/target core/trace/.native/target semconv/.js/target core/trace/.jvm/target core/common/.native/target core/common/.js/target semconv/.native/target testkit/all/jvm/target project/target
run: tar cf targets.tar testkit/metrics/jvm/target oteljava/metrics/target testkit/common/jvm/target core/trace/.js/target semconv/.jvm/target core/common/.jvm/target unidocs/target core/metrics/.native/target core/all/.native/target core/metrics/.jvm/target core/all/.js/target core/metrics/.js/target core/all/.jvm/target core/trace/.native/target semconv/.js/target oteljava/common/target core/trace/.jvm/target core/common/.native/target core/common/.js/target oteljava/trace/target semconv/.native/target testkit/all/jvm/target oteljava/all/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ it out and let us know what you think.
| Module / Platform | JVM | Scala Native | Scala.js |
|:-----------------:|:---:|:------------:|:--------:|
| `otel4s-core` ||||
| `otel4s-java` ||||
| `otel4s-oteljava` ||||

## Learn more

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter
import io.opentelemetry.sdk.trace.SdkTracerProvider
import io.opentelemetry.sdk.trace.`export`.SimpleSpanProcessor
import org.openjdk.jmh.annotations._
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.trace.Tracer

import java.util.concurrent.TimeUnit
Expand Down
78 changes: 31 additions & 47 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ lazy val root = tlCrossRootProject
`testkit-common`,
`testkit-metrics`,
testkit,
`java-common`,
`java-metrics`,
`java-trace`,
java,
`oteljava-common`,
`oteljava-metrics`,
`oteljava-trace`,
oteljava,
semconv,
benchmarks,
examples,
Expand Down Expand Up @@ -236,13 +236,13 @@ lazy val testkit = crossProject(JVMPlatform)
)
.settings(scalafixSettings)

lazy val `java-common` = project
.in(file("java/common"))
lazy val `oteljava-common` = project
.in(file("oteljava/common"))
.enablePlugins(BuildInfoPlugin)
.dependsOn(`core-common`.jvm, `testkit-common`.jvm % Test)
.settings(munitDependencies)
.settings(
name := "otel4s-java-common",
name := "otel4s-oteljava-common",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % CatsEffectVersion,
"org.typelevel" %%% "cats-mtl" % CatsMtlVersion,
Expand All @@ -252,66 +252,50 @@ lazy val `java-common` = project
"org.typelevel" %%% "cats-effect-testkit" % CatsEffectVersion % Test,
"io.opentelemetry" % "opentelemetry-sdk-testing" % OpenTelemetryVersion % Test
),
buildInfoPackage := "org.typelevel.otel4s.java",
buildInfoPackage := "org.typelevel.otel4s.oteljava",
buildInfoOptions += sbtbuildinfo.BuildInfoOption.PackagePrivate,
buildInfoKeys := Seq[BuildInfoKey](
"openTelemetrySdkVersion" -> OpenTelemetryVersion
)
)
.settings(scalafixSettings)

lazy val `java-metrics` = project
.in(file("java/metrics"))
.dependsOn(`java-common`, `core-metrics`.jvm, `testkit-metrics`.jvm % Test)
lazy val `oteljava-metrics` = project
.in(file("oteljava/metrics"))
.dependsOn(
`oteljava-common`,
`core-metrics`.jvm,
`testkit-metrics`.jvm % Test
)
.settings(munitDependencies)
.settings(
name := "otel4s-java-metrics",
name := "otel4s-oteljava-metrics",
libraryDependencies ++= Seq(
"io.opentelemetry" % "opentelemetry-sdk-testing" % OpenTelemetryVersion % Test
)
)
.settings(scalafixSettings)

lazy val `java-trace` = project
.in(file("java/trace"))
.dependsOn(`java-common`, `core-trace`.jvm)
lazy val `oteljava-trace` = project
.in(file("oteljava/trace"))
.dependsOn(`oteljava-common`, `core-trace`.jvm)
.settings(munitDependencies)
.settings(
name := "otel4s-java-trace",
name := "otel4s-oteljava-trace",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % CatsEffectVersion,
"io.opentelemetry" % "opentelemetry-sdk-testing" % OpenTelemetryVersion % Test,
"org.typelevel" %%% "cats-effect-testkit" % CatsEffectVersion % Test,
"co.fs2" %% "fs2-core" % FS2Version % Test,
),
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$Runner"
),
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$Runner$"
),
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$TimestampSelect"
),
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$TimestampSelect$"
),
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$TimestampSelect$Delegate$"
),
ProblemFilters.exclude[MissingClassProblem](
"org.typelevel.otel4s.java.trace.SpanBuilderImpl$TimestampSelect$Explicit$"
)
)
)
.settings(scalafixSettings)

lazy val java = project
.in(file("java/all"))
.dependsOn(core.jvm, `java-metrics`, `java-trace`)
lazy val oteljava = project
.in(file("oteljava/all"))
.dependsOn(core.jvm, `oteljava-metrics`, `oteljava-trace`)
.settings(
name := "otel4s-java",
name := "otel4s-oteljava",
libraryDependencies ++= Seq(
"io.opentelemetry" % "opentelemetry-sdk" % OpenTelemetryVersion,
"io.opentelemetry" % "opentelemetry-sdk-testing" % OpenTelemetryVersion % Test
Expand Down Expand Up @@ -343,7 +327,7 @@ lazy val benchmarks = project
.enablePlugins(NoPublishPlugin)
.enablePlugins(JmhPlugin)
.in(file("benchmarks"))
.dependsOn(core.jvm, sdk.jvm, java, testkit.jvm)
.dependsOn(core.jvm, sdk.jvm, oteljava, testkit.jvm)
.settings(
name := "otel4s-benchmarks"
)
Expand All @@ -352,7 +336,7 @@ lazy val benchmarks = project
lazy val examples = project
.enablePlugins(NoPublishPlugin, JavaAgent)
.in(file("examples"))
.dependsOn(core.jvm, java)
.dependsOn(core.jvm, oteljava)
.settings(
name := "otel4s-examples",
libraryDependencies ++= Seq(
Expand All @@ -377,7 +361,7 @@ lazy val examples = project
lazy val docs = project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.dependsOn(java)
.dependsOn(oteljava)
.settings(
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-http" % PekkoHttpVersion,
Expand Down Expand Up @@ -418,10 +402,10 @@ lazy val unidocs = project
`testkit-common`.jvm,
`testkit-metrics`.jvm,
testkit.jvm,
`java-common`,
`java-metrics`,
`java-trace`,
java,
`oteljava-common`,
`oteljava-metrics`,
`oteljava-trace`,
oteljava,
semconv.jvm
)
)
6 changes: 3 additions & 3 deletions docs/customization/histogram-custom-buckets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add settings to the `build.sbt`:

```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "otel4s-java" % "@VERSION@", // <1>
"org.typelevel" %% "otel4s-oteljava" % "@VERSION@", // <1>
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "@OPEN_TELEMETRY_VERSION@" % Runtime, // <2>
"io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "@OPEN_TELEMETRY_VERSION@" % Runtime // <3>
)
Expand All @@ -36,7 +36,7 @@ javaOptions += "-Dotel.service.name=histogram-buckets-example" // <4>
Add directives to the `histogram-buckets.scala`:

```scala
//> using lib "org.typelevel::otel4s-java:@VERSION@" // <1>
//> using lib "org.typelevel::otel4s-oteljava:@VERSION@" // <1>
//> using lib "io.opentelemetry:opentelemetry-exporter-otlp:@OPEN_TELEMETRY_VERSION@" // <2>
//> using lib "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:@OPEN_TELEMETRY_VERSION@" // <3>
//> using `java-opt` "-Dotel.service.name=histogram-buckets-example" // <4>
Expand Down Expand Up @@ -123,7 +123,7 @@ import io.opentelemetry.sdk.metrics.Aggregation
import io.opentelemetry.sdk.metrics.InstrumentSelector
import io.opentelemetry.sdk.metrics.InstrumentType
import io.opentelemetry.sdk.metrics.View
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.metrics.Histogram

import java.util.concurrent.TimeUnit
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Configure the project using your favorite tool, once again setup is similar to t
Add settings to the `build.sbt`:
```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "otel4s-java" % "@VERSION@", // <1>
"org.typelevel" %% "otel4s-oteljava" % "@VERSION@", // <1>
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "@OPEN_TELEMETRY_VERSION@" % Runtime, // <2>
"io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "@OPEN_TELEMETRY_VERSION@" % Runtime // <3>
)
Expand All @@ -29,7 +29,7 @@ javaOptions += "-Dotel.exporter.otlp.endpoint=http://localhost:4317" // <6>
Add directives to the `grafana.scala`:
```scala
//> using scala 3.3.0
//> using lib "org.typelevel::otel4s-java:@VERSION@" // <1>
//> using lib "org.typelevel::otel4s-oteljava:@VERSION@" // <1>
//> using lib "io.opentelemetry:opentelemetry-exporter-otlp:@OPEN_TELEMETRY_VERSION@" // <2>
//> using lib "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:@OPEN_TELEMETRY_VERSION@" // <3>
//> using `java-opt` "-Dotel.java.global-autoconfigure.enabled=true" // <4>
Expand Down Expand Up @@ -198,7 +198,7 @@ import cats.syntax.apply._
import cats.syntax.flatMap._
import cats.syntax.functor._
import org.typelevel.otel4s.Attribute
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.metrics.Meter
import org.typelevel.otel4s.trace.Tracer

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/honeycomb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Configure the project using your favorite tool:
Add settings to the `build.sbt`:
```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "otel4s-java" % "@VERSION@", // <1>
"org.typelevel" %% "otel4s-oteljava" % "@VERSION@", // <1>
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "@OPEN_TELEMETRY_VERSION@" % Runtime, // <2>
"io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "@OPEN_TELEMETRY_VERSION@" % Runtime // <3>
)
Expand All @@ -36,7 +36,7 @@ javaOptions += "-Dotel.exporter.otlp.endpoint=https://api.honeycomb.io/" // <6>

Add directives to the `tracing.scala`:
```scala
//> using lib "org.typelevel::otel4s-java:@VERSION@" // <1>
//> using lib "org.typelevel::otel4s-oteljava:@VERSION@" // <1>
//> using lib "io.opentelemetry:opentelemetry-exporter-otlp:@OPEN_TELEMETRY_VERSION@" // <2>
//> using lib "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:@OPEN_TELEMETRY_VERSION@" // <3>
//> using `java-opt` "-Dotel.java.global-autoconfigure.enabled=true" // <4>
Expand Down Expand Up @@ -94,7 +94,7 @@ import cats.effect.std.Console
import cats.effect.std.Random
import cats.syntax.all._
import org.typelevel.otel4s.{Attribute, AttributeKey}
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.metrics.Histogram
import org.typelevel.otel4s.trace.Tracer

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/jaeger-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Configure the project using your favorite tool:
Add settings to the `build.sbt`:
```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "otel4s-java" % "@VERSION@", // <1>
"org.typelevel" %% "otel4s-oteljava" % "@VERSION@", // <1>
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "@OPEN_TELEMETRY_VERSION@" % Runtime, // <2>
"io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "@OPEN_TELEMETRY_VERSION@" % Runtime // <3>
)
Expand All @@ -30,7 +30,7 @@ javaOptions += "-Dotel.metrics.exporter=none" // <6>

Add directives to the `tracing.scala`:
```scala
//> using lib "org.typelevel::otel4s-java:@VERSION@" // <1>
//> using lib "org.typelevel::otel4s-oteljava:@VERSION@" // <1>
//> using lib "io.opentelemetry:opentelemetry-exporter-otlp:@OPEN_TELEMETRY_VERSION@" // <2>
//> using lib "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:@OPEN_TELEMETRY_VERSION@" // <3>
//> using `java-opt` "-Dotel.java.global-autoconfigure.enabled=true" // <4>
Expand Down Expand Up @@ -81,7 +81,7 @@ import cats.effect.std.Console
import cats.effect.std.Random
import cats.syntax.all._
import org.typelevel.otel4s.Attribute
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.trace.Tracer

import scala.concurrent.duration._
Expand Down
12 changes: 6 additions & 6 deletions docs/instrumentation/tracing-java-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ It can be constructed in the following way:
import cats.effect._
import cats.mtl.Local
import cats.syntax.functor._
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.java.instances._ // brings Local derived from IOLocal
import org.typelevel.otel4s.oteljava.context.Context
import org.typelevel.otel4s.oteljava.OtelJava
import org.typelevel.otel4s.oteljava.instances._ // brings Local derived from IOLocal
import io.opentelemetry.api.GlobalOpenTelemetry

def createOtel4s[F[_]: Async](implicit L: Local[F, Context]): F[OtelJava[F]] =
Expand All @@ -78,7 +78,7 @@ For example, when you need to materialize an effect inside [Pekko HTTP][pekko-ht
To make it work, we can define a utility method:
```scala mdoc:silent:reset
import cats.mtl.Local
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.oteljava.context.Context
import io.opentelemetry.context.{Context => JContext}

def withJContext[F[_], A](ctx: JContext)(fa: F[A])(implicit L: Local[F, Context]): F[A] =
Expand All @@ -103,7 +103,7 @@ import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route
import org.typelevel.otel4s.Attribute
import org.typelevel.otel4s.trace.Tracer
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.oteljava.context.Context
import io.opentelemetry.instrumentation.annotations.WithSpan
import io.opentelemetry.context.{Context => JContext}
import scala.concurrent.duration._
Expand Down Expand Up @@ -150,7 +150,7 @@ The following utility method allows you to extract the current otel4s context an
import cats.effect.Sync
import cats.mtl.Local
import cats.syntax.flatMap._
import org.typelevel.otel4s.java.context.Context
import org.typelevel.otel4s.oteljava.context.Context
import io.opentelemetry.context.{Context => JContext}

def useJContext[F[_]: Sync, A](use: JContext => A)(implicit L: Local[F, Context]): F[A] =
Expand Down
8 changes: 4 additions & 4 deletions docs/instrumentation/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add settings to the `build.sbt`:

```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "otel4s-java" % "@VERSION@", // <1>
"org.typelevel" %% "otel4s-oteljava" % "@VERSION@", // <1>
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "@OPEN_TELEMETRY_VERSION@" % Runtime, // <2>
"io.opentelemetry" % "opentelemetry-sdk-extension-autoconfigure" % "@OPEN_TELEMETRY_VERSION@" % Runtime // <3>
)
Expand All @@ -29,15 +29,15 @@ javaOptions += "-Dotel.java.global-autoconfigure.enabled=true" // <4>
Add directives to the `*.scala` file:

```scala
//> using lib "org.typelevel::otel4s-java:@VERSION@" // <1>
//> using lib "org.typelevel::otel4s-oteljava:@VERSION@" // <1>
//> using lib "io.opentelemetry:opentelemetry-exporter-otlp:@OPEN_TELEMETRY_VERSION@" // <2>
//> using lib "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:@OPEN_TELEMETRY_VERSION@" // <3>
//> using `java-opt` "-Dotel.java.global-autoconfigure.enabled=true" // <4>
```

@:@

1. Add the `otel4s-java` library
1. Add the `otel4s-oteljava` library
2. Add an OpenTelemetry exporter. Without the exporter, the application will crash
3. Add an OpenTelemetry autoconfigure extension
4. Enable OpenTelemetry SDK [autoconfigure mode][opentelemetry-java-autoconfigure]
Expand All @@ -47,7 +47,7 @@ Once the build configuration is up-to-date, the `Tracer` can be created:
```scala mdoc:silent
import cats.effect.IO
import org.typelevel.otel4s.trace.Tracer
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.oteljava.OtelJava

OtelJava.global.flatMap { otel4s =>
otel4s.tracerProvider.get("com.service").flatMap { implicit tracer: Tracer[IO] =>
Expand Down
Loading

0 comments on commit 65702c5

Please sign in to comment.