本文整理汇总了Golang中github.com/cloudfoundry/dropsonde/metric_sender.NewMetricSender函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMetricSender函数的具体用法?Golang NewMetricSender怎么用?Golang NewMetricSender使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMetricSender函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: initializeMetrics
func initializeMetrics(batchIntervalMilliseconds uint) *metricbatcher.MetricBatcher {
eventEmitter := dropsonde.AutowiredEmitter()
metricSender := metric_sender.NewMetricSender(eventEmitter)
metricBatcher := metricbatcher.New(metricSender, time.Duration(batchIntervalMilliseconds)*time.Millisecond)
metrics.Initialize(metricSender, metricBatcher)
return metricBatcher
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:7,代码来源:doppler.go
示例2: initialize
func initialize() {
sender := metric_sender.NewMetricSender(AutowiredEmitter())
batcher := metricbatcher.New(sender, defaultBatchInterval)
metrics.Initialize(sender, batcher)
logs.Initialize(log_sender.NewLogSender(AutowiredEmitter(), statsInterval, gosteno.NewLogger("dropsonde/logs")))
go runtime_stats.NewRuntimeStats(autowiredEmitter, statsInterval).Run(nil)
http.DefaultTransport = InstrumentedRoundTripper(http.DefaultTransport)
}
开发者ID:trainchou,项目名称:gorouter,代码行数:8,代码来源:dropsonde.go
示例3: initializeMetrics
func initializeMetrics(messageTagger *tagger.Tagger, config *config.Config, logger *gosteno.Logger) {
metricsAggregator := messageaggregator.New(messageTagger, logger)
eventWriter := eventwriter.New("MetronAgent", metricsAggregator)
metricSender := metric_sender.NewMetricSender(eventWriter)
metricBatcher := metricbatcher.New(metricSender, time.Duration(config.MetricBatchIntervalSeconds)*time.Second)
metrics.Initialize(metricSender, metricBatcher)
}
开发者ID:syslxg,项目名称:loggregator,代码行数:8,代码来源:main.go
示例4: initializeMetrics
func initializeMetrics(byteSigner *signer.Signer, config *config.Config, logger *gosteno.Logger) {
metricsMarshaller := eventmarshaller.New(byteSigner, logger)
metricsTagger := tagger.New(config.Deployment, config.Job, config.Index, metricsMarshaller)
metricsAggregator := messageaggregator.New(metricsTagger, logger)
eventWriter := eventwriter.New("MetronAgent", metricsAggregator)
metricSender := metric_sender.NewMetricSender(eventWriter)
metricBatcher := metricbatcher.New(metricSender, time.Duration(config.MetricBatchIntervalSeconds)*time.Second)
metrics.Initialize(metricSender, metricBatcher)
}
开发者ID:pkdevbox,项目名称:loggregator,代码行数:10,代码来源:main.go
示例5: initializeMetrics
func initializeMetrics(config *config.Config, stopChan chan struct{}, logger *gosteno.Logger) (*metricbatcher.MetricBatcher, *eventwriter.EventWriter) {
eventWriter := eventwriter.New(origin)
metricSender := metric_sender.NewMetricSender(eventWriter)
metricBatcher := metricbatcher.New(metricSender, time.Duration(config.MetricBatchIntervalMilliseconds)*time.Millisecond)
metrics.Initialize(metricSender, metricBatcher)
stats := runtime_stats.NewRuntimeStats(eventWriter, time.Duration(config.RuntimeStatsIntervalMilliseconds)*time.Millisecond)
go stats.Run(stopChan)
return metricBatcher, eventWriter
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:10,代码来源:main.go
示例6: initializeMetrics
func initializeMetrics(messageTagger *tagger.Tagger, config *config.Config, stopChan chan struct{}, logger *gosteno.Logger) {
metricsAggregator := messageaggregator.New(messageTagger, logger)
eventWriter := eventwriter.New("MetronAgent", metricsAggregator)
metricSender := metric_sender.NewMetricSender(eventWriter)
metricBatcher := metricbatcher.New(metricSender, time.Duration(config.MetricBatchIntervalMilliseconds)*time.Millisecond)
metrics.Initialize(metricSender, metricBatcher)
stats := runtime_stats.NewRuntimeStats(eventWriter, time.Duration(config.RuntimeStatsIntervalMilliseconds)*time.Millisecond)
go stats.Run(stopChan)
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:11,代码来源:main.go
示例7:
"os"
"sync"
)
// these tests need to be invoked individually from an external script,
// since environment variables need to be set/unset before starting the tests
var _ = Describe("Autowire End-to-End", func() {
Context("with DROPSONDE_ORIGIN set", func() {
var oldEnv string
BeforeEach(func() {
oldEnv = os.Getenv("DROPSONDE_ORIGIN")
os.Setenv("DROPSONDE_ORIGIN", "test-origin")
emitter, _ := autowire.CreateDefaultEmitter()
autowire.Initialize(emitter)
metrics.Initialize(metric_sender.NewMetricSender(autowire.AutowiredEmitter()))
})
AfterEach(func() {
os.Setenv("DROPSONDE_ORIGIN", oldEnv)
})
It("emits HTTP client/server events and heartbeats", func() {
udpListener, err := net.ListenPacket("udp4", ":3457")
Expect(err).ToNot(HaveOccurred())
defer udpListener.Close()
udpDataChan := make(chan []byte, 16)
receivedEvents := make(map[string]bool)
lock := sync.RWMutex{}
origin := os.Getenv("DROPSONDE_ORIGIN")
开发者ID:ninglipeng,项目名称:gorouter,代码行数:31,代码来源:autowire_end_to_end_test.go
示例8:
"time"
)
var (
fakeEventEmitter *fake.FakeEventEmitter
uptimeMonitor monitor.Monitor
)
const (
interval = 100 * time.Millisecond
)
var _ = Describe("UptimeMonitor", func() {
BeforeEach(func() {
fakeEventEmitter = fake.NewFakeEventEmitter("MonitorTest")
sender := metric_sender.NewMetricSender(fakeEventEmitter)
batcher := metricbatcher.New(sender, 100*time.Millisecond)
metrics.Initialize(sender, batcher)
uptimeMonitor = monitor.NewUptimeMonitor(interval)
go uptimeMonitor.Start()
})
AfterEach(func() {
fakeEventEmitter.Close()
})
Context("stops automatically", func() {
AfterEach(func() {
开发者ID:lyuyun,项目名称:loggregator,代码行数:31,代码来源:uptime_monitor_test.go
示例9: init
func init() {
Initialize(metric_sender.NewMetricSender(autowire.AutowiredEmitter()))
}
开发者ID:johannespetzold,项目名称:gorouter,代码行数:3,代码来源:metrics.go
示例10:
)
// these tests need to be invoked individually from an external script,
// since environment variables need to be set/unset before starting the tests
var _ = Describe("Autowire End-to-End", func() {
Context("with standard initialization", func() {
origin := []string{"test-origin"}
BeforeEach(func() {
var err error
udpListener, err = net.ListenPacket("udp4", ":3457")
Expect(err).ToNot(HaveOccurred())
go listenForEvents(origin)
dropsonde.Initialize("localhost:3457", origin...)
sender := metric_sender.NewMetricSender(dropsonde.AutowiredEmitter())
batcher := metricbatcher.New(sender, 100*time.Millisecond)
metrics.Initialize(sender, batcher)
})
AfterEach(func() {
udpListener.Close()
})
It("emits HTTP client/server events", func() {
httpListener, err := net.Listen("tcp", "localhost:0")
Expect(err).ToNot(HaveOccurred())
defer httpListener.Close()
httpHandler := dropsonde.InstrumentedHandler(FakeHandler{})
go http.Serve(httpListener, httpHandler)
开发者ID:benlaplanche,项目名称:emitter,代码行数:30,代码来源:dropsonde_end_to_end_test.go
示例11:
"github.com/cloudfoundry/dropsonde/events"
"github.com/cloudfoundry/dropsonde/metric_sender"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("MetricSender", func() {
var (
emitter *fake.FakeEventEmitter
sender metric_sender.MetricSender
)
BeforeEach(func() {
emitter = fake.NewFakeEventEmitter("origin")
sender = metric_sender.NewMetricSender(emitter)
})
It("sends a metric to its emitter", func() {
err := sender.SendValue("metric-name", 42, "answers")
Expect(err).NotTo(HaveOccurred())
Expect(emitter.GetMessages()).To(HaveLen(1))
metric := emitter.GetMessages()[0].Event.(*events.ValueMetric)
Expect(metric.GetName()).To(Equal("metric-name"))
Expect(metric.GetValue()).To(BeNumerically("==", 42))
Expect(metric.GetUnit()).To(Equal("answers"))
})
It("returns an error if it can't send metric value", func() {
emitter.ReturnError = errors.New("some error")
开发者ID:trainchou,项目名称:gorouter,代码行数:31,代码来源:metric_sender_test.go
注:本文中的github.com/cloudfoundry/dropsonde/metric_sender.NewMetricSender函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论