Skip to content

Commit a7f7aa4

Browse files
Update prometheus-metrics-core, ... to 1.3.8 (#156)
## About this PR 📦 Updates * io.prometheus:prometheus-metrics-core * io.prometheus:prometheus-metrics-exposition-formats * io.prometheus:prometheus-metrics-instrumentation-jvm from `1.3.6` to `1.3.8` ## Usage ✅ **Please merge!** I'll automatically update this PR to resolve conflicts as long as you don't change it yourself. If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below. Configure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/55f6dc6a666c610d5d2505c5bf66308427a8d065/docs/repo-specific-configuration.md) file. _Have a fantastic day writing Scala!_ <details> <summary>⚙ Adjust future updates</summary> Add this to your `.scala-steward.conf` file to ignore future updates of this dependency: ``` updates.ignore = [ { groupId = "io.prometheus" } ] ``` Or, add this to slow down future updates of this dependency: ``` dependencyOverrides = [{ pullRequests = { frequency = "30 days" }, dependency = { groupId = "io.prometheus" } }] ``` </details> <sup> labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1 </sup> <!-- scala-steward = { "Update" : { "ForGroupId" : { "forArtifactIds" : [ { "ForArtifactId" : { "crossDependency" : [ { "groupId" : "io.prometheus", "artifactId" : { "name" : "prometheus-metrics-core", "maybeCrossName" : null }, "version" : "1.3.6", "sbtVersion" : null, "scalaVersion" : null, "configurations" : null } ], "newerVersions" : [ "1.3.8" ], "newerGroupId" : null, "newerArtifactId" : null } }, { "ForArtifactId" : { "crossDependency" : [ { "groupId" : "io.prometheus", "artifactId" : { "name" : "prometheus-metrics-exposition-formats", "maybeCrossName" : null }, "version" : "1.3.6", "sbtVersion" : null, "scalaVersion" : null, "configurations" : null } ], "newerVersions" : [ "1.3.8" ], "newerGroupId" : null, "newerArtifactId" : null } }, { "ForArtifactId" : { "crossDependency" : [ { "groupId" : "io.prometheus", "artifactId" : { "name" : "prometheus-metrics-instrumentation-jvm", "maybeCrossName" : null }, "version" : "1.3.6", "sbtVersion" : null, "scalaVersion" : null, "configurations" : "test" } ], "newerVersions" : [ "1.3.8" ], "newerGroupId" : null, "newerArtifactId" : null } } ] } }, "Labels" : [ "library-update", "early-semver-patch", "semver-spec-patch", "commit-count:1" ] } --> --------- Co-authored-by: Michel Davit <[email protected]>
1 parent d7c5dc5 commit a7f7aa4

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ lazy val `pekko-http-metrics-prometheus` = (project in file("prometheus"))
131131
libraryDependencies ++= Seq(
132132
Dependencies.PrometheusCore,
133133
Dependencies.PrometheusExpositionFormats,
134+
Dependencies.PrometheusExpositionTextFormats,
134135
Dependencies.Provided.PekkoStream,
135136
Dependencies.Test.Logback,
136137
Dependencies.Test.PekkoHttpTestkit,

project/Dependencies.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Dependencies {
1010
val Logback = "1.5.18"
1111
val Pekko = "1.1.4"
1212
val PekkoHttp = "1.2.0"
13-
val Prometheus = "1.3.6"
13+
val Prometheus = "1.3.8"
1414
val ScalaCollectionCompat = "2.13.0"
1515
val ScalaLogging = "3.9.5"
1616
val ScalaMock = "7.3.2"
@@ -27,6 +27,8 @@ object Dependencies {
2727
val PrometheusCore = "io.prometheus" % "prometheus-metrics-core" % Versions.Prometheus
2828
val PrometheusExpositionFormats =
2929
"io.prometheus" % "prometheus-metrics-exposition-formats" % Versions.Prometheus
30+
val PrometheusExpositionTextFormats =
31+
"io.prometheus" % "prometheus-metrics-exposition-textformats" % Versions.Prometheus
3032
val ScalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % Versions.ScalaLogging
3133

3234
object Provided {

prometheus/src/main/scala/fr/davit/pekko/http/metrics/prometheus/marshalling/PrometheusMarshallers.scala

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ trait PrometheusMarshallers {
3333
.applicationWithFixedCharset("openmetrics-text", HttpCharsets.`UTF-8`)
3434
.withParams(Map("version" -> "1.0.0"))
3535

36-
val OpenMetricsMarshaller: ToEntityMarshaller[PrometheusRegistry] = openMetricsMarshaller(false, false)
36+
val OpenMetricsMarshaller: ToEntityMarshaller[PrometheusRegistry] = openMetricsMarshaller()
3737
def openMetricsMarshaller(
38-
createdTimestampsEnabled: Boolean,
39-
exemplarsOnAllMetricTypesEnabled: Boolean
38+
createdTimestampsEnabled: Boolean = false,
39+
exemplarsOnAllMetricTypesEnabled: Boolean = false
4040
): ToEntityMarshaller[PrometheusRegistry] = {
41-
val writer = new OpenMetricsTextFormatWriter(createdTimestampsEnabled, exemplarsOnAllMetricTypesEnabled)
41+
val writer = OpenMetricsTextFormatWriter
42+
.builder()
43+
.setCreatedTimestampsEnabled(createdTimestampsEnabled)
44+
.setExemplarsOnAllMetricTypesEnabled(exemplarsOnAllMetricTypesEnabled)
45+
.build()
4246
Marshaller
4347
.byteArrayMarshaller(OpenMetricsContentType)
4448
.compose { registry =>
@@ -52,9 +56,12 @@ trait PrometheusMarshallers {
5256
.withParams(Map("version" -> "0.0.4"))
5357
.withCharset(HttpCharsets.`UTF-8`)
5458

55-
val TextMarshaller: ToEntityMarshaller[PrometheusRegistry] = textMarshaller(false)
56-
def textMarshaller(writeCreatedTimestamps: Boolean): ToEntityMarshaller[PrometheusRegistry] = {
57-
val writer = new PrometheusTextFormatWriter(writeCreatedTimestamps)
59+
val TextMarshaller: ToEntityMarshaller[PrometheusRegistry] = textMarshaller()
60+
def textMarshaller(includeCreatedTimestamps: Boolean = false): ToEntityMarshaller[PrometheusRegistry] = {
61+
val writer = PrometheusTextFormatWriter
62+
.builder()
63+
.setIncludeCreatedTimestamps(includeCreatedTimestamps)
64+
.build()
5865
Marshaller
5966
.byteArrayMarshaller(TextContentType)
6067
.compose { registry =>

prometheus/src/test/scala/fr/davit/pekko/http/metrics/prometheus/marshalling/PrometheusMarshallersSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class PrometheusMarshallersSpec extends AnyFlatSpec with Matchers with Scalatest
127127
}
128128

129129
it should "expose metrics as prometheus protobuf format" in new Fixture {
130-
import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_4_29_3.Metrics
130+
import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_4_31_0.Metrics
131131

132132
val request = Get().addHeader(Accept(PrometheusMarshallers.ProtobufContentType.mediaType))
133133
request ~> metrics(registry) ~> check {

0 commit comments

Comments
 (0)