-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Metered thread pools Co-authored-by: Patryk Gutenplan <[email protected]> Co-authored-by: Patryk Żmigrodzki <[email protected]>
- Loading branch information
1 parent
8c87aa5
commit 7aa1030
Showing
2 changed files
with
90 additions
and
15 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
38 changes: 38 additions & 0 deletions
38
.../src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/metrics/ThreadPoolMetricTest.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package pl.allegro.tech.servicemesh.envoycontrol.metrics | ||
|
||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import pl.allegro.tech.servicemesh.envoycontrol.ControlPlane | ||
import pl.allegro.tech.servicemesh.envoycontrol.EnvoyControlProperties | ||
import pl.allegro.tech.servicemesh.envoycontrol.server.ExecutorType | ||
import reactor.core.publisher.Flux | ||
|
||
class ThreadPoolMetricTest { | ||
|
||
@Test | ||
fun `should bind metrics for default executors`() { | ||
// given | ||
val meterRegistry = SimpleMeterRegistry() | ||
val envoyControlProperties = EnvoyControlProperties().also { | ||
it.server.executorGroup.type = ExecutorType.PARALLEL | ||
it.server.groupSnapshotUpdateScheduler.type = ExecutorType.PARALLEL | ||
} | ||
|
||
val controlPlane = ControlPlane.builder(envoyControlProperties, meterRegistry).build(Flux.empty()) | ||
|
||
// when | ||
controlPlane.start() | ||
|
||
// then | ||
val allMeterNames = meterRegistry.meters.map { it.id.name } | ||
val requiredMeterNames = listOf("grpc-server-worker", "grpc-worker-event-loop", "snapshot-update", "group-snapshot").flatMap { | ||
listOf("$it.executor.completed", "$it.executor.active", "$it.executor.queued", "$it.executor.pool.size") | ||
} | ||
|
||
assertThat(allMeterNames).containsAll(requiredMeterNames) | ||
|
||
// and | ||
controlPlane.close() | ||
} | ||
} |