Skip to content

Commit

Permalink
Merge branch master into iiot
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonwang0 committed Jan 6, 2021
2 parents e3bf3c9 + 087de0b commit ff1b8e1
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 143 deletions.
4 changes: 2 additions & 2 deletions doc/BuiltInMetrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ instance_number | A Guid representing the current runtime. On restart, all metri
| `edgeAgent_command_latency_seconds` | `command` | How long it took docker to execute the given command. Possible commands are: create, update, remove, start, stop, restart | Gauge |
| `edgeAgent_iothub_syncs_total` | | The amount of times edgeAgent attempted to sync its twin with iotHub, both successful and unsuccessful. This incudes both agent requesting a twin and hub notifying of a twin update | Counter |
| `edgeAgent_unsuccessful_iothub_syncs_total` | | The amount of times edgeAgent failed to sync its twin with iotHub. | Counter |
| `edgeAgent_deployment_time_seconds` | | The amount of time it took to complete a new deployment after recieving a change. | Counter |
| `edgeAgent_deployment_time_seconds` | | The amount of time it took to complete a new deployment after receiving a change. | Counter |
| `edgeagent_direct_method_invocations_count` | `method_name` | Number of times a built-in edgeAgent direct method is called, such as Ping or Restart. | Counter |
|||
| `edgeAgent_host_uptime_seconds` || How long the host has been on | Gauge |
Expand All @@ -65,7 +65,7 @@ instance_number | A Guid representing the current runtime. On restart, all metri
| `edgeAgent_total_memory_bytes` | `module_name` | RAM available | Gauge |
| `edgeAgent_used_cpu_percent` | `module_name` | Percent of cpu used by all processes | Histogram |
| `edgeAgent_created_pids_total` | `module_name` | The number of processes or threads the container has created | Gauge |
| `edgeAgent_total_network_in_bytes` | `module_name` | The amount of bytes recieved from the network | Gauge |
| `edgeAgent_total_network_in_bytes` | `module_name` | The amount of bytes received from the network | Gauge |
| `edgeAgent_total_network_out_bytes` | `module_name` | The amount of bytes sent to network | Gauge |
| `edgeAgent_total_disk_read_bytes` | `module_name` | The amount of bytes read from the disk | Gauge |
| `edgeAgent_total_disk_write_bytes` | `module_name` | The amount of bytes written to disk | Gauge |
Expand Down
133 changes: 0 additions & 133 deletions doc/[Old]Metrics.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ public async Task ReconcileAsync(CancellationToken token)

if (plan.IsEmpty)
{
if (this.currentConfig.Version != deploymentConfigInfo.Version)
{
await this.UpdateCurrentConfig(deploymentConfigInfo);
}

this.status = DeploymentStatus.Success;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ public async void ReconcileAsyncOnEmptyPlan()
.ReturnsAsync(ImmutableDictionary<string, IModuleIdentity>.Empty);
mockPlanner.Setup(pl => pl.PlanAsync(It.Is<ModuleSet>(ms => ms.Equals(desiredModuleSet)), currentModuleSet, runtimeInfo, ImmutableDictionary<string, IModuleIdentity>.Empty))
.Returns(Task.FromResult(Plan.Empty));
mockReporter.Setup(r => r.ReportAsync(token, It.IsAny<ModuleSet>(), It.IsAny<IRuntimeInfo>(), It.IsAny<long>(), DeploymentStatus.Success))
.Returns(Task.CompletedTask);

var agent = new Agent(mockConfigSource.Object, mockEnvironmentProvider.Object, mockPlanner.Object, mockPlanRunner.Object, mockReporter.Object, mockModuleIdentityLifecycleManager.Object, configStore, DeploymentConfigInfo.Empty, serde, encryptionDecryptionProvider, availabilityMetric);

await agent.ReconcileAsync(token);

mockEnvironment.Verify(env => env.GetModulesAsync(token), Times.Once);
mockPlanner.Verify(pl => pl.PlanAsync(It.Is<ModuleSet>(ms => ms.Equals(desiredModuleSet)), currentModuleSet, runtimeInfo, ImmutableDictionary<string, IModuleIdentity>.Empty), Times.Once);
mockReporter.Verify(r => r.ReportAsync(token, currentModuleSet, runtimeInfo, DeploymentConfigInfo.Empty.Version, DeploymentStatus.Success), Times.Once);
mockReporter.Verify(r => r.ReportAsync(token, currentModuleSet, runtimeInfo, deploymentConfigInfo.Version, DeploymentStatus.Success), Times.Once);
mockPlanRunner.Verify(r => r.ExecuteAsync(1, Plan.Empty, token), Times.Never);
}

Expand Down
2 changes: 1 addition & 1 deletion mqtt/mqtt-bridge/src/persist/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ mod tests {

// add many elements
let mut state_lock = state.lock();
let num_elements = 10 as usize;
let num_elements = 10_usize;
for i in 0..num_elements {
#[allow(clippy::cast_possible_truncation)]
let key = Key { offset: i as u64 };
Expand Down
8 changes: 6 additions & 2 deletions mqtt/mqtt-bridge/src/persist/waking_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ mod tests {
#[test_case(WakingMemoryStore::default())]
fn ordering_maintained_across_insert(mut state: impl StreamWakeableState) {
// insert a bunch of elements
let num_elements = 10 as usize;
let num_elements = 10_usize;
for i in 0..num_elements {
#[allow(clippy::cast_possible_truncation)]
let key = Key { offset: i as u64 };
Expand All @@ -94,7 +94,7 @@ mod tests {
#[test_case(WakingMemoryStore::default())]
async fn ordering_maintained_across_removal(mut state: impl StreamWakeableState) {
// insert a bunch of elements
let num_elements = 10 as usize;
let num_elements = 10_usize;
for i in 0..num_elements {
#[allow(clippy::cast_possible_truncation)]
let key = Key { offset: i as u64 };
Expand Down Expand Up @@ -247,6 +247,10 @@ mod tests {
}

#[test_case(WakingMemoryStore::default())]
// TODO: There is a clippy bug where it shows false positive for this rule.
// When this issue is closed remove this allow.
// https://github.com/rust-lang/rust-clippy/issues/6353
#[allow(clippy::await_holding_refcell_ref)]
async fn insert_wakes_stream(state: impl StreamWakeableState + Send + 'static) {
// setup data
let state = Rc::new(RefCell::new(state));
Expand Down
5 changes: 2 additions & 3 deletions mqtt/mqtt-broker/src/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{
error::Error as StdError,
fs::{self, OpenOptions},
io::{Read, Write},
iter::FromIterator,
path::PathBuf,
};

Expand Down Expand Up @@ -307,8 +306,8 @@ where
{
let payloads = HashMap::<u64, Vec<u8>>::deserialize(deserializer)?
.into_iter()
.map(|(k, v)| (k, Bytes::from(v)));
let payloads = HashMap::from_iter(payloads);
.map(|(k, v)| (k, Bytes::from(v)))
.collect();
Ok(payloads)
}

Expand Down
2 changes: 1 addition & 1 deletion mqtt/mqtt3/src/proto/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl PacketMeta for Connect {
let client_id = super::Utf8StringDecoder::default()
.decode(&mut src)?
.ok_or(super::DecodeError::IncompletePacket)?;
let client_id = if client_id == "" {
let client_id = if client_id.is_empty() {
if connect_flags & 0x02 == 0 {
return Err(super::DecodeError::ConnectZeroLengthIdWithExistingSession);
}
Expand Down

0 comments on commit ff1b8e1

Please sign in to comment.