AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
BaseUplCalculator.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 #ifndef ALEXA_CLIENT_SDK_METRICS_UPLCALCULATOR_INCLUDE_METRICS_BASEUPLCALCULATOR_H_
16 #define ALEXA_CLIENT_SDK_METRICS_UPLCALCULATOR_INCLUDE_METRICS_BASEUPLCALCULATOR_H_
17 
18 #include <memory>
19 
23 
24 namespace alexaClientSDK {
25 namespace metrics {
26 namespace implementations {
27 
29 static constexpr const char* START_OF_UTTERANCE = "START_OF_UTTERANCE";
30 static constexpr const char* WW_DURATION = "WW_DURATION";
31 static constexpr const char* STOP_CAPTURE = "STOP_CAPTURE";
32 static constexpr const char* END_OF_SPEECH_OFFSET = "END_OF_SPEECH_OFFSET";
33 static constexpr const char* PARSE_COMPLETE = "PARSE_COMPLETE";
34 static constexpr const char* DIRECTIVE_DISPATCHED_HANDLE = "DIRECTIVE_DISPATCHED_HANDLE";
35 static constexpr const char* DIRECTIVE_DISPATCHED_IMMEDIATE = "DIRECTIVE_DISPATCHED_IMMEDIATE";
36 
38 static constexpr const char* END_OF_UTTERANCE = "END_OF_UTTERANCE";
39 static constexpr const char* END_OF_WW = "END_OF_WW";
40 static constexpr const char* RECOGNIZE_EVENT_IS_BUILT = "RECOGNIZE_EVENT_IS_BUILT";
41 
43 static constexpr const char* START_OF_STREAM_TIMESTAMP = "START_OF_STREAM_TIMESTAMP";
44 
46 static constexpr const char* DIALOG_REQUEST_ID_TAG = "DIALOG_REQUEST_ID";
47 static constexpr const char* DIRECTIVE_MESSAGE_ID_TAG = "DIRECTIVE_MESSAGE_ID";
48 
59 public:
65  static std::unique_ptr<avsCommon::utils::metrics::UplCalculatorInterface> createBaseUplCalculator();
66 
70  virtual ~BaseUplCalculator() = default;
71 
81  static bool getMetricTag(
82  const std::string& metricName,
83  std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricEvent> metricEvent,
84  const std::string& tagName,
85  std::string& value);
86 
95  static bool getDuration(
96  const std::string& metricName,
97  std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricEvent> metricEvent,
98  std::chrono::milliseconds& duration);
99 
105  std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::UplData> getUplData() const;
106 
109  void inspectMetric(
110  const std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricEvent>& metricEvent) override;
111  void setUplData(const std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::UplData>& uplData) override;
113 
114 private:
119 
123  void inhibitSubmission();
124 
126  std::chrono::steady_clock::time_point m_startTime;
127 
129  bool m_uplInhibited;
130 };
131 
132 } // namespace implementations
133 } // namespace metrics
134 } // namespace alexaClientSDK
135 
136 #endif // ALEXA_CLIENT_SDK_METRICS_UPLCALCULATOR_INCLUDE_METRICS_BASEUPLCALCULATOR_H_
void setUplData(const std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::UplData > &uplData) override
static constexpr const char * END_OF_UTTERANCE
Names of the new recordered timepoints for UPL.
Definition: BaseUplCalculator.h:38
static constexpr const char * STOP_CAPTURE
Definition: BaseUplCalculator.h:31
::std::string string
Definition: gtest-port.h:1097
static constexpr const char * DIRECTIVE_DISPATCHED_HANDLE
Definition: BaseUplCalculator.h:34
static constexpr const char * DIRECTIVE_MESSAGE_ID_TAG
Definition: BaseUplCalculator.h:47
static constexpr const char * RECOGNIZE_EVENT_IS_BUILT
Definition: BaseUplCalculator.h:40
static std::unique_ptr< avsCommon::utils::metrics::UplCalculatorInterface > createBaseUplCalculator()
static constexpr const char * DIALOG_REQUEST_ID_TAG
Metric tag names.
Definition: BaseUplCalculator.h:46
static constexpr const char * END_OF_WW
Definition: BaseUplCalculator.h:39
static constexpr const char * DIRECTIVE_DISPATCHED_IMMEDIATE
Definition: BaseUplCalculator.h:35
std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::UplData > getUplData() const
static bool getDuration(const std::string &metricName, std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricEvent > metricEvent, std::chrono::milliseconds &duration)
static constexpr const char * END_OF_SPEECH_OFFSET
Definition: BaseUplCalculator.h:32
static constexpr const char * PARSE_COMPLETE
Definition: BaseUplCalculator.h:33
void inspectMetric(const std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricEvent > &metricEvent) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static constexpr const char * WW_DURATION
Definition: BaseUplCalculator.h:30
static constexpr const char * START_OF_UTTERANCE
Names of the common monitored metrics for SDK UPL.
Definition: BaseUplCalculator.h:29
static bool getMetricTag(const std::string &metricName, std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricEvent > metricEvent, const std::string &tagName, std::string &value)
static constexpr const char * START_OF_STREAM_TIMESTAMP
Datapoint name for the start of utterance with wakeword detection.
Definition: BaseUplCalculator.h:43

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0