Completed
Push — master ( 43fa80...2d35ab )
by Viktor
02:15
created

bot/metrics.go   A

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 15
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bot.*Context.MetricsCommand 0 5 1
A bot.*Context.MetricsLog 0 5 1
1
package bot
2
3
import (
4
	"bytes"
5
	"fmt"
6
	"net/http"
7
)
8
9
func (ctx *Context) MetricsCommand(command string) {
0 ignored issues
show
introduced by
exported method Context.MetricsCommand should have comment or be unexported
Loading history...
10
	query := []byte(fmt.Sprintf("commands,server=%v,user=%v command=\"%v\"", ctx.Guild.ID, ctx.Message.Author.ID, command))
11
	addr := fmt.Sprintf("%v/write?db=%v", ctx.Conf.Metrics.Address, ctx.Conf.Metrics.Database)
12
	r := bytes.NewReader(query)
13
	_, _ = http.Post(addr, "", r)
14
}
15
16
func (ctx *Context) MetricsLog(module string) {
0 ignored issues
show
introduced by
exported method Context.MetricsLog should have comment or be unexported
Loading history...
17
	query := []byte(fmt.Sprintf("logs,server=%v module=\"%v\"", ctx.Guild.ID, module))
18
	addr := fmt.Sprintf("%v/write?db=%v", ctx.Conf.Metrics.Address, ctx.Conf.Metrics.Database)
19
	r := bytes.NewReader(query)
20
	_, _ = http.Post(addr, "", r)
21
}
22