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

Create Metric Registry #4428

Merged
merged 32 commits into from
Nov 11, 2024
Merged

Create Metric Registry #4428

merged 32 commits into from
Nov 11, 2024

Conversation

IvanIvanoff
Copy link
Member

@IvanIvanoff IvanIvanoff commented Oct 16, 2024

Changes

Create a Metric Registry that is replacing the static JSON files used to define Clickhouse metrics.

The old way

Before, to expose a clickhouse metric through the API, a JSON map describing the metric needed to be added to a JSON file here in the repository, looking like this:

{
  "human_readable_name": "USD Trading Volume",
  "name": "volume_usd_5m",
  "metric": "trading_volume",
  "version": "2019-01-01",
  "access": "free",
  "selectors": [
    "slug"
  ],
  "min_plan": {
    "SANAPI": "free",
    "SANBASE": "free"
  },
  "aggregation": "last",
  "min_interval": "5m",
  "table": "intraday_metrics",
  "has_incomplete_data": false,
  "data_type": "timeseries",
  "docs_links": ["https://academy.santiment.net/metrics/trading-volume"]
}

The new way

Now the metrics definitions are moved to Postgres and a web interface is exposed to edit/create metrics.
The WEB interface is accessed through VPN and after credentials are obtained.
The endpoints are:

image

Showing metric details

Show all the details for a metric. The same fields as in the JSON file are exposed. Some of the fields are slightly renamed (aggregation -> default aggregation) or split (min_plan is not a map, but there are 2 fields: Sanbase Min Plan and Sanapi Min Plan)
image

Editing metrics

The metric information can be edited through the Web interface.
A big benefit of the web interface compared to the JSON files is that the changes are validated in real-time.

image image image

Ticket

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have tried to find clearer solution before commenting hard-to-understand parts of code
  • I have added tests that prove my fix is effective or that my feature works

@IvanIvanoff IvanIvanoff force-pushed the start-metrics-registry branch 2 times, most recently from b05c3e8 to 54c13ae Compare October 21, 2024 09:21
@IvanIvanoff IvanIvanoff force-pushed the start-metrics-registry branch 6 times, most recently from bb3a8a2 to f58eaed Compare October 31, 2024 16:02
@IvanIvanoff IvanIvanoff marked this pull request as ready for review November 11, 2024 12:08
@IvanIvanoff IvanIvanoff merged commit 2e7938c into master Nov 11, 2024
4 checks passed
@IvanIvanoff IvanIvanoff deleted the start-metrics-registry branch November 11, 2024 12:46
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