Skip to content

Commit 2a7ecc4

Browse files
committedNov 27, 2015
cleanup
1 parent a059ca7 commit 2a7ecc4

File tree

3 files changed

+1
-113
lines changed

3 files changed

+1
-113
lines changed
 

‎docker-compose-influx.yml

-51
This file was deleted.

‎genproxy.go

-57
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
package main
22

33
import (
4-
"github.com/Abramovic/logrus_influxdb"
54
log "github.com/Sirupsen/logrus"
65
"github.com/codegangsta/negroni"
76
"github.com/elazarl/goproxy"
8-
_ "github.com/influxdb/influxdb/client/v2"
97
"github.com/meatballhat/negroni-logrus"
108

11-
"errors"
129
"flag"
1310
"fmt"
1411
"net/http"
1512
"os"
1613
"regexp"
17-
"time"
1814
)
1915

2016
const DefaultPort = ":8500"
@@ -29,15 +25,6 @@ func main() {
2925
// getting settings
3026
initSettings()
3127

32-
// adding influxdb hook
33-
err := addInfluxLoggingHook()
34-
35-
if err != nil {
36-
log.WithFields(log.Fields{
37-
"Error": err.Error(),
38-
}).Error("Failed to add InfluxDB hook")
39-
}
40-
4128
// overriding default settings
4229
AppConfig.recordState = *record
4330

@@ -145,47 +132,3 @@ func (d *DBClient) startAdminInterface() {
145132

146133
n.Run(AppConfig.adminInterface)
147134
}
148-
149-
func addInfluxLoggingHook() error {
150-
// checking whether app should send logs to influxdb
151-
influxdbAddress := os.Getenv("InfluxAddress")
152-
153-
if influxdbAddress != "" {
154-
155-
// getting default events database
156-
influxDatabaseName := os.Getenv("InfluxDBName")
157-
if influxDatabaseName == "" {
158-
influxDatabaseName = "events"
159-
}
160-
161-
var maxRetries = 10
162-
var errMaxRetriesReached = errors.New("exceeded retry limit")
163-
var err error
164-
165-
attempt := 1
166-
for {
167-
hook, err := logrus_influxdb.NewInfluxDBHook(influxdbAddress, influxDatabaseName, nil)
168-
log.Info("Hook created, next step - adding to logrus")
169-
if err == nil {
170-
log.AddHook(hook)
171-
log.Info("Hook to InfluxDB added successfuly")
172-
break
173-
}
174-
attempt++
175-
log.Warn("Failed to connect to InfluxDB, maybe it is not running yet? Waiting...")
176-
time.Sleep(5 * time.Second)
177-
if attempt > maxRetries {
178-
log.WithFields(log.Fields{
179-
"Error": err.Error(),
180-
"InfluxDB": influxdbAddress,
181-
"InfluxDatabaseName": influxDatabaseName,
182-
}).Error("Unable to add InfluxDB hook")
183-
return errMaxRetriesReached
184-
}
185-
}
186-
return err
187-
188-
} else {
189-
return nil
190-
}
191-
}

‎glide.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ import:
77
- package: github.com/elazarl/goproxy
88
- package: github.com/meatballhat/negroni-logrus
99
- package: github.com/codegangsta/negroni
10-
- package: github.com/go-zoo/bone
11-
- package: github.com/influxdb/influxdb
12-
subpackages:
13-
- /client/v2
14-
- package: github.com/Abramovic/logrus_influxdb
10+
- package: github.com/go-zoo/bone

0 commit comments

Comments
 (0)
Please sign in to comment.