本文整理汇总了Golang中github.com/cloudfoundry/noaa.NewConsumer函数的典型用法代码示例。如果您正苦于以下问题:Golang NewConsumer函数的具体用法?Golang NewConsumer怎么用?Golang NewConsumer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewConsumer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
if len(os.Args) != 2 {
PrintUsageAndExit()
}
logGuid := os.Args[1]
address := os.Getenv("DOPPLER")
if address == "" {
address = "wss://doppler.ketchup.cf-app.com:4443"
}
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
}
logConsumer := noaa.NewConsumer(address, tlsConfig, nil)
outputChan := make(chan *events.LogMessage, 0)
errorChan := make(chan error, 0)
stopChan := make(chan struct{}, 0)
go logConsumer.TailingLogs(logGuid, "", outputChan, errorChan, stopChan)
say.Println(0, "Fetching logs for log-guid: %s", say.Green(logGuid))
for {
select {
case message := <-outputChan:
t := time.Unix(0, message.GetTimestamp())
say.Println(0, "%s [%s|%s] %s", say.Green(t.Format("02 Jan 15:04")), say.Cyan("%s", message.GetSourceInstance()), say.Cyan("%s", message.GetSourceType()), string(message.GetMessage()))
case err := <-errorChan:
say.Println(0, say.Red("Error while streaming:\n%s", err.Error()))
return
}
}
}
开发者ID:gitter-badger,项目名称:picard,代码行数:34,代码来源:main.go
示例2: NewRepositoryLocator
func NewRepositoryLocator(config core_config.ReadWriter, gatewaysByName map[string]net.Gateway) (loc RepositoryLocator) {
strategy := strategy.NewEndpointStrategy(config.ApiVersion())
cloudControllerGateway := gatewaysByName["cloud-controller"]
routingApiGateway := gatewaysByName["routing-api"]
uaaGateway := gatewaysByName["uaa"]
loc.authRepo = authentication.NewUAAAuthenticationRepository(uaaGateway, config)
// ensure gateway refreshers are set before passing them by value to repositories
cloudControllerGateway.SetTokenRefresher(loc.authRepo)
uaaGateway.SetTokenRefresher(loc.authRepo)
tlsConfig := net.NewTLSConfig([]tls.Certificate{}, config.IsSSLDisabled())
loggregatorConsumer := consumer.New(config.LoggregatorEndpoint(), tlsConfig, http.ProxyFromEnvironment)
loggregatorConsumer.SetDebugPrinter(terminal.DebugPrinter{})
noaaLib := noaa.NewConsumer(config.DopplerEndpoint(), tlsConfig, http.ProxyFromEnvironment)
noaaLib.SetDebugPrinter(terminal.DebugPrinter{})
logNoaaConsumer := NewNoaaConsumer(noaaLib)
loc.appBitsRepo = application_bits.NewCloudControllerApplicationBitsRepository(config, cloudControllerGateway)
loc.appEventsRepo = app_events.NewCloudControllerAppEventsRepository(config, cloudControllerGateway, strategy)
loc.appFilesRepo = api_app_files.NewCloudControllerAppFilesRepository(config, cloudControllerGateway)
loc.appRepo = applications.NewCloudControllerApplicationRepository(config, cloudControllerGateway)
loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, cloudControllerGateway)
loc.appInstancesRepo = app_instances.NewCloudControllerAppInstancesRepository(config, cloudControllerGateway)
loc.authTokenRepo = NewCloudControllerServiceAuthTokenRepository(config, cloudControllerGateway)
loc.curlRepo = NewCloudControllerCurlRepository(config, cloudControllerGateway)
loc.domainRepo = NewCloudControllerDomainRepository(config, cloudControllerGateway, strategy)
loc.endpointRepo = NewEndpointRepository(config, cloudControllerGateway)
loc.logsNoaaRepo = NewLogsNoaaRepository(config, logNoaaConsumer, loc.authRepo)
loc.oldLogsRepo = NewLoggregatorLogsRepository(config, loggregatorConsumer, loc.authRepo)
loc.organizationRepo = organizations.NewCloudControllerOrganizationRepository(config, cloudControllerGateway)
loc.passwordRepo = password.NewCloudControllerPasswordRepository(config, uaaGateway)
loc.quotaRepo = quotas.NewCloudControllerQuotaRepository(config, cloudControllerGateway)
loc.routeRepo = NewCloudControllerRouteRepository(config, cloudControllerGateway)
loc.routingApiRepo = NewRoutingApiRepository(config, routingApiGateway)
loc.stackRepo = stacks.NewCloudControllerStackRepository(config, cloudControllerGateway)
loc.serviceRepo = NewCloudControllerServiceRepository(config, cloudControllerGateway)
loc.serviceKeyRepo = NewCloudControllerServiceKeyRepository(config, cloudControllerGateway)
loc.serviceBindingRepo = NewCloudControllerServiceBindingRepository(config, cloudControllerGateway)
loc.serviceBrokerRepo = NewCloudControllerServiceBrokerRepository(config, cloudControllerGateway)
loc.servicePlanRepo = NewCloudControllerServicePlanRepository(config, cloudControllerGateway)
loc.servicePlanVisibilityRepo = NewCloudControllerServicePlanVisibilityRepository(config, cloudControllerGateway)
loc.serviceSummaryRepo = NewCloudControllerServiceSummaryRepository(config, cloudControllerGateway)
loc.spaceRepo = spaces.NewCloudControllerSpaceRepository(config, cloudControllerGateway)
loc.userProvidedServiceInstanceRepo = NewCCUserProvidedServiceInstanceRepository(config, cloudControllerGateway)
loc.userRepo = NewCloudControllerUserRepository(config, uaaGateway, cloudControllerGateway)
loc.buildpackRepo = NewCloudControllerBuildpackRepository(config, cloudControllerGateway)
loc.buildpackBitsRepo = NewCloudControllerBuildpackBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{})
loc.securityGroupRepo = security_groups.NewSecurityGroupRepo(config, cloudControllerGateway)
loc.stagingSecurityGroupRepo = staging.NewStagingSecurityGroupsRepo(config, cloudControllerGateway)
loc.runningSecurityGroupRepo = running.NewRunningSecurityGroupsRepo(config, cloudControllerGateway)
loc.securityGroupSpaceBinder = securitygroupspaces.NewSecurityGroupSpaceBinder(config, cloudControllerGateway)
loc.spaceQuotaRepo = space_quotas.NewCloudControllerSpaceQuotaRepository(config, cloudControllerGateway)
loc.featureFlagRepo = feature_flags.NewCloudControllerFeatureFlagRepository(config, cloudControllerGateway)
loc.environmentVariableGroupRepo = environment_variable_groups.NewCloudControllerEnvironmentVariableGroupsRepository(config, cloudControllerGateway)
loc.copyAppSourceRepo = copy_application_source.NewCloudControllerCopyApplicationSourceRepository(config, cloudControllerGateway)
return
}
开发者ID:riccardomc,项目名称:cf-fastpush-plugin,代码行数:60,代码来源:repository_locator.go
示例3: main
func main() {
connection := noaa.NewConsumer(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
connection.SetDebugPrinter(ConsoleDebugPrinter{})
messages, err := connection.RecentLogs(appGuid, authToken)
if err != nil {
fmt.Printf("===== Error getting recent messages: %v\n", err)
} else {
fmt.Println("===== Recent logs")
for _, msg := range messages {
fmt.Println(msg)
}
}
fmt.Println("===== Streaming metrics")
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
go connection.Stream(appGuid, authToken, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
for msg := range msgChan {
fmt.Printf("%v \n", msg)
}
}
开发者ID:roxtar,项目名称:influxdb-firehose-nozzle,代码行数:31,代码来源:main.go
示例4: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
logger, reconfigurableSink := cf_lager.New("tps-listener")
initializeDropsonde(logger)
noaaClient := noaa.NewConsumer(*trafficControllerURL, &tls.Config{InsecureSkipVerify: *skipSSLVerification}, nil)
defer noaaClient.Close()
apiHandler := initializeHandler(logger, noaaClient, *maxInFlightRequests, initializeBBSClient(logger))
members := grouper.Members{
{"api", http_server.New(*listenAddr, apiHandler)},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
开发者ID:emc-xchallenge,项目名称:tps,代码行数:35,代码来源:main.go
示例5: consumeFirehose
func (d *APMFirehoseNozzle) consumeFirehose(authToken string) {
d.consumer = noaa.NewConsumer(
d.config.TrafficControllerURL,
&tls.Config{InsecureSkipVerify: d.config.InsecureSSLSkipVerify},
nil)
go d.consumer.Firehose(d.config.FirehoseSubscriptionID, authToken, d.messages, d.errs, nil)
}
开发者ID:CA-APM,项目名称:epagent-nozzle,代码行数:8,代码来源:apm_firehose_nozzle.go
示例6: consumeFirehose
func (m *MetricsNozzle) consumeFirehose(authToken string) {
m.consumer = noaa.NewConsumer(
m.config.DopplerAddr,
&tls.Config{InsecureSkipVerify: m.config.InsecureSSLSkipVerify},
nil)
go m.consumer.Firehose(m.config.FirehoseSubscriptionId, authToken, m.messages, m.errs)
}
开发者ID:benlaplanche,项目名称:metrics-consumer,代码行数:8,代码来源:nozzle.go
示例7: consumeFirehose
func (d *DatadogFirehoseNozzle) consumeFirehose(authToken string) {
d.consumer = noaa.NewConsumer(
d.config.TrafficControllerURL,
&tls.Config{InsecureSkipVerify: d.config.InsecureSSLSkipVerify},
nil)
d.consumer.SetIdleTimeout(time.Duration(d.config.IdleTimeoutSeconds) * time.Second)
go d.consumer.Firehose(d.config.FirehoseSubscriptionID, authToken, d.messages, d.errs)
}
开发者ID:daverc1-pivotal,项目名称:datadog-firehose-nozzle,代码行数:8,代码来源:datadog_firehose_nozzle.go
示例8: initiateFirehoseConnection
func initiateFirehoseConnection() (*noaa.Consumer, chan *events.Envelope) {
localIP, _ := localip.LocalIP()
firehoseConnection := noaa.NewConsumer("ws://"+localIP+":49629", &tls.Config{InsecureSkipVerify: true}, nil)
msgChan := make(chan *events.Envelope, 2000)
errorChan := make(chan error)
go firehoseConnection.Firehose("uniqueId", "", msgChan, errorChan)
return firehoseConnection, msgChan
}
开发者ID:hpcloud,项目名称:loggregator-1,代码行数:8,代码来源:firehose_reader.go
示例9: SetUpConsumer
func SetUpConsumer() (*noaa.Consumer, *TestDebugPrinter) {
tlsConfig := tls.Config{InsecureSkipVerify: config.SkipSSLVerify}
printer := &TestDebugPrinter{}
connection := noaa.NewConsumer(config.DopplerEndpoint, &tlsConfig, nil)
connection.SetDebugPrinter(printer)
return connection, printer
}
开发者ID:lyuyun,项目名称:loggregator,代码行数:8,代码来源:helpers.go
示例10: main
func main() {
setupHTTP()
uaaURL, err := url.Parse(uaa)
if nil != err {
panic("Failed to parse uaa url!")
}
creds, err := uaaclientcredentials.New(uaaURL, true, clientID, clientSecret)
if nil != err {
panic("Failed to obtain creds!")
}
consumer := noaa.NewConsumer(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
httpStartStopProcessor := processors.NewHttpStartStopProcessor()
sender := statsd.NewStatsdClient(statsdAddress, statsdPrefix)
sender.CreateSocket()
var processedMetrics []metrics.Metric
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
token, err := creds.GetBearerToken()
if nil != err {
panic(err)
}
go consumer.Firehose(firehoseSubscriptionID, token, msgChan, errorChan, nil)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
for msg := range msgChan {
eventType := msg.GetEventType()
switch eventType {
case events.Envelope_HttpStartStop:
processedMetrics = httpStartStopProcessor.Process(msg)
default:
atomic.AddUint64(&count, 1)
// do nothing
}
if len(processedMetrics) > 0 {
for _, metric := range processedMetrics {
metric.Send(sender)
}
}
processedMetrics = nil
}
}
开发者ID:malston,项目名称:watchman,代码行数:58,代码来源:main.go
示例11: main
func main() {
var messages map[string][]metricCategory // [origin]{metricCategory To []names}]
messages = make(map[string][]metricCategory)
connection := noaa.NewConsumer(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
connection.SetDebugPrinter(ConsoleDebugPrinter{})
fmt.Println("===== Streaming Firehose (will only succeed if you have admin credentials)")
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
go connection.Firehose(firehoseSubscriptionId, authToken, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
go startHttp(messages)
for msg := range msgChan {
vm := msg.GetValueMetric()
if vm == nil {
continue
}
origin := msg.GetOrigin()
category, subCategory := parseMetric(*vm.Name)
index := indexOf(messages[origin], category)
if index >= 0 {
metricCategoryGroup := messages[origin][index]
switch f := metricCategoryGroup.(type) {
case *metricCategoryWithSubCategory:
if len(subCategory) > 0 {
if contains(f.SubCategory, subCategory) == false {
f.SubCategory = append(f.SubCategory, subCategory)
}
}
break
default:
}
} else {
if len(subCategory) > 0 {
messages[origin] = append(messages[origin], &metricCategoryWithSubCategory{
Category: category,
SubCategory: []string{subCategory},
})
} else {
messages[origin] = append(messages[origin], &metricCategoryOnly{
Category: category,
})
}
}
}
}
开发者ID:erikjasiak,项目名称:metricReader,代码行数:57,代码来源:main.go
示例12: main
func main() {
consumer := noaa.NewConsumer(DopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
httpStartStopProcessor := processors.NewHttpStartStopProcessor()
valueMetricProcessor := processors.NewValueMetricProcessor()
containerMetricProcessor := processors.NewContainerMetricProcessor()
heartbeatProcessor := processors.NewHeartbeatProcessor()
counterProcessor := processors.NewCounterProcessor()
sender := statsd.NewStatsdClient(statsdAddress, statsdPrefix)
sender.CreateSocket()
var processedMetrics []metrics.Metric
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
go consumer.Firehose(firehoseSubscriptionId, authToken, msgChan, errorChan, nil)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
for msg := range msgChan {
eventType := msg.GetEventType()
// graphite-nozzle can handle CounterEvent, ContainerMetric, Heartbeat,
// HttpStartStop and ValueMetric events
switch eventType {
case events.Envelope_ContainerMetric:
processedMetrics = containerMetricProcessor.Process(msg)
case events.Envelope_CounterEvent:
processedMetrics = counterProcessor.Process(msg)
case events.Envelope_Heartbeat:
processedMetrics = heartbeatProcessor.Process(msg)
case events.Envelope_HttpStartStop:
processedMetrics = httpStartStopProcessor.Process(msg)
case events.Envelope_ValueMetric:
processedMetrics = valueMetricProcessor.Process(msg)
default:
// do nothing
}
if len(processedMetrics) > 0 {
for _, metric := range processedMetrics {
metric.Send(sender)
}
}
processedMetrics = nil
}
}
开发者ID:simonjohansson,项目名称:graphite-nozzle,代码行数:53,代码来源:main.go
示例13: createNoaaClient
func createNoaaClient(dopplerUrl, authToken string) (chan *events.Envelope, chan error) {
connection := noaa.NewConsumer(dopplerUrl, &tls.Config{InsecureSkipVerify: true}, nil)
msgChan := make(chan *events.Envelope)
errorChan := make(chan error)
go func() {
defer close(msgChan)
go connection.Firehose("firehose-a", authToken, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
return msgChan, errorChan
}
开发者ID:jjewett-pcf,项目名称:wats,代码行数:16,代码来源:metric_test.go
示例14: startFirehose
func startFirehose(oauthToken string, msgChan chan *events.Envelope) {
connection := noaa.NewConsumer(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
// connection.SetDebugPrinter(ConsoleDebugPrinter{})
fmt.Println("===== Streaming Firehose (will only succeed if you have admin credentials)")
go func() {
defer close(msgChan)
errorChan := make(chan error)
go connection.Firehose(firehoseSubscriptionId, oauthToken, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:16,代码来源:main.go
示例15: connectToFirehose
func connectToFirehose(appEnv *cfenv.App, token string) chan *events.Envelope {
doppler, err := GetUserProvidedServiceByName("doppler", appEnv)
dieIfError("Failed to get doppler service", err)
consumer := noaa.NewConsumer(doppler.Credentials["uri"].(string), &tls.Config{InsecureSkipVerify: skipSSLVerify}, nil)
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
go consumer.Firehose(subscriptionID, token, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
return msgChan
}
开发者ID:krujos,项目名称:firehose-mixpanel,代码行数:17,代码来源:main.go
示例16: Start
func (c *Client) Start() {
dopplerConnection := noaa.NewConsumer(c.dopplerEndpoint, &tls.Config{InsecureSkipVerify: true}, nil)
subscriptionID := "firehose-stats"
go func() {
err := dopplerConnection.FirehoseWithoutReconnect(subscriptionID, c.authToken, c.outputChan)
if err != nil {
c.ui.Warn(err.Error())
close(c.outputChan)
return
}
}()
defer dopplerConnection.Close()
c.ui.Say("Starting the nozzle")
c.ui.Say("Hit Ctrl+c to exit")
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:19,代码来源:client.go
示例17: main
func main() {
connection := noaa.NewConsumer(DopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
connection.SetDebugPrinter(ConsoleDebugPrinter{})
fmt.Println("===== Streaming ContainerMetrics (will only succeed if you have admin credentials)")
for {
containerMetrics, err := connection.ContainerMetrics(appId, authToken)
for _, cm := range containerMetrics {
fmt.Printf("%v \n", cm)
}
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
time.Sleep(3 * time.Second)
}
}
开发者ID:raghulsid,项目名称:cli,代码行数:21,代码来源:main.go
示例18: main
func main() {
user := flag.String("user", "example-nozzle", "user who has access to the firehose")
password := flag.String("pass", "example-nozzle", "password for the user")
trafficControllerURL := flag.String("tcurl", "wss://doppler.bosh-lite.com:443", "loggregator traffic controller URL and port")
uaaURL := flag.String("uaaurl", "https://uaa.bosh-lite.com", "UAA URL")
flag.Parse()
uaaClient, err := uaago.NewClient(*uaaURL)
if err != nil {
log.Fatalf("Error creating uaa client: %s", err.Error())
}
var authToken string
authToken, err = uaaClient.GetAuthToken(*user, *password, true)
if err != nil {
log.Fatalf("Error getting oauth token: %s. Please check your username and password.", err.Error())
}
connection := noaa.NewConsumer(*trafficControllerURL, &tls.Config{InsecureSkipVerify: true}, nil)
fmt.Println("===== Streaming Firehose (will only succeed if you have admin credentials)")
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
const firehoseSubscriptionId = "firehose-a"
go connection.Firehose(firehoseSubscriptionId, authToken, msgChan, errorChan)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
for msg := range msgChan {
fmt.Printf("%v \n", msg)
}
}
开发者ID:cloudfoundry-incubator,项目名称:example-nozzle,代码行数:40,代码来源:main.go
示例19: CreateFirehoseChan
func CreateFirehoseChan(DopplerEndpoint string, Token string, subId string, skipSSLValidation bool) chan *events.Envelope {
connection := noaa.NewConsumer(DopplerEndpoint, &tls.Config{InsecureSkipVerify: skipSSLValidation}, nil)
connection.SetDebugPrinter(ConsoleDebugPrinter{})
msgChan := make(chan *events.Envelope)
go func() {
errorChan := make(chan error)
defer close(msgChan)
defer func() {
if r := recover(); r != nil {
log.LogError("Recovered in CreateFirehoseChan Thread!", r)
}
}()
go connection.Firehose(subId, Token, msgChan, errorChan)
for err := range errorChan {
log.LogError("Firehose Error!", err.Error())
}
}()
return msgChan
}
开发者ID:msschwartz,项目名称:firehose-to-syslog,代码行数:24,代码来源:firehose.go
示例20: main
func main() {
kingpin.Parse()
fmt.Println(*uaaEndpoint)
fmt.Println(*username)
fmt.Println(*password)
tokenFetcher := &token.UAATokenFetcher{
UaaUrl: *uaaEndpoint,
Username: *username,
Password: *password,
InsecureSSLSkipVerify: *skipSSLValidation,
}
authToken, err := tokenFetcher.FetchAuthToken()
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
consumer := noaa.NewConsumer(*dopplerEndpoint, &tls.Config{InsecureSkipVerify: *skipSSLValidation}, nil)
httpStartStopProcessor := processors.NewHttpStartStopProcessor()
valueMetricProcessor := processors.NewValueMetricProcessor()
containerMetricProcessor := processors.NewContainerMetricProcessor()
heartbeatProcessor := processors.NewHeartbeatProcessor()
counterProcessor := processors.NewCounterProcessor()
sender := statsd.NewStatsdClient(*statsdEndpoint, *statsdPrefix)
sender.CreateSocket()
var processedMetrics []metrics.Metric
msgChan := make(chan *events.Envelope)
go func() {
defer close(msgChan)
errorChan := make(chan error)
go consumer.Firehose(*subscriptionId, authToken, msgChan, errorChan, nil)
for err := range errorChan {
fmt.Fprintf(os.Stderr, "%v\n", err.Error())
}
}()
for msg := range msgChan {
eventType := msg.GetEventType()
// graphite-nozzle can handle CounterEvent, ContainerMetric, Heartbeat,
// HttpStartStop and ValueMetric events
switch eventType {
case events.Envelope_ContainerMetric:
processedMetrics = containerMetricProcessor.Process(msg)
case events.Envelope_CounterEvent:
processedMetrics = counterProcessor.Process(msg)
case events.Envelope_Heartbeat:
processedMetrics = heartbeatProcessor.Process(msg)
case events.Envelope_HttpStartStop:
processedMetrics = httpStartStopProcessor.Process(msg)
case events.Envelope_ValueMetric:
processedMetrics = valueMetricProcessor.Process(msg)
default:
// do nothing
}
if !*debug {
if len(processedMetrics) > 0 {
for _, metric := range processedMetrics {
var prefix string
if *prefixJob {
prefix = msg.GetJob() + "." + msg.GetIndex()
}
metric.Send(sender, prefix)
}
}
} else {
for _, msg := range processedMetrics {
fmt.Println(msg)
}
}
processedMetrics = nil
}
}
开发者ID:alphagov,项目名称:paas-graphite-nozzle,代码行数:81,代码来源:main.go
注:本文中的github.com/cloudfoundry/noaa.NewConsumer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论