func NewSinkManager(maxRetainedLogMessages uint32, skipCertVerify bool, blackListManager *blacklist.URLBlacklistManager, logger *gosteno.Logger) (*SinkManager, <-chan domain.AppServices) { appStoreUpdateChan := make(chan domain.AppServices, 10) return &SinkManager{ doneChannel: make(chan struct{}), errorChannel: make(chan *logmessage.Message, 100), urlBlacklistManager: blackListManager, sinks: groupedsinks.NewGroupedSinks(), skipCertVerify: skipCertVerify, recentLogCount: maxRetainedLogMessages, Metrics: metrics.NewSinkManagerMetrics(), logger: logger, appStoreUpdateChan: appStoreUpdateChan, }, appStoreUpdateChan }
. "github.com/onsi/gomega" "loggregator/sinks/dump" "loggregator/sinks/syslog" "loggregator/sinks/websocket" "loggregator/sinks" "loggregator/sinkserver/metrics" ) var _ = Describe("SinkManagerMetrics", func() { var sinkManagerMetrics *metrics.SinkManagerMetrics var sink sinks.Sink BeforeEach(func() { sinkManagerMetrics = metrics.NewSinkManagerMetrics() }) It("Should have metrics for dump sinks", func() { Expect(sinkManagerMetrics.Emit().Metrics[0].Name).To(Equal("numberOfDumpSinks")) Expect(sinkManagerMetrics.Emit().Metrics[0].Value).To(Equal(0)) Expect(sinkManagerMetrics.Emit().Metrics[1].Value).To(Equal(0)) Expect(sinkManagerMetrics.Emit().Metrics[2].Value).To(Equal(0)) sink = &dump.DumpSink{} sinkManagerMetrics.Inc(sink) Expect(sinkManagerMetrics.Emit().Metrics[0].Value).To(Equal(1)) Expect(sinkManagerMetrics.Emit().Metrics[1].Value).To(Equal(0)) Expect(sinkManagerMetrics.Emit().Metrics[2].Value).To(Equal(0))