Search in sources :

Example 1 with MetricsManager

use of io.zeebe.util.metrics.MetricsManager in project zeebe by zeebe-io.

the class WorkflowInstanceStreamProcessor method onOpen.

@Override
public void onOpen(StreamProcessorContext context) {
    final LogStream logstream = context.getLogStream();
    this.logStreamPartitionId = logstream.getPartitionId();
    this.streamProcessorId = context.getId();
    this.logStreamReader.wrap(logstream);
    this.logStreamBatchWriter = new LogStreamBatchWriterImpl(logstream);
    this.incidentEventWriter = new IncidentEventWriter(sourceEventMetadata, workflowInstanceEvent);
    this.logStream = logstream;
    final MetricsManager metricsManager = context.getActorScheduler().getMetricsManager();
    final String topicName = logstream.getTopicName().getStringWithoutLengthUtf8(0, logstream.getTopicName().capacity());
    final String partitionId = Integer.toString(logstream.getPartitionId());
    workflowInstanceEventCreate = metricsManager.newMetric("workflow_instance_events_count").type("counter").label("topic", topicName).label("partition", partitionId).label("type", "created").create();
    workflowInstanceEventCanceled = metricsManager.newMetric("workflow_instance_events_count").type("counter").label("topic", topicName).label("partition", partitionId).label("type", "canceled").create();
    workflowInstanceEventCompleted = metricsManager.newMetric("workflow_instance_events_count").type("counter").label("topic", topicName).label("partition", partitionId).label("type", "completed").create();
}
Also used : IncidentEventWriter(io.zeebe.broker.incident.IncidentEventWriter) MetricsManager(io.zeebe.util.metrics.MetricsManager)

Example 2 with MetricsManager

use of io.zeebe.util.metrics.MetricsManager in project zeebe by zeebe-io.

the class MetricsFileWriterService method start.

@Override
public void start(ServiceStartContext startContext) {
    final ActorScheduler scheduler = startContext.getScheduler();
    final MetricsManager metricsManager = startContext.getScheduler().getMetricsManager();
    final String metricsFileName = new File(cfg.getDirectory(), cfg.metricsFile).getAbsolutePath();
    metricsFileWriter = new MetricsFileWriter(Duration.ofSeconds(cfg.reportingInterval), metricsFileName, metricsManager);
    startContext.async(scheduler.submitActor(metricsFileWriter, SchedulingHints.isIoBound(0)));
}
Also used : ActorScheduler(io.zeebe.util.sched.ActorScheduler) MetricsManager(io.zeebe.util.metrics.MetricsManager) File(java.io.File)

Aggregations

MetricsManager (io.zeebe.util.metrics.MetricsManager)2 IncidentEventWriter (io.zeebe.broker.incident.IncidentEventWriter)1 ActorScheduler (io.zeebe.util.sched.ActorScheduler)1 File (java.io.File)1