Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Refactor Time Series Stats: Use Luxon, Generators and allow any kind of Time Frame sizing #1

Closed
wants to merge 34 commits into from

Conversation

MHHukiewitz
Copy link
Member

@MHHukiewitz MHHukiewitz commented Sep 22, 2022

Problem: Difficult to read and inefficient custom implementation for time series processing

Solution:

  • Use entirely luxon-based classes and types (Interval, Duration, DateTime)
  • Removed enum TimeFrame in favor of Duration in API and backend
  • All interval-related functionality in utils/time.ts is now based on generators and executes lazily, where possible
  • The process() function aggregating all stats will now use on average ~10x fewer operations to aggregate all time frame stats
  • Time Frames (or "candles"/"bars") can now be configured to be generated in arbitrary sizes, starting from 1-second, over 5-minute, or even 1,5-days candles.#

BREAKING CHANGE: timeFrame is now saved to LevelDB as milliseconds of the time frame duration instead of the old enum TimeFrame.

@MHHukiewitz
Copy link
Member Author

More tests to be added to make sure nothing broke along the way

@MHHukiewitz MHHukiewitz changed the title Refactor Time Series Stats: Use Luxon, Generators and allow any kind of Time Frame sizing [Draft] Refactor Time Series Stats: Use Luxon, Generators and allow any kind of Time Frame sizing Sep 22, 2022
…ries-luxon

# Conflicts:
#	packages/framework/src/utils/domain/indexer/worker.ts
# Conflicts:
#	package-lock.json
#	package.json
#	packages/core/package-lock.json
#	packages/framework/package-lock.json
#	packages/framework/src/utils/domain/indexer/worker.ts
#	packages/framework/src/utils/stats/timeSeries.ts
#	packages/framework/src/utils/stats/types.ts
#	packages/layout/package-lock.json
#	packages/middleware/package-lock.json
# Conflicts:
#	packages/core/package.json
#	packages/framework/package.json
@@ -152,6 +152,7 @@ export type ParsedTransactionV1 = Omit<
signature: string
blocktime: number
slot: number
account?: string
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove it

# Conflicts:
#	package-lock.json
#	package.json
#	packages/core/package.json
#	packages/framework/package.json
#	packages/framework/src/services/indexer/src/utils/accountTransactionIndexer.ts
#	packages/framework/src/utils/domain/indexer/worker.ts
# Conflicts:
#	package-lock.json
#	package.json
#	packages/framework/src/services/indexer/src/utils/transactionFetcher.ts
MHHukiewitz and others added 3 commits November 22, 2022 20:06
# Conflicts:
#	package-lock.json
#	packages/core/src/utils/time.ts
#	packages/framework/src/utils/stats/accountTimeSeries.ts
#	packages/framework/src/utils/stats/timeSeries.ts
@MHHukiewitz
Copy link
Member Author

Closed for now until #19 is taken care of, as Luxon-type objects are not being correctly serde'd between microservices.

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.

None yet

2 participants