ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] daradurvs commented on a change in pull request #6546: IGNITE-11848: New Monitoring. Phase1
Date Thu, 06 Jun 2019 20:05:26 GMT
daradurvs commented on a change in pull request #6546: IGNITE-11848: New Monitoring. Phase1
URL: https://github.com/apache/ignite/pull/6546#discussion_r291347989
 
 

 ##########
 File path: modules/opencensus/src/main/java/org/apache/ignite/internal/processors/monitoring/opencensus/OpenCensusMetricExporterSpi.java
 ##########
 @@ -0,0 +1,279 @@
+/*
+ * 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.ignite.internal.processors.monitoring.opencensus;
+
+import io.opencensus.common.Scope;
+import io.opencensus.stats.Aggregation.LastValue;
+import io.opencensus.stats.Measure;
+import io.opencensus.stats.Measure.MeasureDouble;
+import io.opencensus.stats.Measure.MeasureLong;
+import io.opencensus.stats.MeasureMap;
+import io.opencensus.stats.Stats;
+import io.opencensus.stats.StatsRecorder;
+import io.opencensus.stats.View;
+import io.opencensus.stats.View.Name;
+import io.opencensus.tags.TagContextBuilder;
+import io.opencensus.tags.TagKey;
+import io.opencensus.tags.TagValue;
+import io.opencensus.tags.Tags;
+import java.time.OffsetDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter;
+import org.apache.ignite.spi.IgniteSpiContext;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.metric.BooleanMetric;
+import org.apache.ignite.spi.metric.DoubleMetric;
+import org.apache.ignite.spi.metric.IntMetric;
+import org.apache.ignite.spi.metric.LongMetric;
+import org.apache.ignite.spi.metric.Metric;
+import org.apache.ignite.internal.processors.metric.MetricRegistry;
+import org.apache.ignite.spi.metric.ObjectMetric;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * <a href="https://opencensus.io">OpenCensus</a> monitoring exporter. <br>
+ * <br>
+ * This class will export all Ignite metrics with the OpenCensus API.<br>
+ * <br>
+ * Please, note, metrics recorded with the OpenCensus API each {@link #period} milliseconds.
+ * <br>
+ * To enable export from OpenCensus to the wild user should configure OpenCensus exporter.
+ * Please, see <a href="https://opencensus.io/exporters/supported-exporters/java/">OpenCensus
documentation</a> for additional information.
+ *
+ * Example of exporter configuration:
+ * <pre>
+ * {@code
+ *   PrometheusStatsCollector.createAndRegister();
+ *
+ *   HTTPServer server = new HTTPServer("localhost", 8888, true);
+ * }
+ * </pre>
+ *
+ * @see MetricRegistry
+ */
+public class OpenCensusMetricExporterSpi extends PushMetricsExporterAdapter {
+    /** Flag to enable or disable tag with Ignite instance name. */
+    private boolean sendInstanceName;
+
+    /** Flag to enable or disable tag with Node id. */
+    private boolean sendNodeId;
+
+    /** Flag to enable or disable tag with Consistent id. */
+    private boolean sendConsistentId;
+
+    /** Ignite instance name. */
+    public static final TagKey INSTANCE_NAME_TAG = TagKey.create("iin");
+
+    /** Ignite node id. */
+    public static final TagKey NODE_ID_TAG = TagKey.create("ini");
+
+    /** Ignite node consistent id. */
+    public static final TagKey CONSISTENT_ID_TAG = TagKey.create("inci");
+
+    /** Ignite instance name in the form of {@link TagValue}. */
+    private TagValue instanceNameValue;
+
+    /** Ignite node id in the form of {@link TagValue}. */
+    private TagValue nodeIdValue;
+
+    /** Ignite consistent id in the form of {@link TagValue}. */
+    private TagValue consistenIdValue;
+
+    /**
+     * Tags that will be exported with each measure
+     *
+     * @see #sendInstanceName
+     * @see #sendNodeId
+     */
+    private List<TagKey> tags = new ArrayList<>();
+
+    /**
+     * Opencensus measures.
+     * Values obtained from Ignite recorded to them.
+     */
+    private Map<String, Measure> measures = new HashMap<>();
+
+    /** */
+    private static Function<Metric, Measure> CREATE_LONG = m ->
+        MeasureLong.create(m.name(), m.description(), "");
+
+    /** */
+    private static Function<Metric, Measure> CREATE_DOUBLE = m ->
 
 Review comment:
   CREATE_DOUBLE -> createDoubleF

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message