Skip to content

Commit f80d2cb

Browse files
committed
feature/SCFF-24 deleted code related to firehose-to-syslog imports
1 parent 3f8ce55 commit f80d2cb

3 files changed

Lines changed: 5 additions & 32 deletions

File tree

caching/caching_boltdb.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ package caching
33
import (
44
"fmt"
55

6-
"github.com/boltdb/bolt"
7-
//"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/logging"
86
"log"
97
"os"
108
"time"
119

12-
"github.com/cloudfoundry-community/firehose-to-syslog1/logging"
10+
"github.com/boltdb/bolt"
1311
cfClient "github.com/cloudfoundry-community/go-cfclient"
1412
json "github.com/mailru/easyjson"
1513
)
@@ -107,12 +105,11 @@ func (c *CachingBolt) GetAppByGuid(appGuid string) []App {
107105

108106
func (c *CachingBolt) GetAllApp() []App {
109107

110-
logging.LogStd("Retrieving Apps for Cache...", false)
111108
var apps []App
112109

113110
defer func() {
114111
if r := recover(); r != nil {
115-
logging.LogError("Recovered in caching.GetAllApp()", r)
112+
//logging.LogError("Recovered in caching.GetAllApp()", r)
116113
}
117114
}()
118115

@@ -122,7 +119,7 @@ func (c *CachingBolt) GetAllApp() []App {
122119
}
123120

124121
for _, app := range cfApps {
125-
logging.LogStd(fmt.Sprintf("App [%s] Found...", app.Name), false)
122+
fmt.Printf("App [%s] Found... \n", app.Name)
126123
apps = append(apps, App{
127124
app.Name,
128125
app.Guid,
@@ -135,7 +132,7 @@ func (c *CachingBolt) GetAllApp() []App {
135132
}
136133

137134
c.fillDatabase(apps)
138-
logging.LogStd(fmt.Sprintf("Found [%d] Apps!", len(apps)), false)
135+
fmt.Printf("Found [%d] Apps!", len(apps))
139136

140137
return apps
141138
}
@@ -145,7 +142,6 @@ func (c *CachingBolt) GetAppInfo(appGuid string) App {
145142
var d []byte
146143
var app App
147144
c.Appdb.View(func(tx *bolt.Tx) error {
148-
logging.LogStd(fmt.Sprintf("Looking for App %s in Cache!\n", appGuid), false)
149145
b := tx.Bucket([]byte("AppBucket"))
150146
d = b.Get([]byte(appGuid))
151147
return nil

eventRouting/eventRouting_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ var _ = Describe("Events", func() {
6060
})
6161
})
6262

63-
Context("called with extrafield", func() {
64-
It("Shoud return correct extrafields", func() {
65-
eventRouting.SetExtraFields("dev:env")
66-
Expect(eventRouting.ExtraFields).To(Equal(map[string]string{"dev": "env"}))
67-
})
68-
})
69-
7063
Context("GetListAuthorizedEventEvents", func() {
7164
It("should return right list of authorized events", func() {
7265
Expect(GetListAuthorizedEventEvents()).To(Equal("ContainerMetric, CounterEvent, Error, HttpStart, HttpStartStop, HttpStop, LogMessage, ValueMetric"))

eventRouting/eventrouting.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package eventRouting
22

33
import (
44
"fmt"
5-
"os"
65
"sort"
76
"strings"
87
"sync"
@@ -12,8 +11,6 @@ import (
1211
fevents "bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/events"
1312
"bitbucket.org/mcplusa-ondemand/firehouse-to-sumologic/sumoCFFirehose"
1413
"github.com/Sirupsen/logrus"
15-
"github.com/cloudfoundry-community/firehose-to-syslog1/extrafields"
16-
"github.com/cloudfoundry-community/firehose-to-syslog1/logging"
1714
"github.com/cloudfoundry/sonde-go/events"
1815
)
1916

@@ -24,7 +21,6 @@ type EventRouting struct {
2421
mutex *sync.Mutex
2522
sLAppender sumoCFFirehose.SumoCFFirehose //**
2623
//*log logging.Logging
27-
ExtraFields map[string]string
2824
}
2925

3026
func NewEventRouting(caching caching.Caching, sLAppender sumoCFFirehose.SumoCFFirehose) *EventRouting {
@@ -34,8 +30,7 @@ func NewEventRouting(caching caching.Caching, sLAppender sumoCFFirehose.SumoCFFi
3430
selectedEventsCount: make(map[string]uint64),
3531
sLAppender: sLAppender, //**
3632
//* log: logging,
37-
mutex: &sync.Mutex{},
38-
ExtraFields: make(map[string]string),
33+
mutex: &sync.Mutex{},
3934
}
4035
}
4136

@@ -70,7 +65,6 @@ func (e *EventRouting) RouteEvent(msg *events.Envelope) {
7065

7166
event.AnnotateWithEnveloppeData(msg)
7267

73-
event.AnnotateWithMetaData(e.ExtraFields)
7468
if _, hasAppId := event.Fields["cf_app_id"]; hasAppId {
7569
event.AnnotateWithAppData(e.CachingClient)
7670
}
@@ -108,16 +102,6 @@ func (e *EventRouting) SetupEventRouting(wantedEvents string) error {
108102
return nil
109103
}
110104

111-
func (e *EventRouting) SetExtraFields(extraEventsString string) {
112-
// Parse extra fields from cmd call
113-
extraFields, err := extrafields.ParseExtraFields(extraEventsString)
114-
if err != nil {
115-
logging.LogError("Error parsing extra fields: ", err)
116-
os.Exit(1)
117-
}
118-
e.ExtraFields = extraFields
119-
}
120-
121105
func (e *EventRouting) isAuthorizedEvent(wantedEvent string) bool {
122106
for _, authorizeEvent := range events.Envelope_EventType_name {
123107
if wantedEvent == authorizeEvent {

0 commit comments

Comments
 (0)