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

Add example for metrics and dashboard #2232

Merged
merged 5 commits into from
Jun 16, 2023
Merged

Add example for metrics and dashboard #2232

merged 5 commits into from
Jun 16, 2023

Conversation

MarcoPolo
Copy link
Collaborator

This came up after a call with @Giulio2002 when I discussed they could set up these dashboards for some more observability and to help debug #2202 .

Note for reviewer: Could you please try this and make sure it works for you as well (follow instructions in README.md)

docker compose up
```

Go to http://localhost:3000/dashboards to see the dashboards.
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at EOF

RUN go mod init example.com/m/v2
RUN go mod tidy
RUN go build main.go
ENTRYPOINT [ "/app/main" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at EOF

# Grafana doesn't let us do this in provisioning, so we do it ourselves.
RUN sed -i 's/${DS_PROMETHEUS}/prometheusuid/g' /etc/grafana/dashboards/*/*.json
RUN cat /etc/grafana/dashboards/swarm/swarm.json
USER grafana
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at EOF

Copy link
Member

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉
I've added minor comments. Feel free to ignore them if you think they're not relevant

Comment on lines +44 to +47
// Make a bunch of clients that all ping the server at various times
wg := sync.WaitGroup{}
Copy link
Member

Choose a reason for hiding this comment

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

can we make the server ping some clients too?
I understand that is inconsistent with the "server" term but in this example the dashboard is mostly empty.
libp2p-swarm

Copy link
Member

Choose a reason for hiding this comment

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

*server initiate a connection with some clients.

wg.Add(1)
go func(i int) {
defer wg.Done()
time.Sleep(time.Duration(i%100) * 100 * time.Millisecond)
Copy link
Member

Choose a reason for hiding this comment

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

should we make this slightly longer? this example is complete by the time I open the grafana window.

Copy link
Member

Choose a reason for hiding this comment

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

the prometheus scrape interval is 1m

type: prometheus
# Access mode - proxy (server in the UI) or direct (browser in the UI).
access: proxy
uid: "prometheusuid"
Copy link
Member

Choose a reason for hiding this comment

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

this is neat! 👍

examples/metrics-and-dashboards/compose.yml Show resolved Hide resolved
@MarcoPolo
Copy link
Collaborator Author

Deferring this work until after ipfs thing

@p-shahi p-shahi mentioned this pull request May 2, 2023
16 tasks
@marten-seemann marten-seemann mentioned this pull request Jun 1, 2023
27 tasks
@marten-seemann
Copy link
Contributor

@MarcoPolo What's the status of this PR? It would be nice to get this merged before the next release.

@marten-seemann marten-seemann mentioned this pull request Jun 3, 2023
29 tasks
@marten-seemann
Copy link
Contributor

@MarcoPolo Friendly ping. Can we push this PR across the finish line?

@MarcoPolo MarcoPolo force-pushed the marco/metrics-example branch from 10809a7 to f6d36b4 Compare June 16, 2023 00:40
@MarcoPolo
Copy link
Collaborator Author

Pushed changes, this is good to merge after CI passes.

@p-shahi p-shahi merged commit 22c45a1 into master Jun 16, 2023
@p-shahi p-shahi deleted the marco/metrics-example branch June 16, 2023 02:44
@p-shahi
Copy link
Member

p-shahi commented Jun 16, 2023

Pushed changes, this is good to merge after CI passes.

merged based on this message, mainly in service of libp2p/blog#77

MarcoPolo added a commit that referenced this pull request Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants