Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/655#discussion_r71027088
  
    --- Diff: 
nifi-nar-bundles/nifi-datadog-bundle/nifi-datadog-reporting-task/src/main/java/org/apache/nifi/reporting/datadog/DataDogReportingTask.java
 ---
    @@ -0,0 +1,185 @@
    +package org.apache.nifi.reporting.datadog;
    +
    +
    +import com.codahale.metrics.Gauge;
    +import com.codahale.metrics.MetricRegistry;
    +import com.google.common.base.Optional;
    +import com.google.common.util.concurrent.AtomicDouble;
    +import com.yammer.metrics.core.VirtualMachineMetrics;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnScheduled;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.controller.ConfigurationContext;
    +import org.apache.nifi.controller.status.ProcessGroupStatus;
    +import org.apache.nifi.controller.status.ProcessorStatus;
    +import org.apache.nifi.processor.util.StandardValidators;
    +import org.apache.nifi.reporting.AbstractReportingTask;
    +import org.apache.nifi.reporting.ReportingContext;
    +import org.apache.nifi.reporting.datadog.metrics.MetricsService;
    +import org.coursera.metrics.datadog.DynamicTagsCallback;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.Arrays;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.concurrent.ConcurrentHashMap;
    +
    +@Tags({"reporting", "datadog", "metrics"})
    +@CapabilityDescription("Publishes metrics from NiFi to datadog")
    +public class DataDogReportingTask extends AbstractReportingTask {
    +
    +    //the amount of time between polls
    +    static final PropertyDescriptor REPORTING_PERIOD = new 
PropertyDescriptor.Builder()
    +            .name("DataDog reporting period")
    +            .description("The amount of time in seconds between polls")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .defaultValue("10")
    +            .addValidator(StandardValidators.LONG_VALIDATOR)
    +            .build();
    +
    +    static final PropertyDescriptor METRICS_PREFIX = new 
PropertyDescriptor.Builder()
    +            .name("Metrics prefix")
    +            .description("Prefix to be added before every metric")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .defaultValue("nifi")
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    static final PropertyDescriptor ENVIRONMENT = new 
PropertyDescriptor.Builder()
    +            .name("Environment")
    +            .description("Environment, dataflow is running in. " +
    +                    "This property will be included as metrics tag.")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .defaultValue("dev")
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    private MetricsService metricsService;
    +    private DDMetricRegistryBuilder ddMetricRegistryBuilder;
    +    private MetricRegistry metricRegistry;
    +    private String metricsPrefix;
    +    private String environment;
    +    private String statusId;
    +    private ConcurrentHashMap<String, AtomicDouble> metricsMap;
    +    private volatile VirtualMachineMetrics virtualMachineMetrics;
    +    private Logger logger = LoggerFactory.getLogger(getClass().getName());
    --- End diff --
    
    The framework provides a logger to use with the "getLogger()" method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to