[ 
https://issues.apache.org/jira/browse/GOBBLIN-1168?focusedWorklogId=439128&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-439128
 ]

ASF GitHub Bot logged work on GOBBLIN-1168:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/May/20 18:55
            Start Date: 30/May/20 18:55
    Worklog Time Spent: 10m 
      Work Description: arjun4084346 commented on a change in pull request 
#3001:
URL: https://github.com/apache/incubator-gobblin/pull/3001#discussion_r432878609



##########
File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/InstrumentedSpecStore.java
##########
@@ -0,0 +1,171 @@
+/*
+ * 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.gobblin.runtime.api;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
+
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Timer;
+import com.google.common.base.Optional;
+import com.typesafe.config.Config;
+
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.instrumented.Instrumented;
+import org.apache.gobblin.metrics.GobblinMetrics;
+import org.apache.gobblin.metrics.MetricContext;
+import org.apache.gobblin.metrics.ServiceMetricNames;
+import org.apache.gobblin.util.ConfigUtils;
+
+
+/**
+ * Instrumented version of {@link SpecStore} automatically capturing certain 
metrics.
+ * Subclasses should implement addSpecImpl instead of addSpec and so on.
+ */
+public abstract class InstrumentedSpecStore implements SpecStore {
+  private Optional<Timer> getTimer;
+  private Optional<Timer> existsTimer;
+  private Optional<Timer> deleteTimer;
+  private Optional<Timer> addTimer;
+  private Optional<Timer> updateTimer;
+  private Optional<Timer> getAllTimer;
+  private Optional<Timer> getURIsTimer;
+  private MetricContext metricContext;
+  private final boolean instrumentationEnabled;
+
+  public InstrumentedSpecStore(Config config, SpecSerDe specSerDe) {
+    this.instrumentationEnabled = GobblinMetrics.isEnabled(new 
State(ConfigUtils.configToProperties(config)));

Review comment:
       default is enabled




----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 439128)
    Time Spent: 40m  (was: 0.5h)

> create InstrumentedSpecStore
> ----------------------------
>
>                 Key: GOBBLIN-1168
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1168
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> create InstrumentedSpecStore to add metrics in all SpecStore implementations



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to