-
Notifications
You must be signed in to change notification settings - Fork 336
fix(price-pusher): provision Loki + Promtail in sample monitoring stack #3692
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,20 @@ | ||
| apiVersion: 1 | ||
|
|
||
| datasources: | ||
| # Both UIDs below are referenced from grafana-dashboard.sample.json (the | ||
| # Prometheus UID by every metric panel, the Loki UID by Tx Hash / All Logs | ||
| # / Error Logs and the `chain` template variable). Without explicit UIDs | ||
| # Grafana auto-generates per-provision random values and the dashboard's | ||
| # hardcoded references fail to resolve. Keep them in sync if the dashboard | ||
| # is regenerated. | ||
| - name: Prometheus | ||
| type: prometheus | ||
| access: proxy | ||
| url: http://prometheus:9090 | ||
| uid: edryyydtht14wa | ||
| isDefault: true | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| - name: Loki | ||
| type: loki | ||
| access: proxy | ||
| url: http://loki:3100 | ||
| uid: ads9ouz3jh4hsa | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 Dashboard log queries use The pre-existing Was this helpful? React with 👍 or 👎 to provide feedback. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Sample Promtail config that ships Docker container logs to the local Loki | ||
| # instance defined in docker-compose.metrics.sample.yaml. It tags every line | ||
| # with `namespace=<container_name>` so the `chain` template variable in | ||
| # grafana-dashboard.sample.json (which filters `{namespace=~"$chain"}`) picks | ||
| # up one entry per pusher container you run alongside this stack. | ||
| # | ||
| # Run one pusher container per chain (e.g. `price-pusher-evm`, | ||
| # `price-pusher-sui`) and the dashboard's chain selector will list them. | ||
|
|
||
| server: | ||
| http_listen_port: 9080 | ||
| grpc_listen_port: 0 | ||
|
|
||
| positions: | ||
| filename: /tmp/positions.yaml | ||
|
|
||
| clients: | ||
| - url: http://loki:3100/loki/api/v1/push | ||
|
|
||
| scrape_configs: | ||
| - job_name: docker | ||
| docker_sd_configs: | ||
| - host: unix:///var/run/docker.sock | ||
| refresh_interval: 5s | ||
| relabel_configs: | ||
| # Use the container name (without the leading slash Docker prepends) as | ||
| # the `namespace` label that the Grafana dashboard filters on. | ||
| - source_labels: ["__meta_docker_container_name"] | ||
| regex: "/(.*)" | ||
| target_label: namespace | ||
| - source_labels: ["__meta_docker_container_id"] | ||
| target_label: container_id | ||
| pipeline_stages: | ||
| # Surface pino's standard `level` field so the Error Logs panel | ||
| # (`detected_level = error`) can detect log levels emitted as JSON. | ||
| # Pino emits numeric severities by default (10=trace, 20=debug, | ||
| # 30=info, 40=warn, 50=error, 60=fatal) and Loki's detected_level | ||
| # only recognises the string forms, so translate before labelling. | ||
| - json: | ||
| expressions: | ||
| level: level | ||
| msg: msg | ||
| - template: | ||
| source: level | ||
| template: '{{ if eq .Value "10" }}trace{{ else if eq .Value "20" }}debug{{ else if eq .Value "30" }}info{{ else if eq .Value "40" }}warn{{ else if eq .Value "50" }}error{{ else if eq .Value "60" }}fatal{{ else }}{{ .Value }}{{ end }}' | ||
| - labels: | ||
| level: | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 Prometheus metrics lack
namespacelabel but dashboard queries filter on itThe Grafana dashboard (pre-existing, not changed in this PR) filters all Prometheus queries with
namespace="$chain", e.g.pyth_price_feeds_total{namespace="$chain"}. However, the price pusher's metrics code (src/metrics.ts:35-89) does not include anamespacelabel on any metric, andprometheus.sample.ymldoesn't add one via relabeling. This means in the sample docker-compose setup, Prometheus metric panels will show no data when a specific chain is selected. This is a pre-existing issue — likely the dashboard was designed for a Kubernetes environment where Prometheus addsnamespacelabels from service discovery. Thechaintemplate variable is now sourced from Loki'snamespacelabel (container names), which further highlights the disconnect. Users following the sample setup should be aware that metric panels may not populate without adding a matchingnamespacelabel to their Prometheus scrape config.Was this helpful? React with 👍 or 👎 to provide feedback.