當前位置: 首頁>>代碼示例>>Golang>>正文


Golang metrics.SendValue函數代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/dropsonde/metrics.SendValue函數的典型用法代碼示例。如果您正苦於以下問題:Golang SendValue函數的具體用法?Golang SendValue怎麽用?Golang SendValue使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了SendValue函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: CaptureRoutingResponse

func (m *MetricsReporter) CaptureRoutingResponse(b *route.Endpoint, res *http.Response, t time.Time, d time.Duration) {
	dropsondeMetrics.BatchIncrementCounter(getResponseCounterName(res))
	dropsondeMetrics.BatchIncrementCounter("responses")

	latency := float64(d / time.Millisecond)
	unit := "ms"
	dropsondeMetrics.SendValue("latency", latency, unit)

	componentName, ok := b.Tags["component"]
	if ok && len(componentName) > 0 {
		dropsondeMetrics.SendValue(fmt.Sprintf("latency.%s", componentName), latency, unit)
	}
}
開發者ID:idouba,項目名稱:gorouter,代碼行數:13,代碼來源:metrics_reporter.go

示例2: Dec

func (s *SinkManagerMetrics) Dec(sink sinks.Sink) {
	switch sink.(type) {
	case *dump.DumpSink:
		dumpSinks := atomic.AddInt32(&s.dumpSinks, -1)
		metrics.SendValue("messageRouter.numberOfDumpSinks", float64(dumpSinks), "sinks")

	case *syslog.SyslogSink:
		syslogSinks := atomic.AddInt32(&s.syslogSinks, -1)
		metrics.SendValue("messageRouter.numberOfSyslogSinks", float64(syslogSinks), "sinks")

	case *websocket.WebsocketSink:
		websocketSinks := atomic.AddInt32(&s.websocketSinks, -1)
		metrics.SendValue("messageRouter.numberOfWebsocketSinks", float64(websocketSinks), "sinks")
	}
}
開發者ID:rakutentech,項目名稱:loggregator,代碼行數:15,代碼來源:sink_manager_metrics.go

示例3: emitMetric

func emitMetric(event observer.AddressChange) {
	if event.New == "" {
		return
	}

	key := getKey(event, "changed")
	metrics.SendValue(key, 1, "count")
}
開發者ID:st3v,項目名稱:arp-watch,代碼行數:8,代碼來源:main.go

示例4: Dec

func (sinkManagerMetrics *SinkManagerMetrics) Dec(sink sinks.Sink) {
	sinkManagerMetrics.lock.Lock()
	defer sinkManagerMetrics.lock.Unlock()

	switch sink.(type) {
	case *dump.DumpSink:
		sinkManagerMetrics.dumpSinks--
		metrics.SendValue("messageRouter.numberOfDumpSinks", float64(sinkManagerMetrics.dumpSinks), "sinks")

	case *syslog.SyslogSink:
		sinkManagerMetrics.syslogSinks--
		metrics.SendValue("messageRouter.numberOfSyslogSinks", float64(sinkManagerMetrics.syslogSinks), "sinks")

	case *websocket.WebsocketSink:
		sinkManagerMetrics.websocketSinks--
		metrics.SendValue("messageRouter.numberOfWebsocketSinks", float64(sinkManagerMetrics.websocketSinks), "sinks")
	}
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:18,代碼來源:sink_manager_metrics.go

示例5: processInstancesJson

func (agent *Agent) processInstancesJson() {
	currentTasks, err := agent.readInstancesJson()
	metrics.SendValue("totalApps", float64(len(currentTasks)), "apps")
	if err != nil {
		return
	}

	agent.knownInstancesChan <- agent.processTasks(currentTasks)
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:9,代碼來源:agent.go

示例6: EmitMetric

func (c *client) EmitMetric(m *metric) error {

	err := dmetrics.SendValue(m.Name, m.Value, m.Unit)

	if err != nil {
		return fmt.Errorf("Error emitting metric %v", m)
	}
	return nil
}
開發者ID:benlaplanche,項目名稱:emitter,代碼行數:9,代碼來源:redis.go

示例7: Start

func (u *UptimeMonitor) Start() {
	ticker := time.NewTicker(u.interval)

	for {
		select {
		case <-ticker.C:
			metrics.SendValue("Uptime", float64(time.Now().Unix()-u.started), "seconds")
		case stopped := <-u.doneChan:
			ticker.Stop()
			close(stopped)
			return
		}
	}
}
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:14,代碼來源:uptime_monitor.go

示例8: Start

func (u *UptimeMonitor) Start() {
	ticker := time.NewTicker(u.interval)
	u.wg.Add(1)
	defer u.wg.Done()

	for {
		select {
		case <-ticker.C:
			metrics.SendValue("Uptime", float64(time.Now().Unix()-u.started), "seconds")
		case <-u.doneChan:
			ticker.Stop()
			return
		}
	}
}
開發者ID:rakutentech,項目名稱:loggregator,代碼行數:15,代碼來源:uptime_monitor.go

示例9: pollInstancesJson

func (agent *Agent) pollInstancesJson() {
	defer agent.Done()

	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		panic(err)
	}

	for {
		time.Sleep(100 * time.Millisecond)
		err := watcher.Watch(path.Dir(agent.InstancesJsonFilePath))
		if err != nil {
			agent.logger.Warnf("Reading failed, retrying. %s\n", err)
			continue
		}
		break
	}

	agent.logger.Info("Read initial tasks data")
	agent.processInstancesJson()

	for {
		select {
		case ev := <-watcher.Event:
			agent.logger.Debugf("Got Event: %v\n", ev)
			if ev.IsDelete() {
				agent.knownInstancesChan <- resetCache
				metrics.SendValue("totalApps", 0.0, "apps")
			} else {
				agent.processInstancesJson()
			}
		case err := <-watcher.Error:
			agent.logger.Warnf("Received error from file system notification: %s\n", err)
		case <-agent.stopChan:
			return
		}
	}
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:38,代碼來源:agent.go

示例10: Start

func (l *LinuxFileDescriptor) Start() {
	l.logger.Info("Starting Open File Descriptor Monitor...")

	ticker := time.NewTicker(l.interval)
	l.logger.Infof("Starting FD monitor with pid %d", os.Getpid())
	path := fmt.Sprintf("/proc/%d/fd", os.Getpid())

	for {
		select {
		case <-ticker.C:
			finfos, err := ioutil.ReadDir(path)
			if err != nil {
				l.logger.Errorf("Could not read pid dir %s: %s", path, err)
				break
			}

			metrics.SendValue("LinuxFileDescriptor", float64(symlinks(finfos)), "File")
		case stopped := <-l.done:
			ticker.Stop()
			close(stopped)
			return
		}
	}
}
開發者ID:kei-yamazaki,項目名稱:loggregator,代碼行數:24,代碼來源:openfd.go

示例11: CaptureRouteStats

func (c *MetricsReporter) CaptureRouteStats(totalRoutes int, msSinceLastUpdate uint64) {
	dropsondeMetrics.SendValue("total_routes", float64(totalRoutes), "")
	dropsondeMetrics.SendValue("ms_since_last_registry_update", float64(msSinceLastUpdate), "ms")
}
開發者ID:idouba,項目名稱:gorouter,代碼行數:4,代碼來源:metrics_reporter.go

示例12: Send

func (name Duration) Send(duration time.Duration) {
	dropsonde_metrics.SendValue(string(name), float64(duration), "nanos")
}
開發者ID:nagyistoce,項目名稱:garden-linux,代碼行數:3,代碼來源:periodic_metron_notifier.go

示例13: DecFirehose

func (sinkManagerMetrics *SinkManagerMetrics) DecFirehose() {
	sinkManagerMetrics.lock.Lock()
	defer sinkManagerMetrics.lock.Unlock()
	sinkManagerMetrics.firehoseSinks--
	metrics.SendValue("messageRouter.numberOfFirehoseSinks", float64(sinkManagerMetrics.firehoseSinks), "sinks")
}
開發者ID:khj0651,項目名稱:loggregator,代碼行數:6,代碼來源:sink_manager_metrics.go

示例14: sendMetric

func sendMetric(metricName string, startTime time.Time) {
	elapsedMillisecond := float64(time.Since(startTime)) / float64(time.Millisecond)
	metrics.SendValue(fmt.Sprintf("dopplerProxy.%sLatency", metricName), elapsedMillisecond, "ms")
}
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:4,代碼來源:doppler_proxy.go

示例15:

						defer lock.Unlock()
						receivedEvents[eventId] = true
					}()
				}
			}()

			httpListener, err := net.Listen("tcp", "localhost:0")
			Expect(err).ToNot(HaveOccurred())
			defer httpListener.Close()
			httpHandler := dropsonde.InstrumentedHandler(FakeHandler{})
			go http.Serve(httpListener, httpHandler)

			_, err = http.Get("http://" + httpListener.Addr().String())
			Expect(err).ToNot(HaveOccurred())

			metrics.SendValue("TestMetric", 0, "")
			metrics.IncrementCounter("TestIncrementCounter")

			expectedEventTypes := []string{"HttpStartClient", "HttpStartServer", "HttpStopServer", "HttpStopClient", "ValueMetricnumCPUS", "ValueMetricTestMetric", "CounterEventTestIncrementCounter"}

			for _, eventType := range expectedEventTypes {
				Eventually(func() bool {
					lock.RLock()
					defer lock.RUnlock()
					_, ok := receivedEvents[eventType]
					return ok
				}).Should(BeTrue(), fmt.Sprintf("missing %s", eventType))
			}

			heartbeatUuid := heartbeatRequest.GetIdentifier().String()
			Eventually(heartbeatUuidsChan).Should(Receive(Equal(heartbeatUuid)))
開發者ID:jungle0755,項目名稱:gorouter,代碼行數:31,代碼來源:dropsonde_end_to_end_test.go


注:本文中的github.com/cloudfoundry/dropsonde/metrics.SendValue函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。