Skip to content

The stats route returns aggregate event counts but no time-series breakdown, limiting its usefulness for activity dashboards #278

Description

@Lost-Z

Summary

crates/lumenqraph-api/src/routes/stats.rs returns aggregate statistics (total event count, per-contract counts). It does not provide time-series data — e.g. events per hour or per day over the last N days — which is the primary data needed for an activity dashboard or a volume chart in the explorer UI. Consumers must write their own GROUP BY queries against the database to get this information.

Expected Behavior

The stats endpoint should expose time-bucketed event counts over a configurable window.

Proposed Solution

  • Add GET /contracts/:id/stats?resolution=1h&window=7d returning event counts bucketed by the specified time resolution
  • Implement using Postgres date_trunc
  • Add the endpoint to the TypeScript SDK as getStats(contractId, opts)
  • Document in docs/API.md

Affected Files

  • crates/lumenqraph-api/src/routes/stats.rs
  • sdk/typescript/src/index.ts
  • docs/API.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiHTTP/GraphQL API surfaceenhancementNew feature or requestobservabilityMetrics, logging, tracing, health

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions