Search in sources :

Example 1 with SamzaHistogram

use of org.apache.samza.metrics.SamzaHistogram in project samza by apache.

the class TranslatorOutputMetricsMapFunction method init.

/**
 * initializes the TranslatorOutputMetricsMapFunction before any message is processed
 * @param context the {@link Context} for this task
 */
@Override
public void init(Context context) {
    ContainerContext containerContext = context.getContainerContext();
    metricsRegistry = containerContext.getContainerMetricsRegistry();
    processingTime = new SamzaHistogram(metricsRegistry, logicalOpId, TranslatorConstants.PROCESSING_TIME_NAME);
    outputEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.OUTPUT_EVENTS_NAME);
    outputEvents.clear();
}
Also used : ContainerContext(org.apache.samza.context.ContainerContext) SamzaHistogram(org.apache.samza.metrics.SamzaHistogram)

Example 2 with SamzaHistogram

use of org.apache.samza.metrics.SamzaHistogram in project samza by apache.

the class AsyncSystemProducer method start.

public void start() {
    streamIds.forEach(streamId -> {
        sendCallbackLatency.put(streamId, new SamzaHistogram(metricsRegistry, streamId, SEND_CALLBACK_LATENCY));
        sendLatency.put(streamId, new SamzaHistogram(metricsRegistry, streamId, SEND_LATENCY));
        sendErrors.put(streamId, metricsRegistry.newCounter(streamId, SEND_ERRORS));
    });
    if (aggSendLatency == null) {
        aggSendLatency = new SamzaHistogram(metricsRegistry, AGGREGATE, SEND_LATENCY);
        aggSendCallbackLatency = new SamzaHistogram(metricsRegistry, AGGREGATE, SEND_CALLBACK_LATENCY);
        aggSendErrors = metricsRegistry.newCounter(AGGREGATE, SEND_ERRORS);
    }
}
Also used : SamzaHistogram(org.apache.samza.metrics.SamzaHistogram)

Aggregations

SamzaHistogram (org.apache.samza.metrics.SamzaHistogram)2 ContainerContext (org.apache.samza.context.ContainerContext)1