Skip to content

feat(statistics): add operator data production stats#96

Merged
shark0F0497 merged 2 commits into
mainfrom
feat/collector-data-statistics
Jun 17, 2026
Merged

feat(statistics): add operator data production stats#96
shark0F0497 merged 2 commits into
mainfrom
feat/collector-data-statistics

Conversation

@shark0F0497

Copy link
Copy Markdown
Collaborator

Pull Request Checklist

Please ensure your PR meets the following requirements:

  • Code follows the style guidelines
  • Tests pass locally
  • Code is formatted
  • Documentation updated if needed
  • Commit messages follow conventional commits
  • PR description is complete and clear

Summary

This PR adds data collector self-service data production statistics APIs and documents the operator personal production page design.


Motivation

  • Let data collectors view their own daily production metrics after logging in to Synapse.
  • Reuse the existing admin data production statistics semantics while enforcing backend scoping to the current collector.

Changes

Modified Files

  • internal/api/handlers/data_production_statistics.go - Adds operator statistics routes and wraps existing summary/trend/breakdown logic with current-collector scoping.
  • internal/api/handlers/data_production_statistics_test.go - Adds tests for ignoring request collector filters and overriding them with JWT claims.
  • internal/server/server.go - Registers /operator/statistics/data-production routes for data_collector.

Added Files

  • docs/designs/operator-data-production-statistics.zh.html - Documents final product/API decisions for operator personal production statistics.

Deleted Files

None


Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update (documentation changes only)
  • Refactoring (code improvement without functional changes)
  • Performance improvement (code changes that improve performance)
  • Test changes (adding, modifying, or removing tests)

Impact Analysis

Breaking Changes

None

Backward Compatibility

Admin statistics APIs remain unchanged. Operator APIs are additive.


Testing

Test Environment

Local development environment.

Test Cases

  • Unit tests pass locally
  • Integration tests pass locally
  • E2E tests pass (if applicable)
  • Manual testing completed

Manual Testing Steps

Not performed.

Test Coverage

  • New tests added
  • Existing tests updated
  • Coverage maintained or improved

Screenshots / Recordings

Not applicable.


Performance Impact

  • Memory usage: No change
  • CPU usage: No change
  • Throughput: No change
  • Lock contention: No change

Documentation


Related Issues

  • Fixes #
  • Related to #
  • Refers to #

Additional Notes

The existing /production/dashboard backend API is retained because it is still used by the Synapse admin big-screen dashboard.


Reviewers


Notes for Reviewers

  • Please review current-collector scoping in internal/api/handlers/data_production_statistics.go.
  • Confirm that incoming collector_operator_id cannot be used to view another collector's statistics.

Checklist for Reviewers

  • Code changes are correct and well-implemented
  • Tests are adequate and pass
  • Documentation is updated and accurate
  • No unintended side effects
  • Performance impact is acceptable
  • Backward compatibility maintained (if applicable)

@shark0F0497 shark0F0497 merged commit 043ed1d into main Jun 17, 2026
5 checks passed
@shark0F0497 shark0F0497 deleted the feat/collector-data-statistics branch June 17, 2026 11:29
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.

1 participant