Skip to content
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

Merged
merged 15 commits into from
Feb 24, 2022
Merged

monitoring dashboard #876

merged 15 commits into from
Feb 24, 2022

Conversation

shiqizng
Copy link
Contributor

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.

@shiqizng shiqizng changed the title Shiqi/perf monitoring dashboard Feb 11, 2022
@shiqizng shiqizng self-assigned this Feb 11, 2022
@shiqizng shiqizng linked an issue Feb 11, 2022 that may be closed by this pull request
3 tasks
blockbytes, err = aclient.BlockRaw(bot.nextRound).Do(ctx)

dt := time.Since(start)
metrics.AlgodRawBlockTimeSeconds.Observe(dt.Seconds())
Copy link
Contributor

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

Copy link
Contributor

@winder winder left a 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.

monitoring/.env Outdated Show resolved Hide resolved
monitoring/grafana_prometheus_datasource.yml Show resolved Hide resolved
@@ -0,0 +1,57 @@
## Indexer Monitoring Dashboard
Copy link
Contributor

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.

Comment on lines 28 to 30
- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't working for me. After importing the dashboard everything is blank:
image

In the panels there is an error:
image

Copy link
Contributor

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.

Comment on lines 1 to 31
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}"]
Copy link
Contributor

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}"]

dockerfile: "./monitoring/Dockerfile-indexer"
environment:
PORT: 8888
CONNECTION_STRING: ${DB_CONNECTION}
Copy link
Contributor

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:

Suggested change
CONNECTION_STRING: ${DB_CONNECTION}
CONNECTION_STRING: "${DB_CONNECTION:-host=indexer-db port=5432 user=algorand password=algorand dbname=indexer_db sslmode=disable}"```

- "host.docker.internal:host-gateway"

grafana:
image: "grafana/grafana"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image: "grafana/grafana"
image: "grafana/grafana:8.4.2"

Copy link
Contributor

@winder winder left a 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.

@shiqizng shiqizng merged commit df2779c into develop Feb 24, 2022
@shiqizng shiqizng deleted the shiqi/perf branch February 24, 2022 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

monitoring dashboard
3 participants