-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed decrement and added attributes
- Loading branch information
José Carlos Montañez
authored and
José Carlos Montañez
committed
Sep 4, 2024
1 parent
e908824
commit 22bc441
Showing
3 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
...ntelemetry/src/main/kotlin/com/xebia/functional/xef/opentelemetry/OpenTelemetryCounter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
package com.xebia.functional.xef.opentelemetry | ||
|
||
import com.xebia.functional.xef.metrics.CounterMetric | ||
import io.opentelemetry.api.common.Attributes | ||
|
||
class OpenTelemetryCounter(private val longCounter: io.opentelemetry.api.metrics.LongCounter) : | ||
CounterMetric { | ||
override fun increment(n: Long) { | ||
longCounter.add(n) | ||
} | ||
|
||
override fun decrement(n: Long) { | ||
longCounter.add(n) | ||
override fun increment(n: Long, attributes: Map<String, String>) { | ||
val attributesBuilder = Attributes.builder() | ||
attributes.forEach { (k, v) -> attributesBuilder.put(k, v) } | ||
longCounter.add(n, attributesBuilder.build()) | ||
} | ||
} |