Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics(indexer): Add metrics around join time for chained processing strategies #68828

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/sentry/sentry_metrics/consumers/indexer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def close(self) -> None:
self.__closed = True

def join(self, timeout: float | None = None) -> None:
if self.__batch:
last = self.__batch.messages[-1]
logger.debug(
"Abandoning batch of %s messages...latest offset: %s",
len(self.__batch),
last.committable,
)

self.__next_step.close()
self.__next_step.join(timeout)
with metrics.timer("metrics_consumer.join_time.batch_messages"):
if self.__batch:
last = self.__batch.messages[-1]
logger.debug(
"Abandoning batch of %s messages...latest offset: %s",
len(self.__batch),
last.committable,
)
self.__next_step.close()
self.__next_step.join(timeout)
9 changes: 6 additions & 3 deletions src/sentry/sentry_metrics/consumers/indexer/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
RoutingProducerStep,
)
from sentry.sentry_metrics.consumers.indexer.slicing_router import SlicingRouter
from sentry.utils import metrics
from sentry.utils.arroyo import MultiprocessingPool, RunTaskWithMultiprocessing
from sentry.utils.kafka import delay_kafka_rebalance

Expand Down Expand Up @@ -75,8 +76,9 @@ def terminate(self) -> None:
self.__next_step.terminate()

def join(self, timeout: float | None = None) -> None:
self.__next_step.close()
self.__next_step.join(timeout)
with metrics.timer("metrics_consumer.join_time.unbatcher"):
self.__next_step.close()
self.__next_step.join(timeout)


class MetricsConsumerStrategyFactory(ProcessingStrategyFactory[KafkaPayload]):
Expand Down Expand Up @@ -188,7 +190,8 @@ def create_with_partitions(
return strategy

def shutdown(self) -> None:
self.__pool.close()
with metrics.timer("metrics_consumer.strategy_factory.close"):
self.__pool.close()


def get_metrics_producer_strategy(
Expand Down
Loading