-
Notifications
You must be signed in to change notification settings - Fork 90
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
monitoring dashboard #876
monitoring dashboard #876
Conversation
fetcher/fetcher.go
Outdated
blockbytes, err = aclient.BlockRaw(bot.nextRound).Do(ctx) | ||
|
||
dt := time.Since(start) | ||
metrics.AlgodRawBlockTimeSeconds.Observe(dt.Seconds()) |
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.
Could this metric be named GetAlgodRawBlockTimeSeconds
instead? That might be easier to understand when building queries in grafana
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.
I think the documentation would be most useful if it focuses on how to install the dashboard on an existing prometheus/grafana deployment.
The metrics changes look good, but I wasn't able to get the dashboard demo running. I left some comments on what I tried and what wasn't working.
@@ -0,0 +1,57 @@ | |||
## Indexer Monitoring Dashboard |
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.
We need to update these instructions to make it clear that they are for starting a demo. The top-level README should also get some additional instructions for installing the dashboard on an existing prometheus/grafana instance.
To that end, I think you can leave out details about how the docker-compose file can be updated to connect to a different indexer.
monitoring/README.md
Outdated
- In grafana configurations, add a PostgreSQL datasource. See example below. | ||
- Go to Import and upload dashboard.json | ||
- Run `create extension pg_stat_statements;` sql on db to enable query stats from Postgres |
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.
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.
I was able to import on deployment outside of docker, but the postgres portion didn't seem to work. The query ran fine in pqsl but didn't show up in grafana.
monitoring/Dockerfile-indexer
Outdated
FROM alpine:latest | ||
|
||
RUN apk add --no-cache git make musl-dev go bash libtool autoconf automake build-base libsodium-dev boost-dev | ||
|
||
# Configure Go | ||
ENV GOROOT /usr/lib/go | ||
ENV GOPATH /go | ||
ENV PATH /go/bin:$PATH | ||
|
||
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin | ||
|
||
# Build and run indexer | ||
RUN mkdir /work | ||
WORKDIR /work | ||
ADD . ./ | ||
RUN make | ||
WORKDIR /work/cmd/algorand-indexer | ||
ENV CGO_ENABLED="1" | ||
RUN go build | ||
|
||
# The sleep is to wait until postgres starts | ||
CMD ["/bin/sh", "-c", "\ | ||
echo $ALGOD_NET && \ | ||
echo $CONNECTION_STRING &&\ | ||
sleep 5 && \ | ||
./algorand-indexer daemon \ | ||
--server \":${PORT}\" \ | ||
-P \"${CONNECTION_STRING}\" \ | ||
--metrics-mode VERBOSE \ | ||
--algod-net \"${ALGOD_NET}\" \ | ||
--algod-token ${ALGOD_TOKEN}"] |
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.
I wasn't able to get alpine working, @bricerisingalgorand suggested there is an issue with musl and I should try ubuntu. This configuration started:
ARG GO_VERSION=1.17.5
FROM golang:$GO_VERSION
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y apt-utils curl git git-core bsdmainutils python3
# Build go-algorand
RUN mkdir /work
WORKDIR /work
ADD . ./
WORKDIR /work/third_party/go-algorand
RUN ./scripts/configure_dev.sh
RUN make
# Build indexer
WORKDIR /work
RUN make
WORKDIR /work/cmd/algorand-indexer
ENV CGO_ENABLED="1"
RUN go build
# The sleep is to wait until postgres starts
CMD ["/bin/sh", "-c", "\
echo $ALGOD_NET && \
echo $CONNECTION_STRING &&\
sleep 5 && \
./algorand-indexer daemon \
--server \":${PORT}\" \
-P \"${CONNECTION_STRING}\" \
--metrics-mode VERBOSE \
--algod-net \"${ALGOD_NET}\" \
--algod-token ${ALGOD_TOKEN}"]
monitoring/docker-compose.yml
Outdated
dockerfile: "./monitoring/Dockerfile-indexer" | ||
environment: | ||
PORT: 8888 | ||
CONNECTION_STRING: ${DB_CONNECTION} |
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.
Not sure we need the .env
file for the default, because the DB credentials are defined in this file:
CONNECTION_STRING: ${DB_CONNECTION} | |
CONNECTION_STRING: "${DB_CONNECTION:-host=indexer-db port=5432 user=algorand password=algorand dbname=indexer_db sslmode=disable}"``` |
monitoring/docker-compose.yml
Outdated
- "host.docker.internal:host-gateway" | ||
|
||
grafana: | ||
image: "grafana/grafana" |
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.
image: "grafana/grafana" | |
image: "grafana/grafana:8.4.2" |
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.
One small suggestion that I needed for starting the test dashboard. Otherwise, I think we can merge this in.
Summary
This PR adds a feature allowing user to start a monitoring dashboard for an indexer.
Test Plan
Test the feature locally. Validate that dashboard is getting data and working as expected.