diff --git a/pom.xml b/pom.xml
index fd4dee50a..b06475f24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,11 +83,6 @@
-
- com.datadoghq
- java-dogstatsd-client
- 4.0.0
-
org.igniterealtime.smack
smack-extensions
diff --git a/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java b/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java
index e14536d4c..64167b84d 100644
--- a/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java
+++ b/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java
@@ -17,7 +17,6 @@
*/
package org.jitsi.jigasi;
-import com.timgroup.statsd.*;
import net.java.sip.communicator.util.osgi.*;
import org.jitsi.meet.*;
import org.jitsi.utils.logging.Logger;
@@ -173,16 +172,6 @@ public static boolean isSipStartMutedEnabled()
.getBoolean(P_NAME_ENABLE_SIP_STARTMUTED, ENABLE_SIP_STARTMUTED_DEFAULT_VALUE);
}
- /**
- * Returns a {@link StatsDClient} instance to push statistics to datadog
- *
- * @return the {@link StatsDClient}
- */
- public static StatsDClient getDataDogClient()
- {
- return ServiceUtils.getService(osgiContext, StatsDClient.class);
- }
-
public JigasiBundleActivator()
{
super(ConfigurationService.class);
diff --git a/src/main/java/org/jitsi/jigasi/Main.java b/src/main/java/org/jitsi/jigasi/Main.java
index de48a96dd..ae7f31d80 100644
--- a/src/main/java/org/jitsi/jigasi/Main.java
+++ b/src/main/java/org/jitsi/jigasi/Main.java
@@ -41,7 +41,6 @@
import org.apache.commons.lang3.*;
import org.jitsi.cmd.*;
import org.jitsi.impl.osgi.framework.launch.*;
-import org.jitsi.jigasi.ddclient.*;
import org.jitsi.jigasi.osgi.*;
import org.jitsi.jigasi.rest.*;
import org.jitsi.jigasi.version.*;
@@ -337,8 +336,7 @@ public static Framework start(List> protocols)
JigasiBundleActivator.class,
RESTBundleActivator.class,
TranscriptServerBundleActivator.class,
- CallControlMucActivator.class,
- DdClientActivator.class
+ CallControlMucActivator.class
));
var options = new HashMap();
options.put(Constants.FRAMEWORK_BEGINNING_STARTLEVEL, "3");
diff --git a/src/main/java/org/jitsi/jigasi/ddclient/DdClientActivator.java b/src/main/java/org/jitsi/jigasi/ddclient/DdClientActivator.java
deleted file mode 100644
index 91fc2feb6..000000000
--- a/src/main/java/org/jitsi/jigasi/ddclient/DdClientActivator.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright @ 2018 - present, 8x8 Inc
- *
- * Licensed 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.jitsi.jigasi.ddclient;
-
-import com.timgroup.statsd.*;
-import net.java.sip.communicator.util.osgi.*;
-import org.jitsi.service.configuration.*;
-import org.jitsi.utils.*;
-import org.osgi.framework.*;
-
-/**
- * Actives a {@link StatsDClient} as an OSGi service
- *
- * @author Nik Vaessen
- */
-public class DdClientActivator
- implements BundleActivator
-{
-
- /**
- * The property for the prefix of for the {@link StatsDClient}
- * instance managed by this {@link DdClientActivator}.
- */
- public static final String DDCLIENT_PREFIX_PNAME
- = "org.jitsi.ddclient.prefix";
-
- /**
- * The property for the host of for the {@link StatsDClient}
- * instance managed by this {@link DdClientActivator}.
- */
- public static final String DDCLIENT_HOST_PNAME = "org.jitsi.ddclient.host";
-
- /**
- * The property for the port of for the {@link StatsDClient}
- * instance managed by this {@link DdClientActivator}.
- */
- public static final String DDCLIENT_PORT_PNAME = "org.jitsi.ddclient.port";
-
- /**
- * The default prefix. When this prefix is used, this {@link
- * DdClientActivator} will NOT register the client and instead abort
- */
- private static final String DEFAULT_PREFIX = "";
-
- /**
- * The default hostname of the DataDog server to connect to
- */
- private static final String DEFAULT_HOST = "localhost";
-
- /**
- * The default port of the DataDog server to connect to
- */
- private static final int DEFAULT_PORT = 8125;
-
- /**
- * The {@link StatsDClient} managed by this {@link BundleActivator}
- */
- private StatsDClient client;
-
- /**
- * Registers the DataDogStatsClient
- */
- private ServiceRegistration serviceRegistration;
-
- /**
- * The {@code ConfigurationService} which looks up values of configuration
- * properties.
- */
- protected ConfigurationService cfg;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context)
- throws Exception
- {
- if (client != null)
- {
- return;
- }
-
- cfg = ServiceUtils.getService(context, ConfigurationService.class);
-
- String prefix = ConfigUtils.getString(cfg,
- DDCLIENT_PREFIX_PNAME, DEFAULT_PREFIX);
-
- if (prefix.isEmpty())
- {
- return;
- }
-
- String host = ConfigUtils.getString(cfg,
- DDCLIENT_HOST_PNAME, DEFAULT_HOST);
- int port = ConfigUtils.getInt(cfg,
- DDCLIENT_PORT_PNAME, DEFAULT_PORT);
-
- client = new NonBlockingStatsDClientBuilder()
- .prefix(prefix)
- .hostname(host)
- .port(port)
- .build();
-
- serviceRegistration
- = context.registerService(StatsDClient.class, client, null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context)
- throws Exception
- {
- if (serviceRegistration != null)
- {
- serviceRegistration.unregister();
- serviceRegistration = null;
- }
-
- if (client != null)
- {
- client.stop();
- client = null;
- }
- }
-}
diff --git a/src/main/java/org/jitsi/jigasi/stats/Statistics.java b/src/main/java/org/jitsi/jigasi/stats/Statistics.java
index fbfa6d419..b99babee6 100644
--- a/src/main/java/org/jitsi/jigasi/stats/Statistics.java
+++ b/src/main/java/org/jitsi/jigasi/stats/Statistics.java
@@ -109,6 +109,51 @@ public class Statistics
*/
public static final String TOTAL_CALLS_NO_HEARTBEAT = "total_calls_no_heartbeat_response";
+ /**
+ * The name of the number of started transcriptions.
+ */
+ public static final String TOTAL_TRANSCRIBER_STARTED = "total_transcriber_started";
+
+ /**
+ * The name of the number of stopped transcriptions.
+ */
+ public static final String TOTAL_TRANSCRIBER_STOPPED = "total_transcriber_stopped";
+
+ /**
+ * The name of the number of failed transcriptions.
+ */
+ public static final String TOTAL_TRANSCRIBER_FAILED = "total_transcriber_failed";
+
+ /**
+ * The total number of minute intervals submitted to the Google API for transcription.
+ */
+ public static final String TOTAL_TRANSCRIBER_G_MINUTES = "total_transcriber_g_minutes";
+
+ /**
+ * The total number of requests submitted to the Google Cloud Speech API.
+ */
+ public static final String TOTAL_TRANSCRIBER_G_REQUESTS = "total_transcriber_g_requests";
+
+ /**
+ * The total number of connection errors for the transcriber.
+ */
+ public static final String TOTAL_TRANSCRIBER_CONNECTION_ERRORS = "total_transcriber_connection_errors";
+
+ /**
+ * The total number of no result errors for the transcriber.
+ */
+ public static final String TOTAL_TRANSCRIBER_NO_RESUL_ERRORS = "total_transcriber_no_result_errors";
+
+ /**
+ * The total number of send errors for the transcriber.
+ */
+ public static final String TOTAL_TRANSCRIBER_SEND_ERRORS = "total_transcriber_send_errors";
+
+ /**
+ * The total number of session creation errors for the transcriber.
+ */
+ public static final String TOTAL_TRANSCRIBER_SESSION_CREATION_ERRORS = "total_transcriber_session_creation_errors";
+
/**
* The name of the property that holds the normalizing constant that is used to reduce the number of
* current conferences to a stress level metric {@link #CONFERENCES_THRESHOLD}.
@@ -209,6 +254,69 @@ public class Statistics
TOTAL_CALLS_NO_HEARTBEAT,
"Total number of calls dropped due to no response to sip heartbeat.");
+ /**
+ * Total number of transcriptions started.
+ */
+ private static CounterMetric totalTrasnscriberStarted = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_STARTED,
+ "Total number of started transcriptions.");
+
+ /**
+ * Total number of transcriptions stopped.
+ */
+ private static CounterMetric totalTrasnscriberStopped = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_STOPPED,
+ "Total number of stopped transcriptions.");
+
+ /**
+ * Total number of transcriptions failures.
+ */
+ private static CounterMetric totalTrasnscriberFailed = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_FAILED,
+ "Total number of failed transcriptions.");
+
+ /**
+ * Total number of transcriptions connection errors.
+ */
+ private static CounterMetric totalTrasnscriberConnectionErrors = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_CONNECTION_ERRORS,
+ "Total number of transcriber connection errors.");
+
+ /**
+ * Total number of transcriptions no result errors.
+ */
+ private static CounterMetric totalTrasnscriberNoResultErrors = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_NO_RESUL_ERRORS,
+ "Total number of transcriber no result errors.");
+
+ /**
+ * Total number of transcriptions send errors.
+ */
+ private static CounterMetric totalTrasnscriberSendErrors = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_SEND_ERRORS,
+ "Total number of transcriber send errors.");
+
+ /**
+ * Total number of transcriptions session creation errors.
+ */
+ private static CounterMetric totalTrasnscriberSessionCreationErrors
+ = JigasiMetricsContainer.INSTANCE.registerCounter(TOTAL_TRANSCRIBER_SESSION_CREATION_ERRORS,
+ "Total number of transcriber session creation errors.");
+
+ /**
+ * The total number of 15 second intervals submitted to the Google API for transcription.
+ */
+ private static LongGaugeMetric totalTranscriberMinutes = JigasiMetricsContainer.INSTANCE.registerLongGauge(
+ TOTAL_TRANSCRIBER_G_MINUTES,
+ "Total number of minute intervals.");
+
+ /**
+ * The total number of requests submitted to the Google Cloud Speech API.
+ */
+ private static CounterMetric totalTrasnscriberRequests = JigasiMetricsContainer.INSTANCE.registerCounter(
+ TOTAL_TRANSCRIBER_G_REQUESTS,
+ "Total number of transcriber requests.");
+
/**
* Cumulative number of seconds of all conferences.
*/
@@ -297,6 +405,18 @@ public static synchronized void sendJSON(
stats.put(TOTAL_CALLS_JVB_NO_MEDIA, totalCallsJvbNoMedia.get());
stats.put(TOTAL_CALLS_NO_HEARTBEAT, totalCallsWithNoHeartBeatResponse.get());
+ stats.put(TOTAL_TRANSCRIBER_G_REQUESTS, totalTrasnscriberRequests.get());
+ stats.put(TOTAL_TRANSCRIBER_G_MINUTES, totalTranscriberMinutes.get());
+
+ stats.put(TOTAL_TRANSCRIBER_STARTED, totalTrasnscriberStarted.get());
+ stats.put(TOTAL_TRANSCRIBER_STOPPED, totalTrasnscriberStopped.get());
+ stats.put(TOTAL_TRANSCRIBER_FAILED, totalTrasnscriberFailed.get());
+
+ stats.put(TOTAL_TRANSCRIBER_CONNECTION_ERRORS, totalTrasnscriberConnectionErrors.get());
+ stats.put(TOTAL_TRANSCRIBER_NO_RESUL_ERRORS, totalTrasnscriberNoResultErrors.get());
+ stats.put(TOTAL_TRANSCRIBER_SEND_ERRORS, totalTrasnscriberSendErrors.get());
+ stats.put(TOTAL_TRANSCRIBER_SESSION_CREATION_ERRORS, totalTrasnscriberSessionCreationErrors.get());
+
stats.put(SHUTDOWN_IN_PROGRESS, shutdownMetric.get());
response.setStatus(HttpServletResponse.SC_OK);
@@ -484,6 +604,78 @@ public static void incrementTotalCallsWithNoSipHeartbeat()
totalCallsWithNoHeartBeatResponse.inc();
}
+ /**
+ * Increment the value of total number of transcriber started.
+ */
+ public static void incrementTotalTranscriberStarted()
+ {
+ totalTrasnscriberStarted.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber stopped.
+ */
+ public static void incrementTotalTranscriberSopped()
+ {
+ totalTrasnscriberStopped.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber failes.
+ */
+ public static void incrementTotalTranscriberFailed()
+ {
+ totalTrasnscriberFailed.inc();
+ }
+
+ /**
+ * Increment the value of total number of minute transcriber intervals.
+ */
+ public static void incrementTotalTranscriberMinutes(long value)
+ {
+ totalTranscriberMinutes.addAndGet(value);
+ }
+
+ /**
+ * Increment the value of total number of transcriber request.
+ */
+ public static void incrementTotalTranscriberRequests()
+ {
+ totalTrasnscriberRequests.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber connection errors.
+ */
+ public static void incrementTotalTranscriberConnectionErrors()
+ {
+ totalTrasnscriberConnectionErrors.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber no result errors.
+ */
+ public static void incrementTotalTranscriberNoResultErrors()
+ {
+ totalTrasnscriberNoResultErrors.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber send errors.
+ */
+ public static void incrementTotalTranscriberSendErrors()
+ {
+ totalTrasnscriberSendErrors.inc();
+ }
+
+ /**
+ * Increment the value of total number of transcriber session creation errors.
+ */
+ public static void incrementTotalTranscriberSessionCreationErrors()
+ {
+ totalTrasnscriberSessionCreationErrors.inc();
+ }
+
/**
* Adds the value to the number of total conference seconds.
* @param value the value to add to the number of total conference seconds.
diff --git a/src/main/java/org/jitsi/jigasi/transcription/AbstractTranscriptPublisher.java b/src/main/java/org/jitsi/jigasi/transcription/AbstractTranscriptPublisher.java
index 7b661fc00..b3bcfad85 100644
--- a/src/main/java/org/jitsi/jigasi/transcription/AbstractTranscriptPublisher.java
+++ b/src/main/java/org/jitsi/jigasi/transcription/AbstractTranscriptPublisher.java
@@ -17,7 +17,6 @@
*/
package org.jitsi.jigasi.transcription;
-import com.timgroup.statsd.*;
import net.java.sip.communicator.impl.protocol.jabber.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.Message;
@@ -845,46 +844,7 @@ private void maybeExecuteBashScripts()
logger.info("executing " + scriptPath +
" with arguments '" + absDirPath + "'");
- Process p = new ProcessBuilder(scriptPath.toString(),
- absDirPath.toString()).start();
-
- StatsDClient dClient
- = JigasiBundleActivator.getDataDogClient();
- if (dClient != null)
- {
- int returnValue;
-
- try
- {
- returnValue = p.waitFor();
- }
- catch (InterruptedException e)
- {
- logger.error("", e);
- returnValue = -1;
- }
-
- if (returnValue == 0)
- {
- dClient.increment(DD_ASPECT_SUCCESS);
- if (logger.isDebugEnabled())
- {
- logger.debug("thrown stat: " +
- DD_ASPECT_SUCCESS
- );
- }
- }
- else
- {
- dClient.increment(DD_ASPECT_FAIL);
- if (logger.isDebugEnabled())
- {
- logger.debug("thrown stat: " +
- DD_ASPECT_FAIL
- );
- }
- }
- }
+ new ProcessBuilder(scriptPath.toString(), absDirPath.toString()).start();
}
catch (IOException e)
{
diff --git a/src/main/java/org/jitsi/jigasi/transcription/GoogleCloudTranscriptionService.java b/src/main/java/org/jitsi/jigasi/transcription/GoogleCloudTranscriptionService.java
index 4c8d271bd..fc9bd4baa 100644
--- a/src/main/java/org/jitsi/jigasi/transcription/GoogleCloudTranscriptionService.java
+++ b/src/main/java/org/jitsi/jigasi/transcription/GoogleCloudTranscriptionService.java
@@ -22,8 +22,8 @@
import com.google.auth.oauth2.*;
import com.google.cloud.speech.v1.*;
import com.google.protobuf.*;
-import com.timgroup.statsd.*;
import org.jitsi.jigasi.*;
+import org.jitsi.jigasi.stats.*;
import org.jitsi.jigasi.transcription.action.*;
import org.jitsi.utils.logging.*;
@@ -201,6 +201,9 @@ private static void validateLanguageTag(String tag)
return;
}
}
+
+ Statistics.incrementTotalTranscriberConnectionErrors();
+
throw new UnsupportedOperationException(tag + " is not a language " +
"supported by the Google " +
"Cloud speech-to-text API");
@@ -353,6 +356,7 @@ public void sendSingleRequest(final TranscriptionRequest request,
}
catch (Exception e)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.error("Error sending single req", e);
}
}
@@ -442,6 +446,7 @@ private GoogleCloudStreamingRecognitionSession(String debugName)
}
catch(Exception e)
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
logger.error(debugName + ": error creating stream observer", e);
}
}
@@ -456,10 +461,12 @@ public void sendRequest(final TranscriptionRequest request)
}
catch(Exception e)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.warn(debugName + ": not able to send request", e);
}
});
- logger.trace(debugName + ": queued request");
+ if (logger.isTraceEnabled())
+ logger.trace(debugName + ": queued request");
}
@Override
@@ -481,6 +488,7 @@ public void end()
}
catch(Exception e)
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
logger.error(debugName + ": error ending session", e);
}
}
@@ -502,26 +510,7 @@ private static class GoogleCloudCostLogger
/**
* The length of a cost interval of the Google cloud speech-to-text API
*/
- private final static int INTERVAL_LENGTH_MS = 15000;
-
- /**
- * The aspect to log the information to about the total number of
- * 15 second intervals submitted to the Google API for transcription.
- */
- private final static String ASPECT_INTERVAL
- = "google_cloud_speech_15s_intervals";
-
- /**
- * The aspect to log the information to about the total number of
- * requests submitted to the Google Cloud Speec API.
- */
- private final static String ASPECT_TOTAL_REQUESTS
- = "google_cloud_speech_requests";
-
- /**
- * The client to send statistics to
- */
- private final StatsDClient client = JigasiBundleActivator.getDataDogClient();
+ private final static int INTERVAL_LENGTH_MS = 60000;
/**
* Extra string added to every log.
@@ -570,6 +559,7 @@ synchronized void increment(long ms)
synchronized void incrementRequestsCounter()
{
requestsCount += 1;
+ Statistics.incrementTotalTranscriberRequests();
}
/**
@@ -578,17 +568,13 @@ synchronized void incrementRequestsCounter()
*/
synchronized void sessionEnded()
{
- // round up to 15 second intervals
- int intervals15s = 1 + (int) (summedTime / INTERVAL_LENGTH_MS);
+ // round up to 60 second intervals
+ int intervals = 1 + (int) (summedTime / INTERVAL_LENGTH_MS);
- if (client != null)
- {
- client.count(ASPECT_INTERVAL, intervals15s);
- client.count(ASPECT_TOTAL_REQUESTS, requestsCount);
- }
+ Statistics.incrementTotalTranscriberMinutes(intervals);
logger.info(debugName + ": sent " + summedTime + "ms to speech API, " +
- "for a total of " + intervals15s + " intervals " +
+ "for a total of " + intervals + " intervals " +
"with a total of " + requestsCount + " requests.");
summedTime = 0;
@@ -759,7 +745,8 @@ void sentRequest(TranscriptionRequest request)
terminatingSessionThread.interrupt();
}
- logger.trace(debugName + ": sent a request");
+ if (logger.isTraceEnabled())
+ logger.trace(debugName + ": sent a request");
}
/**
@@ -899,6 +886,8 @@ public void onNext(StreamingRecognizeResponse message)
logger.debug(debugName + ": received a StreamingRecognizeResponse");
if (message.hasError())
{
+ Statistics.incrementTotalTranscriberSendErrors();
+
// it is expected to get an error if the 60 seconds are exceeded
// without any speech in the audio OR if someone muted their mic
// and no new audio is coming in
@@ -917,7 +906,7 @@ public void onNext(StreamingRecognizeResponse message)
if (logger.isDebugEnabled())
logger.debug(
debugName + ": received a message with an empty results list");
-
+ Statistics.incrementTotalTranscriberNoResultErrors();
requestManager.terminateCurrentSession();
return;
}
@@ -930,6 +919,7 @@ public void onNext(StreamingRecognizeResponse message)
// so this is never supposed to happen
if (result.getAlternativesList().isEmpty())
{
+ Statistics.incrementTotalTranscriberNoResultErrors();
logger.warn(
debugName + ": received a list of alternatives which"
+ " was empty");
@@ -1014,7 +1004,7 @@ private void handleResult(StreamingRecognitionResult result)
public void onError(Throwable t)
{
logger.warn(debugName + ": received an error from the Google Cloud API", t);
-
+ Statistics.incrementTotalTranscriberSendErrors();
if (t instanceof ResourceExhaustedException)
{
for (TranscriptionListener l : requestManager.getListeners())
diff --git a/src/main/java/org/jitsi/jigasi/transcription/Transcriber.java b/src/main/java/org/jitsi/jigasi/transcription/Transcriber.java
index fba47e314..27bc578fd 100644
--- a/src/main/java/org/jitsi/jigasi/transcription/Transcriber.java
+++ b/src/main/java/org/jitsi/jigasi/transcription/Transcriber.java
@@ -17,11 +17,11 @@
*/
package org.jitsi.jigasi.transcription;
-import com.timgroup.statsd.*;
import net.java.sip.communicator.impl.protocol.jabber.*;
import net.java.sip.communicator.service.protocol.*;
import org.jitsi.impl.neomedia.device.*;
import org.jitsi.jigasi.*;
+import org.jitsi.jigasi.stats.*;
import org.jitsi.jigasi.transcription.action.*;
import org.jitsi.utils.logging.*;
import org.jitsi.xmpp.extensions.jitsimeet.*;
@@ -47,21 +47,6 @@ public class Transcriber
*/
private final static Logger logger = Logger.getLogger(Transcriber.class);
- /**
- * Datadog aspect for failing the transcription process.
- */
- private final static String DD_ASPECT_FAILED = "failed_transcriber";
-
- /**
- * Datadog aspect for starting transcribing
- */
- private final static String DD_ASPECT_START = "start_transcriber";
-
- /**
- * Datadog aspect for ending transcribing
- */
- private final static String DD_ASPECT_STOP = "stop_transcriber";
-
/**
* The property name for the boolean value whether translations should be
* enabled.
@@ -305,9 +290,7 @@ public void participantJoined(String identifier)
}
if (logger.isDebugEnabled())
- logger.debug(
- getDebugName()
- + ": added participant with identifier " + identifier);
+ logger.debug(getDebugName() + ": added participant with identifier " + identifier);
return;
}
@@ -481,11 +464,7 @@ public void participantLeft(String identifier)
}
if (logger.isDebugEnabled())
- {
- logger.debug(
- getDebugName() + ": removed participant with identifier "
- + identifier);
- }
+ logger.debug(getDebugName() + ": removed participant with identifier " + identifier);
return;
}
@@ -505,7 +484,7 @@ public void start()
if (logger.isDebugEnabled())
logger.debug(getDebugName() + ": transcriber is now transcribing");
- updateDDClient(DD_ASPECT_START);
+ Statistics.incrementTotalTranscriberStarted();
this.state = State.TRANSCRIBING;
this.executorService = Executors.newSingleThreadExecutor();
@@ -534,10 +513,7 @@ public void stop(TranscriptionListener.FailureReason reason)
if (State.TRANSCRIBING.equals(this.state))
{
if (logger.isDebugEnabled())
- logger.debug(
- getDebugName() + ": transcriber is now finishing up");
-
- updateDDClient(reason == null ? DD_ASPECT_STOP : DD_ASPECT_FAILED);
+ logger.debug(getDebugName() + ": transcriber is now finishing up");
this.state = reason == null ? State.FINISHING_UP : State.FINISHED;
this.executorService.shutdown();
@@ -549,10 +525,14 @@ public void stop(TranscriptionListener.FailureReason reason)
if (reason == null)
{
+ Statistics.incrementTotalTranscriberSopped();
+
checkIfFinishedUp();
}
else
{
+ Statistics.incrementTotalTranscriberFailed();
+
for (TranscriptionListener listener : listeners)
{
listener.failed(reason);
@@ -567,24 +547,6 @@ public void stop(TranscriptionListener.FailureReason reason)
}
}
- /**
- * Updated dd client with a stat.
- *
- * @param ddAspectStop
- */
- private void updateDDClient(String ddAspectStop)
- {
- StatsDClient dClient = JigasiBundleActivator.getDataDogClient();
- if (dClient != null)
- {
- dClient.increment(ddAspectStop);
- if (logger.isDebugEnabled())
- {
- logger.debug(getDebugName() + " thrown stat: " + ddAspectStop);
- }
- }
- }
-
/**
* Transcribing will stop, last chance to post something to the room.
*/
@@ -728,8 +690,9 @@ public void bufferReceived(ReceiveStream receiveStream, Buffer buffer)
{
if (!isTranscribing())
{
- logger.trace(
- getDebugName() + ": receiving audio while not transcribing");
+ if (logger.isTraceEnabled())
+ logger.trace(getDebugName() + ": receiving audio while not transcribing");
+
return;
}
@@ -741,7 +704,9 @@ public void bufferReceived(ReceiveStream receiveStream, Buffer buffer)
{
if (p.hasValidSourceLanguage())
{
- logger.trace(getDebugName() + ": gave audio to buffer");
+ if (logger.isTraceEnabled())
+ logger.trace(getDebugName() + ": gave audio to buffer");
+
p.giveBuffer(buffer);
}
}
@@ -842,9 +807,9 @@ void checkIfFinishedUp()
{
if (!participant.isCompleted())
{
- logger.debug(
- participant.getDebugName()
- + " is still not finished");
+ if (logger.isDebugEnabled())
+ logger.debug(participant.getDebugName() + " is still not finished");
+
return;
}
}
diff --git a/src/main/java/org/jitsi/jigasi/transcription/WhisperTranscriptionService.java b/src/main/java/org/jitsi/jigasi/transcription/WhisperTranscriptionService.java
index 4ae8ae38e..1c3181c27 100644
--- a/src/main/java/org/jitsi/jigasi/transcription/WhisperTranscriptionService.java
+++ b/src/main/java/org/jitsi/jigasi/transcription/WhisperTranscriptionService.java
@@ -18,6 +18,7 @@
package org.jitsi.jigasi.transcription;
import org.jitsi.impl.neomedia.device.*;
+import org.jitsi.jigasi.stats.*;
import org.jitsi.utils.logging.*;
import java.nio.*;
@@ -96,6 +97,7 @@ public StreamingRecognitionSession initStreamingSession(Participant participant)
}
catch (Exception e)
{
+ Statistics.incrementTotalTranscriberSessionCreationErrors();
throw new UnsupportedOperationException("Failed to create WS streaming session", e);
}
}
@@ -150,6 +152,7 @@ public void sendRequest(TranscriptionRequest request)
{
if (this.wsClient.ended())
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
logger.warn("Trying to send buffer without a connection.");
return;
}
@@ -160,6 +163,7 @@ public void sendRequest(TranscriptionRequest request)
}
catch (Exception e)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.error("Error while sending websocket request for participant " + participantId, e);
}
}
diff --git a/src/main/java/org/jitsi/jigasi/transcription/WhisperWebsocket.java b/src/main/java/org/jitsi/jigasi/transcription/WhisperWebsocket.java
index d9c69351e..880aa6e5d 100644
--- a/src/main/java/org/jitsi/jigasi/transcription/WhisperWebsocket.java
+++ b/src/main/java/org/jitsi/jigasi/transcription/WhisperWebsocket.java
@@ -22,6 +22,7 @@
import org.eclipse.jetty.websocket.api.annotations.*;
import org.eclipse.jetty.websocket.client.*;
import org.jitsi.jigasi.*;
+import org.jitsi.jigasi.stats.*;
import org.jitsi.utils.logging.*;
import org.json.*;
@@ -169,6 +170,7 @@ private void generateWebsocketUrl()
}
catch (Exception e)
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
logger.error("Failed generating JWT for Whisper. " + e);
}
if (logger.isDebugEnabled())
@@ -206,6 +208,7 @@ void connect()
}
catch (Exception e)
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
int remaining = maxRetryAttempts - attempt;
waitTime *= multiplier;
logger.error("Failed connecting to " + websocketUrl + ". Retrying in "
@@ -222,6 +225,7 @@ void connect()
if (!isConnected)
{
+ Statistics.incrementTotalTranscriberConnectionErrors();
logger.error("Failed connecting to " + websocketUrl + ". Nothing to do.");
}
}
@@ -290,6 +294,7 @@ public void onError(Throwable cause)
{
if (wsSession != null)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.error("Error while streaming audio data to transcription service.", cause);
}
}
@@ -356,6 +361,7 @@ public void sendAudio(String participantId, Participant participant, ByteBuffer
RemoteEndpoint remoteEndpoint = wsSession.getRemote();
if (remoteEndpoint == null)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.error("Failed sending audio for " + participantId + ". Attempting to reconnect.");
if (!wsSession.isOpen())
{
@@ -378,6 +384,7 @@ public void sendAudio(String participantId, Participant participant, ByteBuffer
}
catch (IOException e)
{
+ Statistics.incrementTotalTranscriberSendErrors();
logger.error("Failed sending audio for " + participantId + ". " + e);
}
}