Beispiel #1
0
func (r *AccessLogRecord) Emit(e emitter.Emitter) {
	if r.RouteEndpoint.ApplicationId != "" {
		b := r.makeRecord()
		message := b.String()
		log.Debugf("Logging to the loggregator: %s", message)
		e.Emit(r.RouteEndpoint.ApplicationId, message)
	}
}
Beispiel #2
0
func (r *Router) SubscribeUnregister() {
	r.subscribeRegistry("router.unregister", func(registryMessage *registryMessage) {
		log.Debugf("Got router.unregister: %v", registryMessage)

		for _, uri := range registryMessage.Uris {
			r.registry.Unregister(
				uri,
				makeRouteEndpoint(registryMessage),
			)
		}
	})
}
func (r *AccessLogRecord) Emit(e emitter.Emitter) {
	if r.RouteEndpoint == nil {
		return
	}

	if r.RouteEndpoint.ApplicationId == "" {
		return
	}
	recordBuffer := r.makeRecord()
	message := recordBuffer.String()
	log.Debugf("Logging to the loggregator: %s", message)
	e.Emit(r.RouteEndpoint.ApplicationId, message)

}
Beispiel #4
0
func (r *Router) flushApps(t time.Time) {
	x := r.registry.ActiveSince(t)

	y, err := json.Marshal(x)
	if err != nil {
		log.Warnf("flushApps: Error marshalling JSON: %s", err)
		return
	}

	b := bytes.Buffer{}
	w := zlib.NewWriter(&b)
	w.Write(y)
	w.Close()

	z := b.Bytes()

	log.Debugf("Active apps: %d, message size: %d", len(x), len(z))

	r.mbusClient.Publish("router.active_apps", z)
}