Пример #1
0
func (wrapper *Wrapper) logTheEntry(statusCode int) {
	elapsedTimeNano := time.Now().UnixNano() - wrapper.startTime.UnixNano()
	elapsedTime := int(elapsedTimeNano / 1000000)

	logEntry := logentry.New("metric:vulcand", "http", wrapper.backendName, "anonymous", statusCode, elapsedTime)
	logEntryBytes, err := json.Marshal(logEntry)
	logError("NewJobLogger failed: %v\n", err)

	if err != nil {
		return
	}

	wrapper.onStatus(logEntryBytes)
}
Пример #2
0
func logJob(redisURI, redisQueue, dockerURL, workerName string, exitCode int) error {
	redisConn, err := redis.DialURL(redisURI)
	if err != nil {
		return err
	}

	logEntry := logentry.New("metric:tattle", "tattle", dockerURL, workerName, exitCode, 0, false)
	logEntryBytes, err := json.Marshal(logEntry)
	if err != nil {
		return err
	}

	_, err = redisConn.Do("LPUSH", redisQueue, logEntryBytes)
	return err
}