Commit Graph

4 Commits

Author SHA1 Message Date
agodnic d9d49ec919
Add 24h volume to scorecards (#274)
### Summary

This pull request adds volume metrics to influxdb. Also, it adds the 24h volume metric to `GET /api/v1/scorecards`.

Tracking issues: https://github.com/wormhole-foundation/wormhole-explorer/issues/221, https://github.com/wormhole-foundation/wormhole-explorer/issues/280

### Changes:
* The `parser` service no longer generates metrics for influxdb. All metrics-related code was removed from that service, that code was moved to the analytics service instead.
* New volume metrics were added to the analytics service.
* The notional cache was modified to use token names (i.e.: ticker symbols) as keys instead of chain IDs.
* The notional cache reader was moved to the `common/client/cache` package.
* A little bit of duplicated code between the cache reader and writer was removed.
* A 24h volume metric was added to `GET /api/v1/scorecards`.
* A dictionary that stores token metadata was added under `common/domain/tokenbridge.go`. More tokens will be added to it in the near future.
2023-05-04 20:17:03 -03:00
agodnic c8aba636e4
[API/ANALYTICS] Scorecards endpoint (#232)
### Summary

This pull request adds the `GET /api/v1/scorecards` endpoint, which is required by the wormscan frontend.

Most of the fields that this endpoint should return are being omitted because the data is not currently available on the backend. Those fields will be added iteratively as the data becomes available.

The current format of the response is:
```json
{
  "total_tx_count": "1300200",
  "24h_tx_count": "4200"
}
```

Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/221

## Deployment details

In order to populate the `"total_tx_count"` metric, a task is needed in influxdb:

```
$ cat total-vaa-count.flux 
option task = {
	name: "Total number of emitted VAAs",
	every: 1m
}

from(bucket: "wormhole-explorer")
  |> range(start: 2018-01-01T00:00:00Z)
  |> filter(fn: (r) => r._measurement == "vaa_count")
  |> group(columns: ["_measurement"])
  |> set(key: "_measurement", value: "total_vaa_count")
  |> count()
  |> map(fn: (r) => ({r with _time: now()}))
  |> map(fn: (r) => ({r with _field: "total_vaa_count"}))
  |> to(bucket: "wormhole-explorer", org: "xlabs")

```
2023-04-20 16:01:10 -03:00
ftocal 32c1361782
fix: use of decimal for huge numbers (#203) 2023-03-22 13:38:43 -03:00
ftocal 867f1c2962
[API/PARSER] Chain activity and last transaction endpoints (#175)
* Fix analytic vaa metric and close metric client

* Add analytic component manifest

* Add metrics for cross chain activity endpoint

* Feature/add endpoint get vaa count (#171)

* Add trasaction controller + service

* Init getLastTrx endpoint

* Add endpoint for chain activity

* Add configmap and secrets for influx
Change Dockerfiles to support common library

* Add vaa_count endpoint

* Add cross-chain activity endpoint

* Fix vaa_count endpoint

* Add influx to api-service manifest

* Make response and add docs for chain activity endpoint

* Fix api deploy

* Fix lasl-trx json name

* Fix chain activity endpoint

* Fix doc and endpoint route last-txs

---------

Co-authored-by: Agustin Pazos <agpazos85@gmail.com>
2023-03-07 16:25:42 -03:00