Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-crt-cpp for openSUSE:Factory checked in at 2026-04-09 16:12:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-crt-cpp (Old) and /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.21863 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-crt-cpp" Thu Apr 9 16:12:03 2026 rev:49 rq:1345502 version:0.38.3 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-crt-cpp/aws-crt-cpp.changes 2026-03-27 06:36:41.646293083 +0100 +++ /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.21863/aws-crt-cpp.changes 2026-04-09 16:25:02.947263383 +0200 @@ -1,0 +2,15 @@ +Wed Apr 1 14:22:50 UTC 2026 - John Paul Adrian Glaubitz <[email protected]> + +- Update to version 0.38.3 + * Add missing ctor impl by @sbiscigl in (#837) +- from version 0.38.2 + * Bind out proxy settings for profile and web + identity creds provider by @sbiscigl in (#835) +- from version 0.38.1 + * [Bug Fix] Fix exposed private header for metrics + by @xiazhvera in (#832) +- from version 0.38.0 + * Add IoT Metrics Support by @xiazhvera in (#809) + * Bump event stream by @azkrishpy in (#830) + +------------------------------------------------------------------- Old: ---- v0.37.4.tar.gz New: ---- v0.38.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-crt-cpp.spec ++++++ --- /var/tmp/diff_new_pack.8pEq8Z/_old 2026-04-09 16:25:04.655333682 +0200 +++ /var/tmp/diff_new_pack.8pEq8Z/_new 2026-04-09 16:25:04.667334176 +0200 @@ -20,7 +20,7 @@ %define library_soversion 1 Name: aws-crt-cpp -Version: 0.37.4 +Version: 0.38.3 Release: 0 Summary: AWS C++ wrapper for AWS SDK C libraries License: Apache-2.0 ++++++ v0.37.4.tar.gz -> v0.38.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/VERSION new/aws-crt-cpp-0.38.3/VERSION --- old/aws-crt-cpp-0.37.4/VERSION 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/VERSION 2026-03-30 22:52:19.000000000 +0200 @@ -1 +1 @@ -0.37.4 +0.38.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/auth/Credentials.h new/aws-crt-cpp-0.38.3/include/aws/crt/auth/Credentials.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/auth/Credentials.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/auth/Credentials.h 2026-03-30 22:52:19.000000000 +0200 @@ -209,6 +209,11 @@ * If using BYO_CRYPTO, you must provide the TLS context since it cannot be created automatically. */ Io::TlsContext *TlsContext; + + /** + * (Optional) Http proxy configuration for the http request that fetches credentials. + */ + Optional<Http::ProxyEnvVarOptions> ProxyEnvVarOptions; }; /** @@ -492,6 +497,11 @@ * TLS configuration for secure socket connections. */ Io::TlsConnectionOptions TlsConnectionOptions; + + /** + * (Optional) Http proxy configuration for the http request that fetches credentials. + */ + Optional<Http::ProxyEnvVarOptions> ProxyEnvVarOptions; }; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/http/HttpConnection.h new/aws-crt-cpp-0.38.3/include/aws/crt/http/HttpConnection.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/http/HttpConnection.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/http/HttpConnection.h 2026-03-30 22:52:19.000000000 +0200 @@ -341,6 +341,72 @@ }; /** + * Configuration to enable or disable environment variable based proxy lookup. + */ + enum class ProxyEnvVarType + { + /** + * Default. + * Disable reading from environment variable for proxy. + */ + Disabled = AWS_HPEV_DISABLE, + /** + * Enable get proxy URL from environment variable, when the manual proxy options of connection manager + * is not set. env HTTPS_PROXY/https_proxy will be checked when the main connection use tls. env + * HTTP_PROXY/http_proxy will be checked when the main connection NOT use tls. env NO_PROXY/no_proxy + * will be checked to bypass proxy if the host match the pattern. Check `aws_http_host_matches_no_proxy` + * for detail. This function can also be used with a direct no_proxy parameter. The lower case version + * has precedence. + */ + Enabled = AWS_HPEV_ENABLE, + }; + + /** + * Configuration structure that holds all proxy-related http connection options + */ + class AWS_CRT_CPP_API ProxyEnvVarOptions + { + public: + ProxyEnvVarOptions(); + ProxyEnvVarOptions(const ProxyEnvVarOptions &rhs) = default; + ProxyEnvVarOptions(ProxyEnvVarOptions &&rhs) = default; + + ProxyEnvVarOptions &operator=(const ProxyEnvVarOptions &rhs) = default; + ProxyEnvVarOptions &operator=(ProxyEnvVarOptions &&rhs) = default; + + ~ProxyEnvVarOptions() = default; + + /** + * Intended for internal use only. Initializes the C proxy configuration structure, + * aws_http_proxy_options, from an HttpClientConnectionProxyOptions instance. + * + * @param raw_options - output parameter containing low level proxy options to be passed to the C + * interface + * + */ + void InitializeRawProxyOptions(struct proxy_env_var_settings &raw_options) const; + + /** + * Enables or disables env var lookup for proxy variables. + */ + ProxyEnvVarType proxyEnvVarType; + + /** + * Optional. + * If not set: + * If tls options are provided (for the main connection) use tunnel proxy type + * If tls options are not provided (for the main connection) use forward proxy type + */ + AwsHttpProxyConnectionType connectionType; + + /** + * Sets the TLS options for the connection to the proxy. + * Optional. + */ + Optional<Io::TlsConnectionOptions> TlsOptions; + }; + + /** * Configuration structure holding all options relating to http connection establishment */ class AWS_CRT_CPP_API HttpClientConnectionOptions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/Mqtt5Client.h new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/Mqtt5Client.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/Mqtt5Client.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/Mqtt5Client.h 2026-03-30 22:52:19.000000000 +0200 @@ -11,6 +11,10 @@ { namespace Crt { + namespace Mqtt + { + struct IoTDeviceSDKMetrics; + } namespace Mqtt5 { class ConnectPacket; @@ -688,6 +692,14 @@ Mqtt5ClientOptions &WithPublishReceivedCallback(OnPublishReceivedHandler callback) noexcept; /** + * Enable AWS IoT metrics. Default to enabled. + * + * @param enabled enable AWS IoT metrics to collect SDK usage data, including SDK version, name, and + * platform + */ + Mqtt5ClientOptions &WithMetricsCollection(bool enabled) noexcept; + + /** * Initializes the C aws_mqtt5_client_options from Mqtt5ClientOptions. For internal use * * @param raw_options - output parameter containing low level client options to be passed to the C @@ -833,10 +845,14 @@ */ uint32_t m_ackTimeoutSec; + bool m_enableMetrics = true; + Crt::ScopedResource<Mqtt::IoTDeviceSDKMetrics> m_sdkMetrics; + /* Underlying Parameters */ Crt::Allocator *m_allocator; aws_http_proxy_options m_httpProxyOptionsStorage; aws_mqtt5_packet_connect_view m_packetConnectViewStorage; + struct aws_mqtt_iot_metrics m_metricsStorage; }; } // namespace Mqtt5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/MqttClient.h new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/MqttClient.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/MqttClient.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/MqttClient.h 2026-03-30 22:52:19.000000000 +0200 @@ -85,6 +85,7 @@ * @param socketOptions socket options to use when establishing the connection * @param tlsContext tls context to use with the connection * @param useWebsocket should the connection use websockets or should it use direct mqtt? + * @param enableMetrics enable AWS IoT metrics collection. Default to true. * * @return a new connection object. Connect() will still need to be called after all further * configuration is finished. @@ -94,7 +95,8 @@ uint32_t port, const Io::SocketOptions &socketOptions, const Crt::Io::TlsContext &tlsContext, - bool useWebsocket = false) noexcept; + bool useWebsocket = false, + bool enableMetrics = true) noexcept; /** * Create a new connection object over plain text from the client. The client must outlive @@ -103,6 +105,7 @@ * @param port port to connect to * @param socketOptions socket options to use when establishing the connection * @param useWebsocket should the connection use websockets or should it use direct mqtt? + * @param enableMetrics enable AWS IoT metrics collection. Default to true * * @return a new connection object. Connect() will still need to be called after all further * configuration is finished. @@ -111,7 +114,8 @@ const char *hostName, uint32_t port, const Io::SocketOptions &socketOptions, - bool useWebsocket = false) noexcept; + bool useWebsocket = false, + bool enableMetrics = true) noexcept; private: aws_mqtt_client *m_client; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/MqttTypes.h new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/MqttTypes.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/MqttTypes.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/MqttTypes.h 2026-03-30 22:52:19.000000000 +0200 @@ -33,6 +33,7 @@ Crt::Io::TlsConnectionOptions tlsConnectionOptions; bool useWebsocket = false; bool useTls = false; + bool enableMetrics = true; Allocator *allocator = nullptr; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/private/MqttConnectionCore.h new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/private/MqttConnectionCore.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/private/MqttConnectionCore.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/private/MqttConnectionCore.h 2026-03-30 22:52:19.000000000 +0200 @@ -15,6 +15,7 @@ #include <aws/crt/io/SocketOptions.h> #include <aws/crt/io/TlsOptions.h> #include <aws/crt/mqtt/MqttTypes.h> +#include <aws/crt/mqtt/private/MqttShared.h> #include <aws/mqtt/client.h> #include <aws/mqtt/v5/mqtt5_client.h> @@ -372,6 +373,8 @@ bool m_useTls; bool m_useWebsocket; MqttConnectionOperationStatistics m_operationStatistics; + bool m_enableMetrics = true; + IoTDeviceSDKMetrics m_sdkMetrics; Allocator *m_allocator; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/private/MqttShared.h new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/private/MqttShared.h --- old/aws-crt-cpp-0.37.4/include/aws/crt/mqtt/private/MqttShared.h 1970-01-01 01:00:00.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/crt/mqtt/private/MqttShared.h 2026-03-30 22:52:19.000000000 +0200 @@ -0,0 +1,39 @@ +/*! \cond DOXYGEN_PRIVATE +** Hide API from this file in doxygen. Set DOXYGEN_PRIVATE in doxygen +** config to enable this file for doxygen. +*/ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include <aws/crt/Types.h> +#include <aws/mqtt/mqtt.h> + +namespace Aws +{ + namespace Crt + { + namespace Mqtt + { + /** + * @internal + * IoT Device SDK Metrics Structure + */ + struct IoTDeviceSDKMetrics + { + String LibraryName; + + IoTDeviceSDKMetrics() { LibraryName = "IoTDeviceSDK/CPP"; } + + void initializeRawOptions(struct aws_mqtt_iot_metrics &raw_options) noexcept + { + raw_options.library_name = ByteCursorFromString(LibraryName); + } + }; + } // namespace Mqtt + } // namespace Crt +} // namespace Aws + +/*! \endcond */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/iot/Mqtt5Client.h new/aws-crt-cpp-0.38.3/include/aws/iot/Mqtt5Client.h --- old/aws-crt-cpp-0.37.4/include/aws/iot/Mqtt5Client.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/iot/Mqtt5Client.h 2026-03-30 22:52:19.000000000 +0200 @@ -670,9 +670,9 @@ /* Error */ int m_lastError; + /** Enable AWS IoT Metrics Collection. This is always set to true for now. */ bool m_enableMetricsCollection; - - Crt::String m_sdkName = "CPPv2"; + Crt::String m_sdkName = "IoTDeviceSDK/CPP"; Crt::String m_sdkVersion = AWS_CRT_CPP_VERSION; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/include/aws/iot/MqttClient.h new/aws-crt-cpp-0.38.3/include/aws/iot/MqttClient.h --- old/aws-crt-cpp-0.37.4/include/aws/iot/MqttClient.h 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/include/aws/iot/MqttClient.h 2026-03-30 22:52:19.000000000 +0200 @@ -34,12 +34,14 @@ * @param port port to connect to * @param socketOptions socket options to use when establishing the connection * @param tlsContext tls context that should be used for all connections sourced from this config + * @param enableMetrics Whether to set AWS IoT Metrics in the MQTT CONNECT packet. Default is True. */ MqttClientConnectionConfig( const Crt::String &endpoint, uint32_t port, const Crt::Io::SocketOptions &socketOptions, - Crt::Io::TlsContext &&tlsContext); + Crt::Io::TlsContext &&tlsContext, + bool enableMetrics = true); /** * Creates a client configuration for use with making new AWS Iot specific MQTT Connections with web @@ -57,6 +59,7 @@ * @param tlsContext tls context that should be used for all connections sourced from this config * @param interceptor websocket upgrade handshake transformation function * @param proxyOptions proxy configuration options + * @param enableMetrics Whether to set AWS IoT Metrics in the MQTT CONNECT packet. Default is True. */ MqttClientConnectionConfig( const Crt::String &endpoint, @@ -64,7 +67,8 @@ const Crt::Io::SocketOptions &socketOptions, Crt::Io::TlsContext &&tlsContext, Crt::Mqtt::OnWebSocketHandshakeIntercept &&interceptor, - const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions); + const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions, + bool enableMetrics = true); /** * @return true if the instance is in a valid state, false otherwise. @@ -84,7 +88,8 @@ uint32_t port, const Crt::Io::SocketOptions &socketOptions, Crt::Io::TlsContext &&tlsContext, - const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions); + const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions, + bool enableMetrics = true); Crt::String m_endpoint; uint32_t m_port; @@ -94,6 +99,7 @@ Crt::String m_username; Crt::String m_password; Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> m_proxyOptions; + bool m_enableMetricsCollection; int m_lastError; friend class MqttClient; @@ -323,7 +329,7 @@ * Whether to send the SDK name and version number in the MQTT CONNECT packet. * Default is True. * - * @param enabled true to send SDK version/name in the connect for metrics gathering purposes + * @param enabled true to send SDK version/name/platform in the connect for metrics gathering purposes. * * @return this builder object */ @@ -455,7 +461,7 @@ Crt::Optional<WebsocketConfig> m_websocketConfig; Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> m_proxyOptions; bool m_enableMetricsCollection = true; - Crt::String m_sdkName = "CPPv2"; + Crt::String m_sdkName = "IoTDeviceSDK/CPP"; Crt::String m_sdkVersion; Crt::String m_username = ""; Crt::String m_password = ""; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/auth/Credentials.cpp new/aws-crt-cpp-0.38.3/source/auth/Credentials.cpp --- old/aws-crt-cpp-0.37.4/source/auth/Credentials.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/auth/Credentials.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -238,6 +238,15 @@ raw_config.profile_name_override = config.ProfileNameOverride; raw_config.bootstrap = config.Bootstrap ? config.Bootstrap->GetUnderlyingHandle() : nullptr; raw_config.tls_ctx = config.TlsContext ? config.TlsContext->GetUnderlyingHandle() : nullptr; + struct proxy_env_var_settings proxy_options; + AWS_ZERO_STRUCT(proxy_options); + if (config.ProxyEnvVarOptions.has_value()) + { + const Http::ProxyEnvVarOptions &proxy_config = config.ProxyEnvVarOptions.value(); + proxy_config.InitializeRawProxyOptions(proxy_options); + + raw_config.proxy_ev_settings = &proxy_options; + } return s_CreateWrappedProvider(aws_credentials_provider_new_profile(allocator, &raw_config), allocator); } @@ -511,6 +520,17 @@ { raw_config.tls_ctx = connectionOptions->ctx; } + + struct proxy_env_var_settings proxy_options; + AWS_ZERO_STRUCT(proxy_options); + if (config.ProxyEnvVarOptions.has_value()) + { + const Http::ProxyEnvVarOptions &proxy_config = config.ProxyEnvVarOptions.value(); + proxy_config.InitializeRawProxyOptions(proxy_options); + + raw_config.proxy_ev_settings = &proxy_options; + } + return s_CreateWrappedProvider( aws_credentials_provider_new_sts_web_identity(allocator, &raw_config), allocator); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/http/HttpConnection.cpp new/aws-crt-cpp-0.38.3/source/http/HttpConnection.cpp --- old/aws-crt-cpp-0.37.4/source/http/HttpConnection.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/http/HttpConnection.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -398,6 +398,24 @@ } } + ProxyEnvVarOptions::ProxyEnvVarOptions() + : proxyEnvVarType(ProxyEnvVarType::Disabled), connectionType(AwsHttpProxyConnectionType::Legacy), + TlsOptions() + { + } + + void ProxyEnvVarOptions::InitializeRawProxyOptions(struct proxy_env_var_settings &rawOptions) const + { + AWS_ZERO_STRUCT(rawOptions); + rawOptions.env_var_type = (enum aws_http_proxy_env_var_type)proxyEnvVarType; + rawOptions.connection_type = (enum aws_http_proxy_connection_type)connectionType; + + if (TlsOptions.has_value()) + { + rawOptions.tls_options = TlsOptions->GetUnderlyingHandle(); + } + } + HttpClientConnectionOptions::HttpClientConnectionOptions() : Bootstrap(nullptr), InitialWindowSize(SIZE_MAX), OnConnectionSetupCallback(), OnConnectionShutdownCallback(), HostName(), Port(0), SocketOptions(), TlsOptions(), ProxyOptions(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/iot/Mqtt5Client.cpp new/aws-crt-cpp-0.38.3/source/iot/Mqtt5Client.cpp --- old/aws-crt-cpp-0.37.4/source/iot/Mqtt5Client.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/iot/Mqtt5Client.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -628,6 +628,8 @@ m_options->WithHttpProxyOptions(m_proxyOptions.value()); } + m_options->WithMetricsCollection(m_enableMetricsCollection); + return Crt::Mqtt5::Mqtt5Client::NewMqtt5Client(*m_options, m_allocator); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/iot/MqttClient.cpp new/aws-crt-cpp-0.38.3/source/iot/MqttClient.cpp --- old/aws-crt-cpp-0.37.4/source/iot/MqttClient.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/iot/MqttClient.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -31,9 +31,10 @@ const Crt::String &endpoint, uint32_t port, const Crt::Io::SocketOptions &socketOptions, - Crt::Io::TlsContext &&tlsContext) + Crt::Io::TlsContext &&tlsContext, + bool enableMetrics) : m_endpoint(endpoint), m_port(port), m_context(std::move(tlsContext)), m_socketOptions(socketOptions), - m_lastError(0) + m_enableMetricsCollection(enableMetrics), m_lastError(0) { } @@ -43,9 +44,11 @@ const Crt::Io::SocketOptions &socketOptions, Crt::Io::TlsContext &&tlsContext, Crt::Mqtt::OnWebSocketHandshakeIntercept &&interceptor, - const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions) + const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions, + bool enableMetrics) : m_endpoint(endpoint), m_port(port), m_context(std::move(tlsContext)), m_socketOptions(socketOptions), - m_webSocketInterceptor(std::move(interceptor)), m_proxyOptions(proxyOptions), m_lastError(0) + m_webSocketInterceptor(std::move(interceptor)), m_proxyOptions(proxyOptions), + m_enableMetricsCollection(enableMetrics), m_lastError(0) { } @@ -54,9 +57,10 @@ uint32_t port, const Crt::Io::SocketOptions &socketOptions, Crt::Io::TlsContext &&tlsContext, - const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions) + const Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> &proxyOptions, + bool enableMetrics) : m_endpoint(endpoint), m_port(port), m_context(std::move(tlsContext)), m_socketOptions(socketOptions), - m_proxyOptions(proxyOptions), m_lastError(0) + m_proxyOptions(proxyOptions), m_enableMetricsCollection(enableMetrics), m_lastError(0) { } @@ -532,7 +536,12 @@ if (!m_websocketConfig) { auto config = MqttClientConnectionConfig( - m_endpoint, port, m_socketOptions, std::move(tlsContext), m_proxyOptions); + m_endpoint, + port, + m_socketOptions, + std::move(tlsContext), + m_proxyOptions, + m_enableMetricsCollection); config.m_username = username; config.m_password = password; return config; @@ -562,7 +571,8 @@ m_socketOptions, std::move(tlsContext), signerTransform, - useWebsocketProxyOptions ? m_websocketConfig->ProxyOptions : m_proxyOptions); + useWebsocketProxyOptions ? m_websocketConfig->ProxyOptions : m_proxyOptions, + m_enableMetricsCollection); config.m_username = username; config.m_password = password; return config; @@ -593,7 +603,12 @@ bool useWebsocket = config.m_webSocketInterceptor.operator bool(); auto newConnection = m_client.NewConnection( - config.m_endpoint.c_str(), config.m_port, config.m_socketOptions, config.m_context, useWebsocket); + config.m_endpoint.c_str(), + config.m_port, + config.m_socketOptions, + config.m_context, + useWebsocket, + config.m_enableMetricsCollection); if (!newConnection) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/mqtt/Mqtt5Client.cpp new/aws-crt-cpp-0.38.3/source/mqtt/Mqtt5Client.cpp --- old/aws-crt-cpp-0.37.4/source/mqtt/Mqtt5Client.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/mqtt/Mqtt5Client.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -5,6 +5,7 @@ #include <aws/crt/mqtt/Mqtt5Client.h> #include <aws/crt/mqtt/Mqtt5Packets.h> #include <aws/crt/mqtt/private/Mqtt5ClientCore.h> +#include <aws/crt/mqtt/private/MqttShared.h> #include <aws/crt/Api.h> #include <aws/crt/StlAllocator.h> @@ -193,8 +194,12 @@ m_extendedValidationAndFlowControlOptions(AWS_MQTT5_EVAFCO_AWS_IOT_CORE_DEFAULTS), m_offlineQueueBehavior(AWS_MQTT5_COQBT_DEFAULT), m_reconnectionOptions({AWS_EXPONENTIAL_BACKOFF_JITTER_DEFAULT, 0, 0, 0}), m_pingTimeoutMs(0), - m_connackTimeoutMs(0), m_ackTimeoutSec(0), m_allocator(allocator) + m_connackTimeoutMs(0), m_ackTimeoutSec(0), m_enableMetrics(true), m_allocator(allocator) { + m_sdkMetrics = Crt::ScopedResource<Mqtt::IoTDeviceSDKMetrics>( + Crt::New<Mqtt::IoTDeviceSDKMetrics>(allocator), + [allocator](Mqtt::IoTDeviceSDKMetrics *metrics) { Crt::Delete(metrics, allocator); }); + m_sdkMetrics->initializeRawOptions(m_metricsStorage); m_socketOptions.SetSocketType(Io::SocketType::Stream); AWS_ZERO_STRUCT(m_packetConnectViewStorage); AWS_ZERO_STRUCT(m_httpProxyOptionsStorage); @@ -241,6 +246,7 @@ raw_options.connack_timeout_ms = m_connackTimeoutMs; raw_options.ack_timeout_seconds = m_ackTimeoutSec; raw_options.topic_aliasing_options = &m_topicAliasingOptions; + raw_options.metrics = m_enableMetrics ? &m_metricsStorage : NULL; return true; } @@ -417,6 +423,12 @@ return *this; } + Mqtt5ClientOptions &Mqtt5ClientOptions::WithMetricsCollection(bool enabled) noexcept + { + m_enableMetrics = enabled; + return *this; + } + } // namespace Mqtt5 } // namespace Crt } // namespace Aws diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/mqtt/MqttClient.cpp new/aws-crt-cpp-0.38.3/source/mqtt/MqttClient.cpp --- old/aws-crt-cpp-0.37.4/source/mqtt/MqttClient.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/mqtt/MqttClient.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -70,7 +70,8 @@ uint32_t port, const Io::SocketOptions &socketOptions, const Crt::Io::TlsContext &tlsContext, - bool useWebsocket) noexcept + bool useWebsocket, + bool enableMetrics) noexcept { if (!tlsContext) { @@ -89,6 +90,7 @@ connectionOptions.tlsContext = tlsContext; connectionOptions.tlsConnectionOptions = tlsContext.NewConnectionOptions(); connectionOptions.useWebsocket = useWebsocket; + connectionOptions.enableMetrics = enableMetrics; connectionOptions.useTls = true; connectionOptions.allocator = m_client->allocator; @@ -99,7 +101,8 @@ const char *hostName, uint32_t port, const Io::SocketOptions &socketOptions, - bool useWebsocket) noexcept + bool useWebsocket, + bool enableMetrics) noexcept { MqttConnectionOptions connectionOptions; @@ -108,6 +111,7 @@ connectionOptions.socketOptions = socketOptions; connectionOptions.useWebsocket = useWebsocket; connectionOptions.useTls = false; + connectionOptions.enableMetrics = enableMetrics; connectionOptions.allocator = m_client->allocator; return MqttConnection::s_CreateMqttConnection(m_client, std::move(connectionOptions)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/source/mqtt/MqttConnectionCore.cpp new/aws-crt-cpp-0.38.3/source/mqtt/MqttConnectionCore.cpp --- old/aws-crt-cpp-0.37.4/source/mqtt/MqttConnectionCore.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/source/mqtt/MqttConnectionCore.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -40,8 +40,8 @@ : m_underlyingConnection(nullptr), m_hostName(options.hostName), m_port(options.port), m_tlsContext(std::move(options.tlsContext)), m_tlsOptions(std::move(options.tlsConnectionOptions)), m_socketOptions(std::move(options.socketOptions)), m_onAnyCbData(nullptr), m_useTls(options.useTls), - m_useWebsocket(options.useWebsocket), m_allocator(options.allocator), - m_connection(std::move(connection)) + m_useWebsocket(options.useWebsocket), m_enableMetrics(options.enableMetrics), + m_allocator(options.allocator), m_connection(std::move(connection)) { if (client != nullptr) { @@ -471,6 +471,21 @@ aws_mqtt_client_connection_set_connection_termination_handler( m_underlyingConnection, MqttConnectionCore::s_onConnectionTermination, this); + + if (m_enableMetrics) + { + struct aws_mqtt_iot_metrics metrics; + AWS_ZERO_STRUCT(metrics); + m_sdkMetrics.initializeRawOptions(metrics); + if (aws_mqtt_client_connection_set_metrics(m_underlyingConnection, &metrics)) + { + AWS_LOGF_DEBUG(AWS_LS_MQTT_CLIENT, "Failed to set Mqtt Metrics"); + } + } + else if (aws_mqtt_client_connection_set_metrics(m_underlyingConnection, nullptr)) + { + AWS_LOGF_DEBUG(AWS_LS_MQTT_CLIENT, "Failed to set Mqtt Metrics"); + } } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/tests/CMakeLists.txt new/aws-crt-cpp-0.38.3/tests/CMakeLists.txt --- old/aws-crt-cpp-0.37.4/tests/CMakeLists.txt 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/tests/CMakeLists.txt 2026-03-30 22:52:19.000000000 +0200 @@ -208,6 +208,7 @@ add_net_test_case(Mqtt311WSConnectionWithBasicAuth) add_net_test_case(Mqtt311WSConnectionWithTLS) add_net_test_case(Mqtt311WSConnectionWithHttpProxy) + add_net_test_case(Mqtt311DirectConnectionWithMetricsCollection) endif() #MQTT5 related tests @@ -217,6 +218,7 @@ # MQTT5 TESTS add_net_test_case(Mqtt5DirectConnectionMinimal) add_net_test_case(Mqtt5DirectConnectionWithBasicAuth) + add_net_test_case(Mqtt5DirectConnectionWithMetricsCollection) add_net_test_case(Mqtt5DirectConnectionWithTLS) add_net_test_case(Mqtt5DirectConnectionWithMutualTLS) add_net_test_case(Mqtt5DirectConnectionWithHttpProxy) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/tests/Mqtt5ClientTest.cpp new/aws-crt-cpp-0.38.3/tests/Mqtt5ClientTest.cpp --- old/aws-crt-cpp-0.37.4/tests/Mqtt5ClientTest.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/tests/Mqtt5ClientTest.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -530,6 +530,7 @@ Mqtt5::Mqtt5ClientOptions mqtt5Options(allocator); mqtt5Options.WithHostName(mqtt5TestVars.m_hostname_string); mqtt5Options.WithPort(mqtt5TestVars.m_port_value); + mqtt5Options.WithMetricsCollection(false); std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect = Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator); @@ -554,6 +555,81 @@ AWS_TEST_CASE(Mqtt5DirectConnectionWithBasicAuth, s_TestMqtt5DirectConnectionWithBasicAuth) /* + * [ConnDC-UC2-B] Direct connection with basic authentication and metrics collection enabled + * This test verifies that WithMetricsCollection works properly by testing both enabled and disabled states. + */ +static int s_TestMqtt5DirectConnectionWithMetricsCollection(Aws::Crt::Allocator *allocator, void *) +{ + Mqtt5TestEnvVars mqtt5TestVars(allocator, MQTT5CONNECT_DIRECT_BASIC_AUTH); + if (!mqtt5TestVars) + { + printf("Environment Variables are not set for the test, skip the test"); + return AWS_OP_SKIP; + } + + ApiHandle apiHandle(allocator); + + // Part 1: Connection with metrics collection ENABLED should fail as username was appended by metrics + { + Mqtt5::Mqtt5ClientOptions mqtt5Options(allocator); + mqtt5Options.WithHostName(mqtt5TestVars.m_hostname_string); + mqtt5Options.WithPort(mqtt5TestVars.m_port_value); + mqtt5Options.WithMetricsCollection(true); // Explicitly enable metrics collection + + std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect = + Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator); + packetConnect->WithUserName(mqtt5TestVars.m_username_string); + packetConnect->WithPassword(mqtt5TestVars.m_password_cursor); + mqtt5Options.WithConnectOptions(packetConnect); + + std::promise<bool> connectionPromise; + std::promise<void> stoppedPromise; + + s_setupConnectionLifeCycle(mqtt5Options, connectionPromise, stoppedPromise, "MetricsEnabled"); + + std::shared_ptr<Mqtt5::Mqtt5Client> mqtt5Client = Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, allocator); + ASSERT_TRUE(mqtt5Client); + + ASSERT_TRUE(mqtt5Client->Start()); + ASSERT_FALSE(connectionPromise.get_future().get()); + ASSERT_TRUE(mqtt5Client->Stop()); + stoppedPromise.get_future().get(); + printf("[MQTT5] Test with metrics collection ENABLED passed.\n"); + } + + // Part 2: Connection with metrics collection DISABLED should success + { + Mqtt5::Mqtt5ClientOptions mqtt5Options(allocator); + mqtt5Options.WithHostName(mqtt5TestVars.m_hostname_string); + mqtt5Options.WithPort(mqtt5TestVars.m_port_value); + mqtt5Options.WithMetricsCollection(false); // Explicitly disable metrics collection + + std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect = + Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator); + packetConnect->WithUserName(mqtt5TestVars.m_username_string); + packetConnect->WithPassword(mqtt5TestVars.m_password_cursor); + mqtt5Options.WithConnectOptions(packetConnect); + + std::promise<bool> connectionPromise; + std::promise<void> stoppedPromise; + + s_setupConnectionLifeCycle(mqtt5Options, connectionPromise, stoppedPromise, "MetricsDisabled"); + + std::shared_ptr<Mqtt5::Mqtt5Client> mqtt5Client = Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, allocator); + ASSERT_TRUE(mqtt5Client); + + ASSERT_TRUE(mqtt5Client->Start()); + ASSERT_TRUE(connectionPromise.get_future().get()); + ASSERT_TRUE(mqtt5Client->Stop()); + stoppedPromise.get_future().get(); + printf("[MQTT5] Test with metrics collection DISABLED passed.\n"); + } + + return AWS_OP_SUCCESS; +} +AWS_TEST_CASE(Mqtt5DirectConnectionWithMetricsCollection, s_TestMqtt5DirectConnectionWithMetricsCollection) + +/* * [ConnDC-UC3] Direct connection with TLS */ static int s_TestMqtt5DirectConnectionWithTLS(Aws::Crt::Allocator *allocator, void *) @@ -852,6 +928,7 @@ Mqtt5::Mqtt5ClientOptions mqtt5Options(allocator); mqtt5Options.WithHostName(mqtt5TestVars.m_hostname_string); mqtt5Options.WithPort(mqtt5TestVars.m_port_value); + mqtt5Options.WithMetricsCollection(false); std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect = Aws::Crt::MakeShared<Aws::Crt::Mqtt5::ConnectPacket>(allocator); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.37.4/tests/MqttClientTest.cpp new/aws-crt-cpp-0.38.3/tests/MqttClientTest.cpp --- old/aws-crt-cpp-0.37.4/tests/MqttClientTest.cpp 2026-03-05 18:27:28.000000000 +0100 +++ new/aws-crt-cpp-0.38.3/tests/MqttClientTest.cpp 2026-03-30 22:52:19.000000000 +0200 @@ -244,7 +244,7 @@ Aws::Crt::Io::SocketOptions socketOptions; socketOptions.SetConnectTimeoutMs(3000); std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> connection = client.NewConnection( - aws_string_c_str(endpoint), (uint32_t)std::stoi(aws_string_c_str(port)), socketOptions, false); + aws_string_c_str(endpoint), (uint32_t)std::stoi(aws_string_c_str(port)), socketOptions, false, false); connection->SetLogin(aws_string_c_str(username), aws_string_c_str(password)); int connectResult = s_ConnectAndDisconnect(connection); ASSERT_SUCCESS(connectResult); @@ -257,6 +257,75 @@ AWS_TEST_CASE(Mqtt311DirectConnectionWithBasicAuth, s_TestMqtt311DirectConnectionWithBasicAuth) /* + * [ConnDC-UC2-B] Direct connection with basic authentication and metrics collection + * This test verifies that WithMetricsCollection works properly by testing both enabled and disabled states. + */ +static int s_TestMqtt311DirectConnectionWithMetricsCollection(Aws::Crt::Allocator *allocator, void *) +{ + struct aws_string *endpoint = NULL; + struct aws_string *port = NULL; + struct aws_string *username = NULL; + struct aws_string *password = NULL; + + int error = s_GetEnvVariable(allocator, s_mqtt311_test_envName_direct_basicauth_hostname, &endpoint); + error |= s_GetEnvVariable(allocator, s_mqtt311_test_envName_direct_basicauth_port, &port); + error |= s_GetEnvVariable(allocator, s_mqtt311_test_envName_basicauth_username, &username); + error |= s_GetEnvVariable(allocator, s_mqtt311_test_envName_basicauth_password, &password); + if (error != AWS_OP_SUCCESS) + { + printf("Environment Variables are not set for the test, skip the test"); + aws_string_destroy(endpoint); + aws_string_destroy(port); + aws_string_destroy(username); + aws_string_destroy(password); + return AWS_OP_SKIP; + } + + Aws::Crt::ApiHandle apiHandle(allocator); + + // Part 1: Connection with metrics collection ENABLED (explicit) + { + Aws::Crt::Mqtt::MqttClient client; + Aws::Crt::Io::SocketOptions socketOptions; + socketOptions.SetConnectTimeoutMs(3000); + std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> connection = client.NewConnection( + aws_string_c_str(endpoint), + (uint32_t)std::stoi(aws_string_c_str(port)), + socketOptions, + false, + true); // enableMetrics = true + connection->SetLogin(aws_string_c_str(username), aws_string_c_str(password)); + int connectResult = s_ConnectAndDisconnect(connection); + ASSERT_FAILS(connectResult); + printf("[MQTT311] Test with metrics collection ENABLED passed.\n"); + } + + // Part 2: Connection with metrics collection DISABLED (explicit) + { + Aws::Crt::Mqtt::MqttClient client; + Aws::Crt::Io::SocketOptions socketOptions; + socketOptions.SetConnectTimeoutMs(3000); + std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> connection = client.NewConnection( + aws_string_c_str(endpoint), + (uint32_t)std::stoi(aws_string_c_str(port)), + socketOptions, + false, + false); // enableMetrics = false + connection->SetLogin(aws_string_c_str(username), aws_string_c_str(password)); + int connectResult = s_ConnectAndDisconnect(connection); + ASSERT_SUCCESS(connectResult); + printf("[MQTT311] Test with metrics collection DISABLED passed.\n"); + } + + aws_string_destroy(endpoint); + aws_string_destroy(port); + aws_string_destroy(username); + aws_string_destroy(password); + return AWS_OP_SUCCESS; +} +AWS_TEST_CASE(Mqtt311DirectConnectionWithMetricsCollection, s_TestMqtt311DirectConnectionWithMetricsCollection) + +/* * [ConnDC-UC3] Direct connection with TLS */ static int s_TestMqtt311DirectConnectionWithTLS(Aws::Crt::Allocator *allocator, void *) @@ -456,7 +525,7 @@ Aws::Crt::Io::SocketOptions socketOptions; socketOptions.SetConnectTimeoutMs(3000); std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> connection = client.NewConnection( - aws_string_c_str(endpoint), (uint32_t)std::stoi(aws_string_c_str(port)), socketOptions, true); + aws_string_c_str(endpoint), (uint32_t)std::stoi(aws_string_c_str(port)), socketOptions, true, false); connection->SetLogin(aws_string_c_str(username), aws_string_c_str(password)); int connectResult = s_ConnectAndDisconnect(connection); ASSERT_SUCCESS(connectResult);
