All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datorama.oss.timbermill.unit.HeartbeatTask Maven / Gradle / Ivy

There is a newer version: 2.5.3
Show newest version
package com.datorama.oss.timbermill.unit;

import java.util.Map;

import com.datorama.oss.timbermill.ClientHeartbeater;

public class HeartbeatTask extends Task {

    private static final String THREAD_NAME = "threadName";
    public HeartbeatTask(Event e, long daysRotation) {
        setStartTime(e.getTime());
        setName(e.getName());
        setStatus(TaskStatus.SUCCESS);

        setDateToDelete(e.getDateToDelete(daysRotation));

        Map eventString = e.getStrings();
        Map taskContext = this.getCtx();
        taskContext.put(THREAD_NAME, eventString.get(THREAD_NAME));
        setEnv(e.getEnv());

        Map eventMetrics = e.getMetrics();
        Map taskMetrics = this.getMetric();
        if (eventMetrics != null) {
            taskMetrics.put("submitAmount", eventMetrics.get(ClientHeartbeater.SUBMIT_AMOUNT));
            taskMetrics.put("avgSubmitDuration", eventMetrics.get(ClientHeartbeater.AVG_SUBMIT_DURATION));
            taskMetrics.put("maxSubmitDuration", eventMetrics.get(ClientHeartbeater.MAX_SUBMIT_DURATION));
            taskMetrics.put("outputBufferSize", eventMetrics.get(ClientHeartbeater.OUTPUT_BUFFER_SIZE));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy