forked from Sunbird-Obsrv/obsrv-core
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#000: Added a metrics registry class to register all the metrics
- Loading branch information
Manjunath
authored and
Manjunath
committed
Nov 25, 2024
1 parent
1861d94
commit 0b056f3
Showing
2 changed files
with
102 additions
and
29 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
framework/src/main/scala/org/sunbird/obsrv/core/otel/MetricRegistry.scala
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package org.sunbird.obsrv.core.otel | ||
|
||
import io.opentelemetry.api.OpenTelemetry | ||
import io.opentelemetry.api.metrics.{LongCounter, Meter} | ||
|
||
object MetricRegistry { | ||
private val oTel: OpenTelemetry = OTelService.init() | ||
private val meter: Meter = oTel.meterBuilder("obsrv-pipeline").build() | ||
|
||
val errorCount: LongCounter = meter.counterBuilder("event.error.count") | ||
.setDescription("Dataset Error Event Count") | ||
.setUnit("1") | ||
.build() | ||
|
||
val processingTimeCounter: LongCounter = meter.counterBuilder("pipeline.processing.time") | ||
.setDescription("Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val totalProcessingTimeCounter: LongCounter = meter.counterBuilder("pipeline.total.processing.time") | ||
.setDescription("Total Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val latencyTimeCounter: LongCounter = meter.counterBuilder("pipeline.latency.time") | ||
.setDescription("Latency Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val extractorEventCounter: LongCounter = meter.counterBuilder("pipeline.extractor.events.count") | ||
.setDescription("Count of Extractor Events") | ||
.setUnit("1") | ||
.build() | ||
|
||
val extractorTimeCounter: LongCounter = meter.counterBuilder("pipeline.extractor.time") | ||
.setDescription("Extractor Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val transformStatusCounter: LongCounter = meter.counterBuilder("pipeline.transform.status") | ||
.setDescription("Data transform Status") | ||
.setUnit("1") | ||
.build() | ||
|
||
val transformTimeCounter: LongCounter = meter.counterBuilder("pipeline.transform.time") | ||
.setDescription("Transformation Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val denormStatusCounter: LongCounter = meter.counterBuilder("pipeline.denorm.status") | ||
.setDescription("Denorm Status") | ||
.setUnit("1") | ||
.build() | ||
|
||
val denormTimeCounter: LongCounter = meter.counterBuilder("pipeline.denorm.time") | ||
.setDescription("Denormalization Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val dedupStatusCounter: LongCounter = meter.counterBuilder("pipeline.de-dup.status") | ||
.setDescription("De-dup Status") | ||
.setUnit("1") | ||
.build() | ||
|
||
val dedupTimeCounter: LongCounter = meter.counterBuilder("pipeline.dedup.time") | ||
.setDescription("Deduplication Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val validatorTimeCounter: LongCounter = meter.counterBuilder("pipeline.validator.time") | ||
.setDescription("Validator Processing Time") | ||
.setUnit("ms") | ||
.build() | ||
|
||
val validatorStatusCounter: LongCounter = meter.counterBuilder("pipeline.validator.status") | ||
.setDescription("Validator Status") | ||
.setUnit("1") | ||
.build() | ||
|
||
val extractorStatusCounter: LongCounter = meter.counterBuilder("pipeline.extractor.status") | ||
.setDescription("Extractor Status") | ||
.setUnit("1") | ||
.build() | ||
|
||
} | ||
|
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