Skip to content

Commit 5f8ad51

Browse files
committed
default metrics to true
1 parent 13f7258 commit 5f8ad51

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

include/aws/crt/mqtt/Mqtt5Packets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ namespace Aws
11711171
*/
11721172
Crt::Vector<UserProperty> m_userProperties;
11731173

1174-
bool m_enableMetrics;
1174+
bool m_enableMetrics = true;
11751175
Mqtt::IoTDeviceSDKMetrics m_sdkMetrics;
11761176

11771177
///////////////////////////////////////////////////////////////////////////

include/aws/crt/mqtt/MqttClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ namespace Aws
8585
* @param socketOptions socket options to use when establishing the connection
8686
* @param tlsContext tls context to use with the connection
8787
* @param useWebsocket should the connection use websockets or should it use direct mqtt?
88+
* @param enableMetrics enable AWS IoT metrics collection
8889
*
8990
* @return a new connection object. Connect() will still need to be called after all further
9091
* configuration is finished.
@@ -104,6 +105,7 @@ namespace Aws
104105
* @param port port to connect to
105106
* @param socketOptions socket options to use when establishing the connection
106107
* @param useWebsocket should the connection use websockets or should it use direct mqtt?
108+
* @param enableMetrics enable AWS IoT metrics collection
107109
*
108110
* @return a new connection object. Connect() will still need to be called after all further
109111
* configuration is finished.

include/aws/crt/mqtt/private/MqttConnectionCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ namespace Aws
388388
bool m_useTls;
389389
bool m_useWebsocket;
390390
MqttConnectionOperationStatistics m_operationStatistics;
391-
bool m_enableMetrics;
391+
bool m_enableMetrics = true;
392392
IoTDeviceSDKMetrics m_sdkMetrics;
393393
Allocator *m_allocator;
394394

source/mqtt/Mqtt5Packets.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,15 @@ namespace Aws
355355
s_AllocateUnderlyingUserProperties(m_userPropertiesStorage, m_userProperties, m_allocator);
356356
raw_options.user_properties = m_userPropertiesStorage;
357357
raw_options.user_property_count = m_userProperties.size();
358-
m_sdkMetrics.initializeRawOptions(m_metricsStorage);
359-
raw_options.metrics = &m_metricsStorage;
358+
if (m_enableMetrics)
359+
{
360+
m_sdkMetrics.initializeRawOptions(m_metricsStorage);
361+
raw_options.metrics = &m_metricsStorage;
362+
}
363+
else
364+
{
365+
raw_options.metrics = nullptr;
366+
}
360367

361368
return true;
362369
}

0 commit comments

Comments
 (0)