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

WIP: Update mqtt library and add prometheus client metrics #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/inovex/mqtt-stresser
go 1.12

require (
github.com/eclipse/paho.mqtt.golang v1.2.0
golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 // indirect
github.com/eclipse/paho.mqtt.golang v1.3.1
github.com/prometheus/client_golang v1.9.0
golang.org/x/text v0.3.2 // indirect
)
400 changes: 400 additions & 0 deletions go.sum

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"context"
"flag"
"fmt"
"github.com/prometheus/client_golang/prometheus/promhttp"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
"os/signal"
"runtime"
Expand Down Expand Up @@ -126,6 +128,14 @@ func loadTLSFile(fileName string) ([]byte, error) {
func main() {
flag.Parse()

go func() {
http.Handle("/metrics", promhttp.Handler())
err := http.ListenAndServe(":2112", nil)
if err != nil {
fmt.Printf("Failed to init prometheus metrics port: %v\n", err)
}
}()

if flag.NFlag() < 1 || *argHelp {
flag.Usage()
if *argHelp {
Expand Down
20 changes: 20 additions & 0 deletions vendor/github.com/beorn7/perks/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading