【问题标题】:How to enable WSO2 Carbon metrics in Siddhi extensions如何在 Siddhi 扩展中启用 WSO2 Carbon 指标
【发布时间】:2023-02-10 17:26:28
【问题描述】:

在运行为扩展编写的测试用例时,我可以知道如何在 Siddhi 扩展中启用 WSO2 碳指标吗?当前,在运行测试用例时,不会返回指标。

需要知道如何使以下条件为真

if (MetricsDataHolder.getInstance().getMetricService() != null
                && MetricsDataHolder.getInstance().getMetricManagementService().isEnabled()) {
            try {
                if (MetricsDataHolder.getInstance().getMetricManagementService()
                        .isReporterRunning(SourceConstants.PROMETHEUS_REPORTER_NAME)) {

【问题讨论】:

    标签: wso2 metrics siddhi


    【解决方案1】:

    您可以按照此 [1] 文档在 Streaming 集成器中启用矩阵,这会在所有受支持的扩展上启用报告功能。

    如果只需要将metrics存入数据库,则在deployment.yaml文件中添加如下配置

     # This is the main configuration for metrics
    wso2.metrics:
      # Enable Metrics
      enabled: true
      reporting:
        console:
          - # The name for the Console Reporter
            name: Console
    
            # Enable Console Reporter
            enabled: false
    
            # Polling Period in seconds.
            # This is the period for polling metrics from the metric registry and printing in the console
            pollingPeriod: 5
    
    wso2.metrics.jdbc:
      # Data Source Configurations for JDBC Reporters
      dataSource:
        # Default Data Source Configuration
        - &JDBC01
          # JNDI name of the data source to be used by the JDBC Reporter.
          # This data source should be defined under the "wso2.datasources"
          dataSourceName: java:comp/env/jdbc/WSO2MetricsDB
          # Schedule regular deletion of metrics data older than a set number of days.
          # It is recommended that you enable this job to ensure your metrics tables do not get extremely large.
          # Deleting data older than seven days should be sufficient.
          scheduledCleanup:
            # Enable scheduled cleanup to delete Metrics data in the database.
            enabled: true
    
            # The scheduled job will cleanup all data older than the specified days
            daysToKeep: 3
    
            # This is the period for each cleanup operation in seconds.
            scheduledCleanupPeriod: 86400
    
      # The JDBC Reporter is in the Metrics JDBC Core feature
      reporting:
        # The JDBC Reporter configurations will be ignored if the Metrics JDBC Core feature is not available in runtime
        jdbc:
          - # The name for the JDBC Reporter
            name: JDBC
    
            # Enable JDBC Reporter
            enabled: true
    
            # Source of Metrics, which will be used to identify each metric in database -->
            # Commented to use the hostname by default
            # source: Carbon
    
            # Alias referring to the Data Source configuration
            dataSource: *JDBC01
    
            # Polling Period in seconds.
            # This is the period for polling metrics from the metric registry and updating the database with the values
            pollingPeriod: 60
    

    [1] https://apim.docs.wso2.com/en/4.0.0/observe/streaming-integrator/setting-up-si-statistics-dashboards/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-17
      • 2017-10-18
      相关资源
      最近更新 更多