Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measure metrics using otel4s #396

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
501f8e1
Measure metrics using `otel4s`
iRevive Jun 9, 2022
67462d9
Merge branch 'main' into otel4s
iRevive Jun 9, 2022
8502140
Merge branch 'main' into otel4s
iRevive Jun 13, 2022
0a99a7b
Update otel4s
iRevive Jun 13, 2022
734fedf
Use `CrossType.Full`
iRevive Jun 13, 2022
4a178e8
Use `otel4s-testkit`
iRevive Jun 18, 2022
0aa2dd4
Merge branch 'main' into otel4s
iRevive Jul 3, 2022
a3b253d
Update `otel4s-testkit`
iRevive Jul 3, 2022
1e16c63
Generate headers, update `ci.yml`
iRevive Jul 3, 2022
7f172fb
Use snapshot version of `otel4s`
iRevive Aug 3, 2022
c5e6572
Merge branch 'main' into otel4s
iRevive Aug 3, 2022
016178b
Use `Resolver.sonatypeOssRepos`
iRevive Aug 3, 2022
3fd620a
Merge branch 'main' into otel4s
iRevive Jan 25, 2023
831588c
Use `otel4s` snapshot
iRevive Jan 25, 2023
e17b987
Merge branch 'main' into otel4s
iRevive Feb 8, 2023
369482e
Use `0.1.0` of `otel4s`
iRevive Feb 8, 2023
bbee8bf
Merge branch 'main' into otel4s
iRevive Mar 30, 2024
8792c34
Update otel4s to `0.5.0`
iRevive Mar 30, 2024
8afd322
Move otel4s integration to a separate module
iRevive Mar 31, 2024
00e75ee
generate CI workflow
iRevive Mar 31, 2024
8212c5b
Update build.sbt
iRevive Apr 16, 2024
8e12526
build.sbt: update previous mima artifacts for otel4s
iRevive Apr 16, 2024
98da94d
add scaladocs, update tests
iRevive Apr 16, 2024
f7a16b7
fix compilation issue
iRevive Apr 16, 2024
041bd81
make mima happy
iRevive Apr 16, 2024
6bfb557
Use otel4s `0.7.0`
iRevive May 5, 2024
0aae98b
Merge branch 'main' into otel4s
iRevive May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import com.typesafe.tools.mima.core._
val Scala213 = "2.13.8"

ThisBuild / tlBaseVersion := "0.4"
ThisBuild / crossScalaVersions := Seq("2.12.16", Scala213, "3.0.2")
ThisBuild / crossScalaVersions := Seq("2.12.16", Scala213, "3.1.2")
ThisBuild / tlVersionIntroduced := Map("3" -> "0.4.3")
ThisBuild / developers += tlGitHubDev("ChristopherDavenport", "Christopher Davenport")
ThisBuild / startYear := Some(2019)
Expand Down Expand Up @@ -58,7 +58,7 @@ lazy val docs = project
val catsV = "2.7.0"
val catsEffectV = "3.3.13"

val otel4sV = "0.0-53d0a08-20220703T071423Z-SNAPSHOT"
val otel4sV = "0.0-2daac91-SNAPSHOT"

val munitV = "0.7.29"
val munitCatsEffectV = "1.0.7"
Expand All @@ -69,6 +69,7 @@ val betterMonadicForV = "0.3.1"
// General Settings
lazy val commonSettings = Seq(
Test / parallelExecution := false,
resolvers += "Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots",
iRevive marked this conversation as resolved.
Show resolved Hide resolved
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-effect-std" % catsEffectV,
Expand Down
22 changes: 11 additions & 11 deletions core/jvm/src/test/scala/org/typelevel/keypool/PoolMetricsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import munit.CatsEffectSuite
import org.typelevel.otel4s.Otel4s
import org.typelevel.otel4s.java.OtelJava
import org.typelevel.otel4s.metrics.MeterProvider
import org.typelevel.otel4s.testkit.{HistogramPointData, Metric, MetricData, Sdk}
import org.typelevel.otel4s.testkit.{HistogramPointData, MetricData, Sdk}
import scala.concurrent.duration._
import scala.jdk.CollectionConverters._
import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -131,7 +131,7 @@ class PoolMetricsSpec extends CatsEffectSuite {
.map { case (inUse, afterUse) =>
val acquireDuration =
List(
HistogramPointData(0, 1, HistogramBuckets, List(1, 0, 0, 0, 0))
new HistogramPointData(0, 1, HistogramBuckets, List(1, 0, 0, 0, 0))
)

val expectedInUse = MetricsSnapshot(
Expand All @@ -146,7 +146,7 @@ class PoolMetricsSpec extends CatsEffectSuite {
idle = List(1),
inUse = List(0),
inUseDuration = List(
HistogramPointData(500.0, 1, HistogramBuckets, List(0, 0, 0, 1, 0))
new HistogramPointData(500.0, 1, HistogramBuckets, List(0, 0, 0, 1, 0))
),
acquiredTotal = List(1),
acquireDuration = acquireDuration
Expand Down Expand Up @@ -203,19 +203,19 @@ class PoolMetricsSpec extends CatsEffectSuite {
} yield {
def counterValue(name: String): List[Long] =
metrics
.collectFirst {
case Metric(metricName, _, _, _, _, MetricData.LongSum(points))
if metricName == name =>
points.map(_.value)
.find(_.name == name)
.map(_.data)
.collectFirst { case MetricData.LongSum(points) =>
points.map(_.value)
}
.getOrElse(Nil)

def histogramSnapshot(name: String): List[HistogramPointData] =
metrics
.collectFirst {
case Metric(metricName, _, _, _, _, h: MetricData.Histogram)
if metricName == name =>
h.points.map(_.value)
.find(_.name == name)
.map(_.data)
.collectFirst { case MetricData.Histogram(points) =>
points.map(_.value)
}
.getOrElse(Nil)

Expand Down