Skip to content

[ENG-9705] osfmetrics using es8#11739

Open
aaxelb wants to merge 1 commit into
CenterForOpenScience:feature/9691-osfmetrics-cleanup-drop-es6from
aaxelb:9705-osfmetrics-using-es8
Open

[ENG-9705] osfmetrics using es8#11739
aaxelb wants to merge 1 commit into
CenterForOpenScience:feature/9691-osfmetrics-cleanup-drop-es6from
aaxelb:9705-osfmetrics-using-es8

Conversation

@aaxelb
Copy link
Copy Markdown
Collaborator

@aaxelb aaxelb commented May 14, 2026

Ticket

Purpose

make osfmetrics use data stored in elastic8 (following #11700 )

Changes

  • change all api using es6-based osf.metrics to use es8-based counterparts
  • change periodic reporters (in osf.metrics.reporters) that use CountedAuthUsage (es6) to use OsfCountedUsageEvent (es8)

Side Effects

  • simplify api view mixin for preprint views and downloads (less generic; more hard-coded)
  • changes according to different djelme base classes -- e.g. CyclicRecord.cycle_coverage (generic semver-like time string) instead of DailyReport.report_date/MonthlyReport.report_yearmonth
  • usage counts now have more consistent deduplication
  • (because it seemed easy and good) add experimental /_/metrics/reports/<reportname>/ that reuses api.base.elasticsearch_dsl_views.ElasticsearchListView to give a more usable/consistent jsonapi view than (the honestly kinda janky) /_metrics/reports/<reportname>/recent/
  • some things were easier to delete than maintain -- next PR would have deleted them anyway, and will delete more
    • various es6-entangled tests
    • saving usage events to es6
    • preprint views/downloads on all but preprint-detail view
    • management commands:
      • make_dummy_pageviews_for_metrics
      • metrics_backfill_pageviews
      • metrics_backfill_summaries
      • metrics_backfill_user_domains

QE Notes

api changes:

  • structure and counts unchanged (but data is coming from a different place):
    • /v2/institutions/<id>/metrics/summary/
    • /v2/institutions/<id>/metrics/users/
    • /v2/institutions/<id>/metrics/departments/
  • unchanged in structure, but counts might change due to more effective deduplication:
    • /v2/preprints/<id>/?metrics[views]=<timespan>
    • /v2/preprints/<id>/?metrics[downloads]=<timespan>
    • /_/metrics/query/node_analytics/<id>/<timespan>/
    • /_/metrics/query/user_visits/
    • /_/metrics/query/unique_user_visits/
  • slightly changed in structure (but shouldn't break anything):
    • /_/metrics/reports/<reportname>/recent/ -- some additional fields and different "type"
  • removed:
    • /_/metrics/preprints/views/
    • /_/metrics/preprints/downloads/
    • metrics params on preprints list view /v2/preprints/
    • metrics params on preprint providers /v2/providers/preprints/ and /v2/providers/preprints/<id>/

user-facing features that should still work as before:

  • institution admin dashboard (summary + users tab)
  • preprint view/download counts (may decrease due to better deduplication)
  • project/registration analytics page (some usage counts may decrease due to better deduplication)

CE Notes

Documentation

@aaxelb aaxelb force-pushed the 9705-osfmetrics-using-es8 branch from 4317df6 to 44df8db Compare May 14, 2026 19:03
@aaxelb aaxelb marked this pull request as ready for review May 14, 2026 19:21
@aaxelb aaxelb requested a review from felliott May 14, 2026 19:22
Copy link
Copy Markdown
Member

@felliott felliott left a comment

Choose a reason for hiding this comment

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

this is good, i like it

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.

2 participants