[ 
https://issues.apache.org/jira/browse/NIFI-4392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16195880#comment-16195880
 ] 

ASF GitHub Bot commented on NIFI-4392:
--------------------------------------

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

    https://github.com/apache/nifi/pull/2171#discussion_r143339228
  
    --- Diff: 
nifi-nar-bundles/nifi-metrics-reporting-bundle/nifi-metrics-reporting-task/src/main/java/org/apache/nifi/metrics/reporting/reporter/service/GraphiteMetricReporterService.java
 ---
    @@ -0,0 +1,180 @@
    +/*
    + * 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.metrics.reporting.reporter.service;
    +
    +import com.codahale.metrics.MetricRegistry;
    +import com.codahale.metrics.ScheduledReporter;
    +import com.codahale.metrics.graphite.Graphite;
    +import com.codahale.metrics.graphite.GraphiteReporter;
    +import com.codahale.metrics.graphite.GraphiteSender;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnDisabled;
    +import org.apache.nifi.annotation.lifecycle.OnEnabled;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.controller.AbstractControllerService;
    +import org.apache.nifi.controller.ConfigurationContext;
    +import org.apache.nifi.metrics.reporting.task.MetricsReportingTask;
    +import org.apache.nifi.processor.util.StandardValidators;
    +
    +import javax.net.SocketFactory;
    +import java.io.IOException;
    +import java.nio.charset.Charset;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.List;
    +
    +/**
    + * A controller service that provides metric reporters for graphite, can 
be used by {@link MetricsReportingTask}.
    + *
    + * @author Omer Hadari
    + */
    +@Tags({"metrics", "reporting", "graphite"})
    +@CapabilityDescription("A controller service that provides metric 
reporters for graphite. " +
    +        "Used by MetricsReportingTask.")
    +public class GraphiteMetricReporterService extends 
AbstractControllerService implements MetricReporterService {
    +
    +    /**
    +     * Points to the hostname of the graphite listener.
    +     */
    +    public static final PropertyDescriptor HOST = new 
PropertyDescriptor.Builder()
    +            .name("host")
    +            .displayName("Host")
    +            .description("The hostname of the carbon listener")
    +            .required(true)
    +            .addValidator(StandardValidators.URI_VALIDATOR)
    +            .expressionLanguageSupported(true)
    +            .build();
    +
    +    /**
    +     * Points to the port on which the graphite server listens.
    +     */
    +    public static final PropertyDescriptor PORT = new 
PropertyDescriptor.Builder()
    +            .name("port")
    +            .displayName("Port")
    +            .description("The port on which carbon listens")
    +            .required(true)
    +            .addValidator(StandardValidators.PORT_VALIDATOR)
    +            .expressionLanguageSupported(true)
    +            .build();
    +
    +    /**
    +     * Points to the charset name that the graphite server expects.
    +     */
    +    public static final PropertyDescriptor CHARSET = new 
PropertyDescriptor.Builder()
    +            .name("charset")
    +            .displayName("Charset")
    +            .description("The charset used by the graphite server")
    +            .required(true)
    +            .defaultValue("UTF-8")
    +            .addValidator(StandardValidators.CHARACTER_SET_VALIDATOR)
    +            .expressionLanguageSupported(true)
    +            .build();
    +
    +    /**
    +     * Prefix for all metric names sent by reporters - for separation of 
NiFi stats in graphite.
    +     */
    +    protected static final PropertyDescriptor METRIC_NAME_PREFIX = new 
PropertyDescriptor.Builder()
    +            .name("metric name prefix")
    +            .displayName("Metric Name Prefix")
    +            .description("A prefix that will be used for all metric names 
sent by reporters provided by this service.")
    +            .required(true)
    +            .defaultValue("nifi")
    +            .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
    +            .expressionLanguageSupported(true)
    +            .build();
    +
    +    /**
    +     * List of property descriptors used by the service.
    +     */
    +    private static final List<PropertyDescriptor> properties;
    +
    +    static {
    +        final List<PropertyDescriptor> props = new ArrayList<>();
    +        props.add(HOST);
    +        props.add(PORT);
    +        props.add(CHARSET);
    +        properties = Collections.unmodifiableList(props);
    --- End diff --
    
    Need to add METRIC_NAME_PREFIX to this list


> Create graphite reporting task
> ------------------------------
>
>                 Key: NIFI-4392
>                 URL: https://issues.apache.org/jira/browse/NIFI-4392
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>            Reporter: Omer Hadari
>            Priority: Minor
>              Labels: features
>
> Create a reporting task for graphite, similar to that of datadog and ambari.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to