@@ -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 =>
0 commit comments