Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#isMetricsEnabled()

The following examples show how to use org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#isMetricsEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetricsDecisionEvaluationListener.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void notify(DmnDecisionEvaluationEvent evaluationEvent) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  if (processEngineConfiguration != null && processEngineConfiguration.isMetricsEnabled()) {
    MetricsRegistry metricsRegistry = processEngineConfiguration.getMetricsRegistry();
    metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_INSTANCES,
                                   evaluationEvent.getExecutedDecisionInstances());
    metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_ELEMENTS,
                                   evaluationEvent.getExecutedDecisionElements());
  }
}
 
Example 2
Source File: ReportDbMetricsCmd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public Void execute(CommandContext commandContext) {
  ProcessEngineConfigurationImpl engineConfiguration = Context.getProcessEngineConfiguration();

  if (!engineConfiguration.isMetricsEnabled()) {
    throw new ProcessEngineException("Metrics reporting is disabled");
  }

  if (!engineConfiguration.isDbMetricsReporterActivate()) {
    throw new ProcessEngineException("Metrics reporting to database is disabled");
  }

  DbMetricsReporter dbMetricsReporter = engineConfiguration.getDbMetricsReporter();
  dbMetricsReporter.reportNow();
  return null;
}
 
Example 3
Source File: TaskEntity.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void executeMetrics(String metricsName) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
  if(processEngineConfiguration.isMetricsEnabled()) {
    processEngineConfiguration.getMetricsRegistry().markOccurrence(Metrics.ACTIVTY_INSTANCE_START);
  }
}
 
Example 4
Source File: ProcessEngineImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ProcessEngineImpl(ProcessEngineConfigurationImpl processEngineConfiguration) {

    this.processEngineConfiguration = processEngineConfiguration;
    this.name = processEngineConfiguration.getProcessEngineName();

    this.repositoryService = processEngineConfiguration.getRepositoryService();
    this.runtimeService = processEngineConfiguration.getRuntimeService();
    this.historicDataService = processEngineConfiguration.getHistoryService();
    this.identityService = processEngineConfiguration.getIdentityService();
    this.taskService = processEngineConfiguration.getTaskService();
    this.formService = processEngineConfiguration.getFormService();
    this.managementService = processEngineConfiguration.getManagementService();
    this.authorizationService = processEngineConfiguration.getAuthorizationService();
    this.caseService = processEngineConfiguration.getCaseService();
    this.filterService = processEngineConfiguration.getFilterService();
    this.externalTaskService = processEngineConfiguration.getExternalTaskService();
    this.decisionService = processEngineConfiguration.getDecisionService();

    this.databaseSchemaUpdate = processEngineConfiguration.getDatabaseSchemaUpdate();
    this.jobExecutor = processEngineConfiguration.getJobExecutor();
    this.commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
    commandExecutorSchemaOperations = processEngineConfiguration.getCommandExecutorSchemaOperations();
    this.sessionFactories = processEngineConfiguration.getSessionFactories();
    this.historyLevel = processEngineConfiguration.getHistoryLevel();
    this.transactionContextFactory = processEngineConfiguration.getTransactionContextFactory();

    executeSchemaOperations();

    if (name == null) {
      LOG.processEngineCreated(ProcessEngines.NAME_DEFAULT);
    } else {
      LOG.processEngineCreated(name);
    }

    ProcessEngines.registerProcessEngine(this);

    if ((jobExecutor != null)) {
      // register process engine with Job Executor
      jobExecutor.registerProcessEngine(this);
    }

    if (processEngineConfiguration.isMetricsEnabled()) {
      String reporterId;
      // only use a deprecated, custom MetricsReporterIdProvider,
      // if no static hostname AND custom HostnameProvider are set.
      // See ProcessEngineConfigurationImpl#initHostname()
      if (processEngineConfiguration.getMetricsReporterIdProvider() != null
          && processEngineConfiguration.getHostnameProvider() instanceof SimpleIpBasedProvider) {
        reporterId = processEngineConfiguration.getMetricsReporterIdProvider().provideId(this);
      } else {
        reporterId = processEngineConfiguration.getHostname();;
      }

      DbMetricsReporter dbMetricsReporter = processEngineConfiguration.getDbMetricsReporter();
      dbMetricsReporter.setReporterId(reporterId);

      if(processEngineConfiguration.isDbMetricsReporterActivate()) {
        dbMetricsReporter.start();
      }
    }
  }