Skip to content

Commit

Permalink
Add additional logs during Edge Agent twin refresh (#173)
Browse files Browse the repository at this point in the history
* Add additional logs during Edge Agent twin refresh

* Remove libcurl dependency in libiothsm
  • Loading branch information
myagley authored Aug 17, 2018
1 parent 3a67e92 commit dfffc98
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -84,7 +86,7 @@ async Task CreateAndInitDeviceClient(IModuleClientProvider moduleClientProvider)
});
this.deviceClient = Option.Some(dc);

await this.RefreshTwinAsync();
await this.RefreshTwinAsync();
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -276,7 +280,9 @@ enum EventIds
ErrorHandlingConnectionChangeEvent,
EmptyDeploymentConfig,
RetryingGetTwin,
MismatchedSchemaVersion
MismatchedSchemaVersion,
TwinRefreshInit,
TwinRefreshStart
}

public static void DesiredPropertiesPatchFailed(Exception exception)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion edgelet/build/linux/centos/amd64/package-libiothsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion edgelet/build/linux/centos/arm32v7/package-libiothsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion edgelet/build/linux/debian/arm32v7/package-libiothsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions edgelet/hsm-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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()
Expand Down

0 comments on commit dfffc98

Please # to comment.