Skip to content

feat: implement Metrics for ng#968

Open
Pablu23 wants to merge 94 commits into
feat-integrate-asyncfrom
feat-async-metrics
Open

feat: implement Metrics for ng#968
Pablu23 wants to merge 94 commits into
feat-integrate-asyncfrom
feat-async-metrics

Conversation

@Pablu23

@Pablu23 Pablu23 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Implement Metrics for async NG code

Assignee

  • The changes adhere to the contribution guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings (e.g. flake8/mypy/pytest/...) other than deprecations

Documentation

Code Quality

  • Patch test coverage > 95% and does not decrease
  • New code uses correct & specific type hints

How did you verify that the changes work in practice?

Running benchmark script, and while that runs running curl localhost:8081/metrics and parsing the output with my eyes

Reviewer


The rendered docs for this PR can be found here.

kaya-david and others added 30 commits May 18, 2026 15:46
…s about queue sizes; add state reporting for terminal events
@Pablu23 Pablu23 self-assigned this May 27, 2026
@Pablu23 Pablu23 changed the title Metrics baseline for ng feat: Implement Metrics for ng May 28, 2026
@Pablu23 Pablu23 requested a review from mhoff May 28, 2026 08:37
@Pablu23

Pablu23 commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

NG Benchmarks --num-events 500000 --ng 1
=== FINAL BENCHMARK SUMMARY ===
runs: 3
total runtime: 180.001 s
total processed: 601_100

throughput (weighted): 3,339.43 docs/s
throughput (median): 3,357.86 docs/s
throughput (average): 3,268.26 docs/s
throughput (min/max): 3,009.95 / 3,436.98 docs/s
throughput (std dev): 227.18 docs/s

Non NG Benchmark (same parameters)
=== FINAL BENCHMARK SUMMARY ===
runs: 3
total runtime: 180.001 s
total processed: 572_986

throughput (weighted): 3,183.24 docs/s
throughput (median): 3,173.82 docs/s
throughput (average): 3,142.79 docs/s
throughput (min/max): 3,005.92 / 3,248.63 docs/s
throughput (std dev): 124.29 docs/s

logger = getLogger("Exporter")


def make_patched_asgi_app(functions: Iterable[Callable] | None) -> Callable:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the Callable more specific with its generic type parameter where useful and applicable.

At least:

Suggested change
def make_patched_asgi_app(functions: Iterable[Callable] | None) -> Callable:
def make_patched_asgi_app(functions: Iterable[Callable[[], bool]] | None) -> Callable:

@mhoff

mhoff commented May 29, 2026

Copy link
Copy Markdown
Collaborator

tests/unit/ng/conftest.py

from unittest import mock

import pytest

from logprep.registry import Registry


@pytest.fixture(autouse=True)
def rewrite_registry_get_class_to_ng():
    get_class = Registry.get_class.__func__

    def get_class_wrapped(cls, component_type: str):
        if not component_type.startswith("ng_"):
            component_type = f"ng_{component_type}"
        return get_class(cls, component_type)

    with mock.patch.object(Registry, "get_class", classmethod(get_class_wrapped)):
        yield

@mhoff mhoff force-pushed the feat-async-metrics branch from a810854 to 2a2f2ae Compare May 29, 2026 08:28
@mhoff mhoff changed the title feat: Implement Metrics for ng feat: implement Metrics for ng May 29, 2026
@mhoff mhoff force-pushed the feat-integrate-async branch from 1c27e21 to 84e213d Compare June 1, 2026 09:57
@mhoff mhoff force-pushed the feat-integrate-async branch from dcbbaea to a6fa9d2 Compare June 9, 2026 12:25
@mhoff mhoff force-pushed the feat-integrate-async branch from 6baf5b4 to 04049e4 Compare June 22, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants