[ENG-9703] Feature/add new es8 metrics#11672
[ENG-9703] Feature/add new es8 metrics#11672bodintsov wants to merge 3 commits intoCenterForOpenScience:feature/9691-osfmetrics-migrationfrom
Conversation
aaxelb
left a comment
There was a problem hiding this comment.
a few points clarifying intent for these migration targets
also, mind importing (at least something from) this file in osf/metrics/__init__.py and adding one or two smoke-tests to verify the index(templat)es are usable?
| class BasePreprintMetrics(djelme.CountedUsageRecord): | ||
| ''' | ||
| inherited fields: | ||
| platform_iri: str | ||
| database_iri: str | ||
| item_iri: str | ||
| sessionhour_id: str | ||
| within_iris: list[str] | ||
| ''' | ||
| count: int | ||
| provider_id: str | ||
| user_id: str | ||
| preprint_id: str | ||
| version: str | ||
| path: str | ||
|
|
||
| class Index: | ||
| settings = { | ||
| 'number_of_shards': 1, | ||
| 'number_of_replicas': 1, | ||
| 'refresh_interval': '1s', | ||
| } | ||
|
|
||
| class Meta: | ||
| abstract = True | ||
| source = djelme.MetaField(enabled=True) | ||
|
|
||
|
|
||
| class PreprintView(BasePreprintMetrics): | ||
| pass | ||
|
|
||
|
|
||
| class PreprintDownload(BasePreprintMetrics): | ||
| pass |
There was a problem hiding this comment.
let's get rid of the separate preprint metrics -- intending to use the migration as a chance to consolidate preprint views/downloads into the same OsfCountedUsageRecord used for views and downloads of other types of objects
| pageview_info: PageviewInfo | ||
|
|
||
|
|
||
| class CountedAuthUsage(djelme.CountedUsageRecord): |
There was a problem hiding this comment.
instead of copying this as-is, meant to consolidate into OsfCountedUsageRecord above -- some of the fields are now on the base djelme.CountedUsageRecord, except with less osf-specific names and IRIs instead of local ids:
provider_id=>database_irisurrounding_guids=>within_irisitem_guid=>item_iri(with additional osf-specificitem_osfidfor the "osf guid")session_id=>sessionhour_id(not actually a COUNTER term, but making clear it's different from various other "session ids" and is distinct per hour)
| pass | ||
|
|
||
|
|
||
| class RegistriesModerationMetrics(djelme.CountedUsageRecord): |
There was a problem hiding this comment.
| class RegistriesModerationMetrics(djelme.CountedUsageRecord): | |
| class RegistriesModerationMetrics(djelme.EventRecord): |
(CountedUsageRecord is a subclass of EventRecord with additional fields specific to COUNTER that we don't need for this internal event)
| # Cyclic reports | ||
|
|
||
|
|
||
| class StorageAddonUsage(djelme.CyclicRecord, cycle_timedepth=djelme.DAILY): |
There was a problem hiding this comment.
each CyclicRecord should have CYCLE_TIMEDEPTH classvar instead of the cycle_timedepth init-subclass kwarg (my fault this changed in djelme)
|
|
||
|
|
||
| class StorageAddonUsage(djelme.CyclicRecord, cycle_timedepth=djelme.DAILY): | ||
| usage_by_addon: UsageByStorageAddon |
There was a problem hiding this comment.
| usage_by_addon: UsageByStorageAddon | |
| usage_by_addon: list[UsageByStorageAddon] |
elastic-dsl list[...] annotations equivalent to old multi=True
| # fields autofilled from the above (see `_autofill_fields`) | ||
| page_path: str | ||
| referer_domain: str | ||
| hour_of_day: str |
There was a problem hiding this comment.
(prompted by the comment) ideally let's move logic from the signal-triggered _autofill_fields and friends into an __init__ on each relevant class
also, since these fields shouldn't be required by the constructor (esdsl might raise an error?), should add a default e.g. page_path: str = ''
Ticket
https://openscience.atlassian.net/browse/ENG-9703
Purpose
Add new es8 metrics
Changes
Added new es8 metrics
Side Effects
TBD
QE Notes
TBD
CE Notes
TBD
Documentation
TBD