• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / fx-private-relay / 1f27d7ef-045c-4b13-be21-3a6fa9a7e5a6

11 Apr 2025 10:13PM CUT coverage: 85.212% (+0.01%) from 85.201%
1f27d7ef-045c-4b13-be21-3a6fa9a7e5a6

Pull #5500

circleci

groovecoder
MPP-4012 - feat(glean): log API access as Glean server event

Introduce a new `api.accessed` Glean event to capture accesses to Relay API
endpoints. This includes the HTTP method and endpoint path, and logs events
for all `/api/` prefixed routes via a new middleware component.

- Added `record_api_accessed()` to `EventsServerEventLogger`
- Extended `RelayGleanLogger` with `log_api_accessed()` for easier integration
- Registered `GleanApiAccessMiddleware` to log access for all API routes
- Added corresponding unit test for API access logging
- Updated `relay-server-metrics.yaml` to define the `api.accessed` metric
- Updated notification email for several existing metrics to use relay-team@mozilla.com
Pull Request #5500: WIP: MPP-4012 - feat(glean): log API access as Glean server event

2461 of 3597 branches covered (68.42%)

Branch coverage included in aggregate %.

38 of 39 new or added lines in 5 files covered. (97.44%)

1 existing line in 1 file now uncovered.

17258 of 19544 relevant lines covered (88.3%)

9.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/emails/management/commands/delete_old_reply_records.py
1
from datetime import UTC, datetime, timedelta
×
2

3
from django.core.management.base import BaseCommand
×
4
from django.db import transaction
×
5

6
from ...models import Reply
×
7

8

9
class Command(BaseCommand):
×
10
    help = "Deletes all Reply objects older than 3 months."
×
11

12
    def add_arguments(self, parser):
×
13
        parser.add_argument("days_old", nargs=1, type=int)
×
14

15
    def handle(self, *args, **options):
×
16
        delete_date = datetime.now(UTC) - timedelta(options["days_old"][0])
×
17
        replies_to_delete = Reply.objects.filter(created_at__lt=delete_date).only("id")
×
18
        print(
×
19
            f"Deleting {len(replies_to_delete)} reply records "
20
            f"older than {delete_date}"
21
        )
22
        with transaction.atomic():
×
23
            replies_to_delete.delete()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc