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();
}
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)));
}
Aggregations