Skip to content

Commit

Permalink
add examples (#2)
Browse files Browse the repository at this point in the history
* add examples

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* docs: readme

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* docs: readme

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: quit

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* docs: godoc

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 authored Dec 8, 2021
1 parent 4a0258f commit 79d997f
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

Package promwish provides a simple [wish](http://github.com/charmbracelet/wish) middleware exposing some Prometheus metrics.

## Example Usage

You can add `promwish` as a middleware to your app:

```go
promwish.Middleware("localhost:9222", "my-app"),
```

This will create the metrics and start a HTTP server on `localhost:9222` to expose the metrics.

You can also use `promwish.MiddlewareRegistry` and `promwish.Listen` if you need more options.

Check the [_examples folder](/_examples) for a full working example.

## Example Dashboard

<img width="2120" alt="image" src="https://user-images.githubusercontent.com/245435/145126273-2dc9cb98-7886-40b5-b173-229c50746fba.png">
41 changes: 41 additions & 0 deletions _examples/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module example

go 1.17

replace github.com/charmbracelet/promwish => ../

require (
github.com/charmbracelet/bubbletea v0.19.0
github.com/charmbracelet/promwish v0.0.0-00010101000000-000000000000
github.com/charmbracelet/wish v0.1.1
github.com/gliderlabs/ssh v0.3.3
)

require (
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/charmbracelet/keygen v0.1.2 // indirect
github.com/charmbracelet/lipgloss v0.4.0 // indirect
github.com/containerd/console v1.0.2 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.14-0.20210829144114-504425e14f74 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.9.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/term v0.0.0-20210422114643-f5beecf764ed // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
)
Loading

0 comments on commit 79d997f

Please sign in to comment.