File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed
Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff 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 // /////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments