Skip to content

Commit

Permalink
fix(long_tail_assets): Readable config
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha committed Jul 25, 2024
1 parent 718829f commit 07550bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
with:
context: .
file: Dockerfile
platforms: ${{ format('linux/{0}', matrix.platform) }}
platforms: ${{ format('linux/{0}', matrix.platform) }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-${{ matrix.platform }},mode=max
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:cache-${{ matrix.platform }},mode=max
Expand Down
21 changes: 9 additions & 12 deletions prometheus/alerts.rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ groups:
summary: "Price deviation is too high"
description: "The median on-chain price of {{ $labels.pair }} has deviated for more than 2.5% with the reference price from DefiLlama."

- alert: LongTailAssetCriticalDeviation
- alert: LongTailAssetSourcesDeviation
expr: |
(
long_tail_asset_deviating_sources >= 2
Expand All @@ -81,18 +81,15 @@ groups:
labels:
severity: critical
annotations:
summary: "Long tail asset critical deviation detected"
summary: "Long tail asset sources deviation is too high"
description: |
{{ $deviating := printf "%.0f" $value }}
{{ $total := printf "%.0f" (long_tail_asset_total_sources) }}
{{ $threshold := printf "%.2f" (
(long_tail_asset_total_sources <= 6)
* 100 * last_over_time(long_tail_asset_threshold{type="low"}[1h])
or
(long_tail_asset_total_sources > 6)
* 100 * last_over_time(long_tail_asset_threshold{type="high"}[1h])
) }}
{{ $deviating }} out of {{ $total }} sources for {{ $labels.pair }} have deviated from the onchain price beyond {{ $threshold }}%.
{{ $deviating := long_tail_asset_deviating_sources }}
{{ $total := long_tail_asset_total_sources }}
{{ $threshold := long_tail_asset_threshold{type="low"} }}
{{ if gt $total 6.0 }}
{{ $threshold = long_tail_asset_threshold{type="high"} }}
{{ end }}
{{ printf "%.0f" $deviating }} out of {{ printf "%.0f" $total }} sources for {{ $labels.pair }} have deviated from the onchain price beyond {{ printf "%.2f" (100 * $threshold) }}%.
- name: API
rules:
Expand Down

0 comments on commit 07550bc

Please sign in to comment.