# Loki to Prom Migration
## I. Javascript syntax:
### 1. Template literal interpolation
#### Example
```javascript
`${myVar}`
`${someMethod()}`
`${a + b + c}`
```
#### Usage
- interpolates 'myVar' the variable
- interpolates the result of a given expression (i.e., the return of `someMethod()` or `a + b + c`)
### 2. Ternary operators
#### Example
```javascript
myVar >= 1 ? 'return_if_true' : 'return_if_false'
```
#### Usage
- returns the left value if expression evalues to true, and the right expression if evaluates to false
### 3. Optional chaining
#### Example
```javascript
a?.b?.c
```
#### Usage
- if object a exists then get value b of a, if b exist, then get value c of b, otherwise return null
### 4. Nullish coalescing operator
#### Example
```javascript
value ?? 1
```
#### Usage
- returns value if value is not null/undefined, otherwise return 1
## II. Defaults
- BASE_URL: `/v1/metrics/api/v1`
- Method: `GET`
## III. Requests
#### 1. /label/__name__/values
Location: `/src/components/features/metrics/metricsApi/MetricsApi.component.jsx::50`
#### 2. /query?params=
Location: `/src/components/features/feedDetails/metrics/AverageResponseTimeBarChart.jsx::11`
```javascript
{
query: `
avg(avg_over_time(feeds_response_latency{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}[${
days >= 1 ? days + 'd' : hours + 'h'
}])) by (oracle_name, oracle_address)
`,
time: dateQuery.end
}
```
#### 3. /query?params=
- Location: `/src/components/features/feedDetails/head/AnswerChart.component.jsx::30`
```javascript
{
query: `
avg(feeds_latest_answer{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.networkId}|"}) by (feed_address) / ${
feed?.meta?.multiply ?? 1
}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 4. /query?params=
Location: `/src/components/features/feedDetails/metrics/AnswerChart.jsx::20`
```javascript
{
query: `
avg(feeds_latest_answer{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}) by (feed_address) / ${
feed?.meta?.multiply ?? 1
}
`
}
```
#### 5. /query_range?params=
Location: `/src/components/features/metrics/metricsApi/MetricsApi.component.jsx::20`
```javascript
{
query: `
sum(increase(feeds_new_rounds{network_id="1"}[1d])) by (feed_address, feed_name) OR sum(increase(feeds_new_transmissions{network_id="1"}[1d])) by (feed_address, feed_name)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 6. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::42`
```javascript
{
query: `
count(max_over_time(timestamp(delta(feeds_latest_answer{network_id="${network.id}"}[3m]) != 0)[1d:1m]))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 7. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::63`
```javascript
{
query: `
sum(increase(feeds_new_rounds{network_id="${network.id}"}[1d])) OR sum(increase(feeds_new_transmissions{network_id="${network.id}"}[1d]))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 8. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::86`
```javascript
{
query: `
sum(sum(increase(feeds_new_rounds{network_id="${network.id}"}[1d])) by (feed_name, feed_address) * count(feeds_response{network_id="${network.id}"}) by (feed_name, feed_address)) + sum(increase(feeds_new_rounds{network_id="${network.id}"}[1d]))
OR
sum(sum(increase(feeds_new_transmissions{network_id="${network.id}"}[1d])) by (feed_name, feed_address) * count(feeds_response{network_id="${network.id}"}) by (feed_name, feed_address)) + sum(increase(feeds_new_transmissions{network_id="${network.id}"}[1d]))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 9. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::112`
```javascript
{
query: `
feeds_response_gas_price_average{network_id="${network.id}"} / 1000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 10. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::134`
```javascript
{
query: `
sum(
sum(increase(feeds_response_count{network_id="${network.id}"}[1d])) by (oracle_name, oracle_address, feed_type) *
avg(feeds_response_gas_consumed{network_id="${network.id}"}) by (oracle_name, oracle_address, feed_type) *
(avg(feeds_response_gas_price) by (oracle_name, oracle_address, feed_type) / 10 ^ 18)
)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 11. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::156`
```javascript
{
query: `
topk(1, sum(increase(feeds_new_rounds{network_id="${network.id}"}[1d])) by (feed_name, feed_address) + sum(increase(feeds_response_count{network_id="${network.id}"}[1d])) by (feed_name, feed_address))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 12. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::187`
```javascript
{
query: `
max(increase(feeds_link_spent_total{network_id="${network.id}"}[${defaults.days}d])) / 10 ^ 18
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 13. /query_range?params=
Location: `/src/state/ducks/metric/operations.js::346`
```javascript
{
query: `
feeds_latest_answer{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}"}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (endDate.unix() - startDate.unix()) / 60,
days: endDate.diff(startDate, 'days')
}
```
#### 14. /query?params=
Location: `/src/state/ducks/metric/operations.js::194`
```javascript
{
query: `
max(feeds_latest_answer{feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa",network_id="1"}) / 10 ^ 8
`,
}
```
#### 15. /query?params=
Location: `/src/state/ducks/metric/operations.js::240`
```javascript
{
query: /* see switch example below*/,
}
```
```javascript
switch (type) {
case 'Transactions':
return `topk(10, sum(increase(feeds_new_rounds{network_id="${networkId}"}[${defaults.days}d])) by (feed_name, feed_address) + sum(increase(feeds_response_count{network_id="${networkId}"}[${defaults.days}d])) by (feed_name, feed_address))`
case 'Link Balance':
return `topk(10, max_over_time(feeds_link_balance{network_id="${networkId}"}[${defaults.days}d])) / 10 ^ 18`
case 'LINK Earned':
return `topk(10, sum(increase(feeds_link_earned{network_id="${networkId}"}[${defaults.days}d])) by (feed_address, feed_name)) / 10 ^ 18`
case 'Volatility':
return `topk(10, max(max_over_time(feeds_response_deviation{network_id="${networkId}"}[${defaults.days}d])) by (feed_name, feed_address)) `
default:
return `topk(10, max_over_time(feeds_updated_answer_count{network_id="${networkId}"}[${defaults.days}d]))`
}
```
#### 16. /query?params=
Location: `/src/state/ducks/metric/operations.js::279`
```javascript
{
query: `
bottomk(20, time() - max_over_time(timestamp(delta(feeds_new_rounds{network_id="${networkId}"}[3m]) != 0)[2h:1m]) OR
time() - max_over_time(timestamp(delta(feeds_new_transmissions{network_id="${networkId}"}[3m]) != 0)[2h:1m]))
`,
}
```
#### 17. /query?params=
Location: `/src/state/ducks/metric/operations.js::325`
```javascript
{
query: `
feeds_latest_answer{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}}
`,
}
```
#### 18. /query?params=
Location: `/src/state/ducks/metric/operations.js::332`
```javascript
{
query: `
feeds_latest_answer{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}"} offset ${offset - (offset % 60)}s
`,
}
```
#### 19. /query?params=
Location: `/src/state/ducks/metric/operations.js::361`
```javascript
{
query: `
bottomk(1, feeds_response_latency{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}} != 0 and feeds_individual_time_out == 0)
`,
}
```
#### 20. /query?params=
Location: `/src/state/ducks/metric/operations.js::371`
```javascript
{
query: `
bottomk(1, feeds_response_latency{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}"} offset ${offset - (offset % 60)}s != 0 and feeds_individual_time_out offset ${offset - (offset % 60)}s == 0)
`,
}
```
#### 21. /query?params=
Location: `/src/state/ducks/metric/operations.js::390`
```javascript
{
query: `
topk(1, increase(feeds_eth_spent{feed_type="OFFCHAIN_AGGREGATOR",feed_address=~"(?i)${queryOptions.feed_address}"}[10m]))
`,
}
```
#### 22. /query?params=
Location: `/src/state/ducks/metric/operations.js::400`
```javascript
{
query: `
topk(1, increase(feeds_eth_spent{feed_type="OFFCHAIN_AGGREGATOR",feed_address=~"(?i)${queryOptions.feed_address}"} offset ${offset - (offset % 60)}s[10m]))
`,
}
```
#### 23. /query?params=
Location: `/src/state/ducks/metric/operations.js::419`
```javascript
{
query: `
avg(feeds_response_gas_price_per_feed{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${network.id}"}) / 10 ^ 9
`,
}
```
#### 24. /query?params=
Location: `/src/state/ducks/metric/operations.js::426`
```javascript
{
query: `
avg(feeds_response_gas_price_per_feed{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${network.id}"} offset ${offset - (offset % 60)}s) / 10 ^ 9
`,
}
```
#### 25. /query?params=
Location: `/src/state/ducks/metric/operations.js::447`
```javascript
{
query: `
sum(increase(feeds_eth_spent_per_feed{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${network.id}"}[${offset + 240 - (offset % 60)}s]) / 10 ^ 18) * max(feeds_latest_answer{network_id="1", feed_id="80896ae7-2058-46cf-9384-e1efefe60f23"} / 10 ^ 8)
`,
}
```
#### 26. /query?params=
Location: `/src/state/ducks/metric/operations.js::455`
```javascript
{
query: `
sum(increase(feeds_eth_spent_per_feed{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${network.id}"} [${offset + 240 - (offset % 60)}s])) / 10 ^ 18
`,
}
```
#### 27. /query?params=
Location: `/src/state/ducks/metric/operations.js::483`
```javascript
{
query: `
(sum(increase(feeds_link_earned{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}"}[${offset + 240 - (offset % 60)}s])) / 10 ^ 18) * avg(feeds_latest_answer{network_id="1", feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa"} / 10 ^ 8)
`,
}
```
#### 28. /query?params=
Location: `/src/state/ducks/metric/operations.js::491`
```javascript
{
query: `
sum(increase(feeds_link_earned{feed_address=~"(?i)${queryOptions.feed_address}", network_id="${networkId}"}[${offset + 240 - (offset % 60)}s])) / 10 ^ 18
`,
}
```
#### 29. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/RevenueChart.jsx::42`
Note: I've included the business logic for how start, end and step are calculated, but for the purpose of migration, you could likely use any unix timestamp for start/end and any number (such as 3600) for step/hours, and any number for days (such as 7)
```javascript
{
query: `
(sum(increase(feeds_link_earned{oracle_name="${
node.name
}", network_id="${node.network.id}"}[${
perDay ? '1d' : '1h'
}])) / 10 ^ 18) * (min(feeds_latest_answer{feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa",network_id="1"}) / 10 ^ 8)
`,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours')
start: perDay ? dateQuery.start + 86400 : dateQuery.start,
end:
perDay && moment().unix() - dateQuery.end > 43200
? dateQuery.end + 86400
: dateQuery.end,
step: perDay ? 86400 * Math.ceil(dateQuery.days / 60) : 3600,
}
```
#### 30. /query_range?params=
Location: `/src/components/common/models/node/Metrics.component.jsx::46`
Note: the second object below (containing cancelToken) represents "options" which is passed in the GET request OPTIONS (not as a query parameter)
```javascript
{
query: `
avg(feeds_response_latency{oracle_address=~"(?i)${node.oracleAddress}", network_id="${node.network.id}"} != 0) by (oracle_address, oracle_name)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
},
{
cancelToken: signal.current.token
}
```
#### 31. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/AnswerChart.jsx::31`
```javascript
{
query: `
avg(feeds_latest_answer{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}) by (feed_address) / ${
feed?.meta?.multiply ?? 1
}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 32. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/DeviationChart.jsx::26`
Variables
```typescript
type aggregator = 'avg' | 'min' | 'max'
```
```javascript
{
query: `
${aggregator}(feeds_response_deviation{feed_address=~"(?i)${feed.contractAddress}", network_id=~"${feed.network.id}|"}) by (feed_address)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 33. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/ExpenseChart.jsx::44`
```javascript
{
query: `
sum(increase(feeds_eth_spent_per_feed{feed_address=~"(?i)${
feed.contractAddress
}", network_id="${feed.network.id}"}[${perDay ? '1d' : '1h'}])) / 10 ^ 18
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 34. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/ExpenseChart.jsx::48`
```javascript
{
query: `
min(feeds_latest_answer{feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa",network_id="1"}) / 100000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 35. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/IndividualAnswerChart.jsx::24`
```javascript
{
query: `
avg(feeds_response{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${
feed.network.id
}|"}) by (oracle_name, oracle_address) / ${feed?.meta?.multiply ?? 1}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 36. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/LINKEarnedChart.jsx::61`
```javascript
{
query: `
sum(increase(feeds_link_earned{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}[${
perDay ? '1d' : '1h'
}])) by (feed_address) / 1000000000000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 37. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/LINKEarnedChart.jsx::65`
```javascript
{
query: `
sum(increase(feeds_new_rounds{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}[${
perDay ? '1d' : '1h'
}])) by (feed_address)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 38. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/LINKEarnedChart.jsx::65`
```javascript
{
query: `
sum(increase(feeds_new_transmissions{feed_address=~"(?i)${
feed.contractAddress
}", network_id=~"${feed.network.id}|"}[${
perDay ? '1d' : '1h'
}])) by (feed_address)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 39. /query_range?params=
Location: `/src/components/features/feedDetails/metrics/RevenueChart.jsx::32`
```javascript
{
query: `
(sum(increase(feeds_link_earned{feed_address=~"(?i)${
feed.contractAddress
}", network_id="${feed.network.id}"}[${
perDay ? '1d' : '1h'
}])) / 10 ^ 18) * (min(feeds_latest_answer{feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa", network_id="1"}) / 10 ^ 8)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 40. /query_range?params=
Location: `/src/components/features/home/feedMetrics/MetricCard.component.jsx::32`
```javascript
{
query: `
sum(increase(feeds_new_rounds{network_id="${network.id}"}[1d]))
OR
sum(increase(feeds_new_transmissions{network_id="${network.id}"}[1d]))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
}
```
#### 41. /query_range?params=
Location: `/src/components/features/home/feedMetrics/MetricCard.component.jsx::32`
```javascript
{
query: `
avg(
(feeds_latest_answer{network_id="${network.id}"} / feeds_latest_answer{network_id="${network.id}"} offset 24h - 1 > 0 and feeds_latest_answer{network_id="${network.id}"} / feeds_latest_answer{network_id="${network.id}"} offset 24h - 1 < +Inf) or
((feeds_latest_answer{network_id="${network.id}"} / feeds_latest_answer{network_id="${network.id}"} offset 24h - 1 < 0 and feeds_latest_answer{network_id="${network.id}"} / feeds_latest_answer{network_id="${network.id}"} offset 24h - 1 > -Inf) * -1)
) * 100
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
}
```
#### 42. /query_range?params=
Location: `/src/components/features/home/feedMetrics/MetricCard.component.jsx::32`
```javascript
{
query: `
feeds_response_gas_price_average{network_id="${network.id}"} / 1000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
}
```
#### 43. /query_range?params=
Location: `/src/components/features/home/feedMetrics/NetworkOverviewChart.component.jsx::15`
```javascript
{
query: `
sum(increase(feeds_link_earned{network_id="${networkId}"}[1d])) / 1000000000000000000
`,
start: moment().subtract(15, 'days').unix(),
end: moment().unix(),
step: 86400,
days: 7
}
```
#### 44. /query_range?params=
Location: `/src/components/features/home/feedMetrics/NetworkOverviewChart.component.jsx::27`
```javascript
{
query: `
sum(increase(feeds_response_count{network_id="${networkId}"}[1d]))
`,
start: moment().subtract(15, 'days').unix(),
end: moment().unix(),
step: 86400,
days: 7
}
```
#### 45. /query_range?params=
Location: `/src/components/features/metrics/metricsApi/MetricsApi.component.jsx::80`
```javascript
{
query: `
sum(increase(feeds_new_rounds{network_id="1"}[1d])) by (feed_address, feed_name) OR sum(increase(feeds_new_transmissions{network_id="1"}[1d])) by (feed_address, feed_name)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 46. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/DeviationChart.jsx::41`
```javascript
{
query: `
feeds_response_deviation_average{network_id="${networkId}"}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 47. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/DeviationChart.jsx::49`
```javascript
{
query: `
avg(feeds_response_deviation{oracle_address=~"(?i)${node.oracleAddress}", network_id="${networkId}"}) by (oracle_address, oracle_name)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 48. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/ExpenseChart.jsx::64`
```javascript
{
query: `
sum(increase(feeds_eth_spent{network_id="${
node.network.id
}",oracle_name="${node.name}"}[${
perDay ? '1d' : '1h'
}])) by (oracle_name, oracle_address) / 10 ^ 18
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
```
#### 49. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/ExpenseChart.jsx::74`
```javascript
{
query: `
min(feeds_latest_answer{feed_id="bdec936d-7bd3-4ce6-8b20-d9dfb18ea1aa"}) / 100000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
```
#### 50. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/GasPriceChart.jsx::32`
```javascript
{
query: `
avg(feeds_response_gas_price{oracle_address=~"(?i)${node.oracleAddress}", network_id="${networkId}"}) by (oracle_address, oracle_name) / 1000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 51. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/GasPriceChart.jsx::41`
```javascript
{
query: `
feeds_response_gas_price_average{network_id="${networkId}"} / 1000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 52. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/LINKEarnedChart.jsx::95`
```javascript
{
query: `
sum(increase(feeds_link_earned{oracle_address=~"(?i)${
node.oracleAddress
}", network_id="${node.network.id}"}[${
perDay ? '1d' : '1h'
}])) by (feed_address) / 1000000000000000000
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 53. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/RateOfFeedResponsesChart.jsx::35`
```javascript
{
query: `
sum(increase(feeds_response_count{oracle_name="${
node.name
}", network_id="${node.network.id}"}[${perDay ? '1d' : '1h'}]))
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 54. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/ResponseLatencyChart.jsx::32`
```javascript
{
query: `
avg(feeds_response_latency{oracle_address=~"(?i)${node.oracleAddress}", network_id="${networkId}"} != 0) by (oracle_address, oracle_name)
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 55. /query_range?params=
Location: `/src/components/features/nodeDetails/metrics/ResponseLatencyChart.jsx::41`
```javascript
{
query: `
feeds_response_latency_average{network_id="${networkId}"}
`,
start: startDate.unix(),
end: endDate.unix(),
step: (end - start) / steps,
days: endDate.diff(startDate, 'days'),
hours: endDate.diff(startDate, 'hours'),
}
```
#### 56. /
Location: `/src/components/features/metrics/metricsApi/MetricsApi.component.jsx::93`
Note: This example is a little different in that we are building the full URL string dynamically as opposed to relying on something like axios to do this for us with an object. We need to rewrite the following URL to be in the expected format of Loki.
```javascript
const query = 'sum(increase(feeds_new_rounds{network_id="1"}[1d])) by (feed_address, feed_name) OR sum(increase(feeds_new_transmissions{network_id="1"}[1d])) by (feed_address, feed_name)'
const formattedQuery = encodeURIComponent(query)
const url = `${window.location.origin}/v1/metrics/api/v1/query_range?query=${formattedQuery}&start=${dateQuery.start}&end=${dateQuery.end}&step=${dateQuery.step}&days=${dateQuery.days}`
```
#### 57. /
Location: `/src/components/features/metrics/metricsApi/MetricsApi.component.jsx::95`
Note: This example is a little different in that we are building the full URL string dynamically as opposed to relying on something like axios to do this for us with an object. We need to rewrite the following URL to be in the expected format of Loki.
```javascript
const query = 'sum(increase(feeds_new_rounds{network_id="1"}[1d])) by (feed_address, feed_name) OR sum(increase(feeds_new_transmissions{network_id="1"}[1d])) by (feed_address, feed_name)'
const formattedQuery = encodeURIComponent(query)
const curl = `curl -X GET -G "${window.location.origin}/v1/metrics/api/v1/query_range" -d
'query=${formattedQuery}' -d start=${dateQuery.start} -d
end=${dateQuery.end} -d step=${dateQuery.step} | jq`
```