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

    https://github.com/apache/nifi/pull/655#discussion_r72342803
  
    --- Diff: 
nifi-nar-bundles/nifi-datadog-bundle/nifi-datadog-reporting-task/src/main/java/org/apache/nifi/reporting/datadog/DataDogReportingTask.java
 ---
    @@ -0,0 +1,223 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +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.AllowableValue;
    +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 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 {
    +
    +    static final AllowableValue DATADOG_AGENT = new 
AllowableValue("DataDog Agent", "DataDog UDP Agent",
    +            "Metrics will be sent via locally installed DataDog agent over 
UDP");
    +
    +    static final AllowableValue DATADOG_HTTP = new AllowableValue("Datadog 
HTTP", "Datadog HTTP",
    +            "Metrics will be sent via HTTP transport with no need of Agent 
installed. " +
    +                    "DataDog API key needs to be set");
    +
    +    static final PropertyDescriptor DATADOG_TRANSPORT = new 
PropertyDescriptor.Builder()
    +            .name("DataDog transport")
    +            .description("Transport through which metrics will be sent to 
DataDog")
    +            .required(true)
    +            .allowableValues(DATADOG_AGENT, DATADOG_HTTP)
    +            .defaultValue(DATADOG_AGENT.getValue())
    +            .build();
    +
    +    static final PropertyDescriptor API_KEY = new 
PropertyDescriptor.Builder()
    +            .name("API key")
    +            .description("DataDog API key. If specified value is 'agent', 
local DataDog agent will be used.")
    +            .expressionLanguageSupported(false)
    +            .required(false)
    +            .addValidator(StandardValidators.NON_EMPTY_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)
    --- End diff --
    
    Kinda contrary to a previous comment, I'd suggest making this support EL 
(and then adding back in the evaluation). This is because with EL it allows the 
user to access environment variables which may be of use. Sorry about that.
    
    This should probably also be done to METRICS_PREFIX.


---
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