diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/EdgeAgentConnection.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/EdgeAgentConnection.cs index 30ea858fa0f..93993a2118f 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/EdgeAgentConnection.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.IoTHub/EdgeAgentConnection.cs @@ -60,7 +60,9 @@ internal EdgeAgentConnection(IModuleClientProvider moduleClientProvider, this.retryStrategy = Preconditions.CheckNotNull(retryStrategy, nameof(retryStrategy)); this.refreshTimer = new Timer(refreshConfigFrequency.TotalMilliseconds); this.refreshTimer.Elapsed += (_, __) => this.RefreshTimerElapsed(); - this.initTask = this.CreateAndInitDeviceClient(Preconditions.CheckNotNull(moduleClientProvider, nameof(moduleClientProvider))); + this.initTask = this.CreateAndInitDeviceClient(Preconditions.CheckNotNull(moduleClientProvider, nameof(moduleClientProvider))); + + Events.TwinRefreshInit(refreshConfigFrequency); } async void RefreshTimerElapsed() => await this.RefreshTwinAsync(); @@ -84,7 +86,7 @@ async Task CreateAndInitDeviceClient(IModuleClientProvider moduleClientProvider) }); this.deviceClient = Option.Some(dc); - await this.RefreshTwinAsync(); + await this.RefreshTwinAsync(); } } @@ -129,6 +131,8 @@ async Task RefreshTwinAsync() { try { + Events.TwinRefreshStart(); + // if GetTwinAsync fails its possible that it might be due to transient network errors or because // we are getting throttled by IoT Hub; if we didn't attempt a retry then this object would be // stuck in an "error" state till either the connection status on the underlying device connection @@ -276,7 +280,9 @@ enum EventIds ErrorHandlingConnectionChangeEvent, EmptyDeploymentConfig, RetryingGetTwin, - MismatchedSchemaVersion + MismatchedSchemaVersion, + TwinRefreshInit, + TwinRefreshStart } public static void DesiredPropertiesPatchFailed(Exception exception) @@ -303,10 +309,19 @@ internal static void ConnectionStatusChangedHandlingError(Exception ex) { Log.LogWarning((int)EventIds.ErrorHandlingConnectionChangeEvent, ex, "Edge agent connection error handing connection change callback."); } + internal static void TwinRefreshInit(TimeSpan interval) + { + Log.LogDebug((int)EventIds.TwinRefreshInit, "Initialize twin refresh with interval '{0:c}'", interval); + } + + internal static void TwinRefreshStart() + { + Log.LogDebug((int)EventIds.TwinRefreshStart, "Begin refreshing twin from upstream..."); + } internal static void TwinRefreshSuccess() { - Log.LogDebug((int)EventIds.TwinRefreshSuccess, "Updated edge agent configuration from twin."); + Log.LogDebug((int)EventIds.TwinRefreshSuccess, "Updated edge agent configuration from upstream twin."); } internal static void TwinRefreshError(Exception ex) diff --git a/edgelet/build/linux/centos/amd64/package-libiothsm.sh b/edgelet/build/linux/centos/amd64/package-libiothsm.sh index bad2c3903b6..eebba906068 100755 --- a/edgelet/build/linux/centos/amd64/package-libiothsm.sh +++ b/edgelet/build/linux/centos/amd64/package-libiothsm.sh @@ -45,6 +45,6 @@ run_command() } mkdir -p $BUILD_DIR -run_command "cd /$BUILD_DIR_REL && cmake -DCPACK_PACKAGE_VERSION=\"$RPM_VERSION\" -DCPACK_RPM_PACKAGE_RELEASE=\"$RPM_RELEASE\" -DBUILD_SHARED=On -Drun_unittests=Off -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On -DCPACK_GENERATOR=RPM /project/hsm-sys/azure-iot-hsm-c/" +run_command "cd /$BUILD_DIR_REL && cmake -DCPACK_PACKAGE_VERSION=\"$RPM_VERSION\" -DCPACK_RPM_PACKAGE_RELEASE=\"$RPM_RELEASE\" -DBUILD_SHARED=On -Drun_unittests=Off -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On -Duse_http=Off -DCPACK_GENERATOR=RPM /project/hsm-sys/azure-iot-hsm-c/" run_command "cd /$BUILD_DIR_REL && make package" diff --git a/edgelet/build/linux/centos/arm32v7/package-libiothsm.sh b/edgelet/build/linux/centos/arm32v7/package-libiothsm.sh index 381b207d382..53264de55c9 100755 --- a/edgelet/build/linux/centos/arm32v7/package-libiothsm.sh +++ b/edgelet/build/linux/centos/arm32v7/package-libiothsm.sh @@ -45,6 +45,6 @@ run_command() } mkdir -p $BUILD_DIR -run_command "cd /$BUILD_DIR_REL && cmake -DCMAKE_SYSROOT=/toolchain/arm-linux-gnueabihf/libc -DCMAKE_C_COMPILER=/toolchain/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/toolchain/bin/arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux -DCPACK_RPM_PACKAGE_ARCHITECTURE=armv7hl -DCPACK_PACKAGE_VERSION=\"$RPM_VERSION\" -DCPACK_RPM_PACKAGE_RELEASE=\"$RPM_RELEASE\" -DBUILD_SHARED=On -Drun_unittests=Off -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On -DCPACK_GENERATOR=RPM /project/hsm-sys/azure-iot-hsm-c/" +run_command "cd /$BUILD_DIR_REL && cmake -DCMAKE_SYSROOT=/toolchain/arm-linux-gnueabihf/libc -DCMAKE_C_COMPILER=/toolchain/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/toolchain/bin/arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux -DCPACK_RPM_PACKAGE_ARCHITECTURE=armv7hl -DCPACK_PACKAGE_VERSION=\"$RPM_VERSION\" -DCPACK_RPM_PACKAGE_RELEASE=\"$RPM_RELEASE\" -DBUILD_SHARED=On -Drun_unittests=Off -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On -Duse_http=Off -DCPACK_GENERATOR=RPM /project/hsm-sys/azure-iot-hsm-c/" run_command "cd /$BUILD_DIR_REL && make package" diff --git a/edgelet/build/linux/debian/arm32v7/package-libiothsm.sh b/edgelet/build/linux/debian/arm32v7/package-libiothsm.sh index c68487c189d..2e1fd91559d 100755 --- a/edgelet/build/linux/debian/arm32v7/package-libiothsm.sh +++ b/edgelet/build/linux/debian/arm32v7/package-libiothsm.sh @@ -35,7 +35,7 @@ run_command() } mkdir -p $BUILD_DIR -run_command "cd /target/hsm/build && cmake -DCMAKE_SYSROOT=/arm-linux-gnueabihf/libc -DCMAKE_C_COMPILER=/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/bin/arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armhf -DCPACK_PACKAGE_VERSION=\"$VERSION\" -DBUILD_SHARED=On -Drun_unittests=On -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On /project/hsm-sys/azure-iot-hsm-c/" +run_command "cd /target/hsm/build && cmake -DCMAKE_SYSROOT=/arm-linux-gnueabihf/libc -DCMAKE_C_COMPILER=/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/bin/arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_NAME=Linux -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armhf -DCPACK_PACKAGE_VERSION=\"$VERSION\" -DBUILD_SHARED=On -Drun_unittests=On -Duse_emulator=Off -DCMAKE_BUILD_TYPE=Release -Duse_default_uuid=On -Duse_http=Off /project/hsm-sys/azure-iot-hsm-c/" run_command "cd /target/hsm/build && make package" diff --git a/edgelet/hsm-sys/build.rs b/edgelet/hsm-sys/build.rs index 4fce5b189ff..ed5372027cc 100644 --- a/edgelet/hsm-sys/build.rs +++ b/edgelet/hsm-sys/build.rs @@ -97,6 +97,7 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("run_unittests", "OFF") .define("use_default_uuid", "ON") + .define("use_http", "OFF") .define("skip_samples", "ON") .set_platform_defines() .define("run_valgrind", "OFF") @@ -109,6 +110,7 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("run_unittests", "OFF") .define("use_default_uuid", "ON") + .define("use_http", "OFF") .define("skip_samples", "ON") .set_platform_defines() .define("run_valgrind", "OFF") @@ -131,6 +133,7 @@ fn main() { .define("CMAKE_BUILD_TYPE", "Release") .define("run_unittests", rut) .define("use_default_uuid", "ON") + .define("use_http", "OFF") .define("skip_samples", "ON") .set_platform_defines() .set_build_shared()