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

Show finance metrics #1

Open
1 of 4 tasks
victorb opened this issue May 6, 2019 · 1 comment
Open
1 of 4 tasks

Show finance metrics #1

victorb opened this issue May 6, 2019 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@victorb
Copy link
Member

victorb commented May 6, 2019

The first version was supposed to show metrics for the registry and the finances, but ran out of time before being able to implement the backend side of things.

Uncommenting the following section should show some hardcoded values: https://github.com/open-services/open-registry-website/blob/master/index.html#L231-L345

What's missing is to have some recent hardcoded values instead of completely faked ones, so people without JS sees something.

If JS is activated, the page should hit an endpoint and parse the values to show the actual values. This could happen once every X seconds so we can updates values.

To get the metrics, there will be a GET request to something like:

# Warning: not yet implemented, hardcode in the meantime
curl 'http://metrics.open-registry.dev/api/v1/query?query=open_registry_balance'

And the response will look something like:

{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": [
      {
        "metric": {
          "__name__": "open_registry_balance",
          "instance": "finance:6000",
          "job": "application"
        },
        "value": [
          1557142394.476,
          "21322"
        ]
      }
    ]
  }
}

The correct value to read here is 21322 and you'll need to divide by 100 to
get the full value, so it's 213.22 and it's currency is EUR.

All different values for financing can be found here: https://github.com/open-services/finance-watch#examples

In the meantime, while I get the backend working, the response can be hardcoded in the website.

TODO

@victorb victorb added enhancement New feature or request good first issue Good for newcomers labels May 6, 2019
kbariotis added a commit to kbariotis/open-registry-website that referenced this issue May 6, 2019
@victorb
Copy link
Member Author

victorb commented May 7, 2019

Metrics endpoint is now public and can be called. URL would be https://metrics.open-registry.dev/api/v1/query?query=open_registry_balance and the value can be found like this:

curl 'https://metrics.open-registry.dev/api/v1/query?query=open_registry_balance' | jq ".data.result[0].value[1]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant