You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/05/28 17:58:28 UTC

[GitHub] [lucene-solr] dgarson commented on a change in pull request #685: SOLR-13434: OpenTracing support for Solr

dgarson commented on a change in pull request #685: SOLR-13434: OpenTracing support for Solr
URL: https://github.com/apache/lucene-solr/pull/685#discussion_r288230479
 
 

 ##########
 File path: solr/contrib/jaegertracer-configurator/src/java/org/apache/solr/jaeger/JaegerTracerConfigurator.java
 ##########
 @@ -0,0 +1,92 @@
+/*
+ * 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.solr.jaeger;
+
+import io.jaegertracing.Configuration;
+import io.jaegertracing.samplers.ConstSampler;
+import io.opentracing.Tracer;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.TracerConfigurator;
+
+import static org.apache.solr.common.SolrException.ErrorCode.SERVER_ERROR;
+
+public class JaegerTracerConfigurator extends TracerConfigurator {
+  public static final String AGENT_HOST = "agentHost";
+  public static final String AGENT_PORT = "agentPort";
+  public static final String LOG_SPANS = "logSpans";
+  public static final String FLUSH_INTERVAL = "flushInterval";
+  public static final String MAX_QUEUE_SIZE = "maxQueueSize";
+
+  private volatile Tracer tracer;
+
+  @Override
+  public Tracer getTracer() {
+    return tracer;
+  }
+
+  @Override
+  public void init(NamedList args) {
+    Object host = args.get(AGENT_HOST);
+    if (!(host instanceof String)) {
+      throw new IllegalArgumentException("Expected a required string for param '" + AGENT_HOST + "'");
+    }
+
+    Object portArg = args.get(AGENT_PORT);
+    if (!(portArg instanceof Integer)) {
+      throw new IllegalArgumentException("Expected a required int for param '" + AGENT_PORT + "'");
+    }
+    int port = (Integer) portArg;
+
+    Boolean logSpans = args.getBooleanArg(LOG_SPANS);
+    if (logSpans == null)
+      logSpans = true;
+
+    Object flushIntervalArg = args.get(FLUSH_INTERVAL);
+    if (flushIntervalArg != null && !(flushIntervalArg instanceof Integer)) {
+      throw new IllegalArgumentException("Expected a required int for param '" + FLUSH_INTERVAL +"'");
+    }
+    int flushInterval = flushIntervalArg == null ? 5000 : (Integer) flushIntervalArg;
 
 Review comment:
   Should the default flush interval be shorter? With the current defaults, Solr requests are limited to 2000 RPS before trace data will start being dropped. Of course, the person configuring Solr could set values instead of using the defaults for use cases requiring above 2000 RPS, but flushing every 1 second (or maybe even more frequently, like half a second) seems fairly safe as well.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org