Skip to content

Commit

Permalink
allegro-internal/flex-roadmap#819 removed MetricsDiscoveryServerCallb…
Browse files Browse the repository at this point in the history
…acks, RemoteServices
  • Loading branch information
nastassia-dailidava committed Oct 20, 2024
1 parent 025872c commit ae04885
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.Tags
import pl.allegro.tech.servicemesh.envoycontrol.utils.CONNECTIONS_METRIC
import pl.allegro.tech.servicemesh.envoycontrol.utils.CONNECTION_TYPE_TAG
import pl.allegro.tech.servicemesh.envoycontrol.utils.DISCOVERY_REQ_TYPE_TAG
import pl.allegro.tech.servicemesh.envoycontrol.utils.REQUESTS_METRIC
import pl.allegro.tech.servicemesh.envoycontrol.utils.STREAM_TYPE_TAG
import java.util.concurrent.atomic.AtomicInteger
import io.envoyproxy.envoy.service.discovery.v3.DeltaDiscoveryRequest as V3DeltaDiscoveryRequest
Expand Down Expand Up @@ -60,30 +58,14 @@ class MetricsDiscoveryServerCallbacks(private val meterRegistry: MeterRegistry)
}

override fun onV3StreamRequest(streamId: Long, request: V3DiscoveryRequest) {
meterRegistry.counter(
REQUESTS_METRIC,
Tags.of(
CONNECTION_TYPE_TAG, "grpc",
STREAM_TYPE_TAG, StreamType.fromTypeUrl(request.typeUrl).name.lowercase(),
DISCOVERY_REQ_TYPE_TAG, "total"
)
)
.increment()
// noop
}

override fun onV3StreamDeltaRequest(
streamId: Long,
request: V3DeltaDiscoveryRequest
) {
meterRegistry.counter(
REQUESTS_METRIC,
Tags.of(
CONNECTION_TYPE_TAG, "grpc",
STREAM_TYPE_TAG, StreamType.fromTypeUrl(request.typeUrl).name.lowercase(),
DISCOVERY_REQ_TYPE_TAG, "delta"
)
)
.increment()
// noop
}

override fun onStreamCloseWithError(streamId: Long, typeUrl: String, error: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import pl.allegro.tech.servicemesh.envoycontrol.utils.CROSS_DC_SYNC_CANCELLED_ME
import pl.allegro.tech.servicemesh.envoycontrol.utils.CROSS_DC_SYNC_SECONDS_METRIC
import pl.allegro.tech.servicemesh.envoycontrol.utils.CROSS_DC_SYNC_TOTAL_METRIC
import pl.allegro.tech.servicemesh.envoycontrol.utils.OPERATION_TAG
import pl.allegro.tech.servicemesh.envoycontrol.utils.SERVICES_STATE_ERRORS_METRIC
import reactor.core.publisher.Flux
import reactor.core.publisher.FluxSink
import java.lang.Integer.max
Expand Down Expand Up @@ -70,13 +69,6 @@ class RemoteServices(
.thenApply { servicesStateFromCluster(cluster, it) }
.orTimeout(interval, TimeUnit.SECONDS)
.exceptionally {
meterRegistry.counter(
SERVICES_STATE_ERRORS_METRIC,
Tags.of(
CLUSTER_TAG, cluster,
OPERATION_TAG, "get-state"
)
).increment()
logger.warn("Error synchronizing instances ${it.message}", it)
clusterStateCache[cluster]
}
Expand All @@ -87,13 +79,6 @@ class RemoteServices(
val instances = controlPlaneInstanceFetcher.instances(cluster)
cluster to instances
} catch (e: Exception) {
meterRegistry.counter(
SERVICES_STATE_ERRORS_METRIC,
Tags.of(
CLUSTER_TAG, cluster,
OPERATION_TAG, "get-instances"
)
).increment()
logger.warn("Failed fetching instances from $cluster", e)
cluster to emptyList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pl.allegro.tech.servicemesh.envoycontrol

import io.micrometer.core.instrument.Tags
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension
import pl.allegro.tech.servicemesh.envoycontrol.assertions.untilAsserted
Expand Down Expand Up @@ -205,6 +206,7 @@ class DeltaAdsMetricsDiscoveryServerCallbackTest : MetricsDiscoveryServerCallbac
)
}

@Disabled
interface MetricsDiscoveryServerCallbacksTest {
companion object {
private val logger by logger()
Expand Down

0 comments on commit ae04885

Please sign in to comment.