From 312f4914df9e5c687354d496c2d890f32bc7cf7b Mon Sep 17 00:00:00 2001 From: Anca Antochi Date: Fri, 18 Dec 2020 13:31:17 -0800 Subject: [PATCH 1/3] Remove metrics v0 (#4109) * Remove metrics v0 --- doc/[Old]Metrics.md | 2 +- .../connectivity_deployment.template.json | 3 - .../edgehub_restart_deployment.template.json | 3 - .../long_haul_deployment.template.json | 147 ++- ...long_haul_deployment.template.windows.json | 149 ++- ...sted_connectivity_deployment.template.json | 896 ++++++++++++++++++ .../stress_deployment.template.json | 3 - .../ConnectionManager.cs | 2 - .../routing/CloudEndpoint.cs | 23 +- .../routing/RoutingEdgeHub.cs | 19 +- .../storage/MessageStore.cs | 32 +- .../Program.cs | 3 - .../appsettings_hub.json | 6 +- .../endpoints/StoringAsyncEndpointExecutor.cs | 23 +- .../ColumnFamilyDbStore.cs | 44 +- .../Microsoft.Azure.Devices.Edge.Util.csproj | 2 - .../metrics/MetricsV0.cs | 156 --- 17 files changed, 1073 insertions(+), 440 deletions(-) create mode 100644 e2e_deployment_files/nested_connectivity_deployment.template.json delete mode 100644 edge-util/src/Microsoft.Azure.Devices.Edge.Util/metrics/MetricsV0.cs diff --git a/doc/[Old]Metrics.md b/doc/[Old]Metrics.md index c09eaec8037..0780e712815 100644 --- a/doc/[Old]Metrics.md +++ b/doc/[Old]Metrics.md @@ -1,5 +1,5 @@ -# **!!! IMPORTANT NOTE !!! The metrics described here are deprecated and will be removed in subsequent releases. They are superseded by [edge metrics V2](BuiltInMetrics.md).** +# **!!! IMPORTANT NOTE !!! The metrics described here were removed in release 1.1.0. They are superseded by [edge metrics V2](BuiltInMetrics.md).** ## Metrics in EdgeHub diff --git a/e2e_deployment_files/connectivity_deployment.template.json b/e2e_deployment_files/connectivity_deployment.template.json index 95ab37bcfb7..2f78250d37f 100644 --- a/e2e_deployment_files/connectivity_deployment.template.json +++ b/e2e_deployment_files/connectivity_deployment.template.json @@ -46,9 +46,6 @@ "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}],\"9600/tcp\": [{\"HostPort\": \"9601\"}]}}}" }, "env": { - "CollectMetrics": { - "value": "true" - }, "experimentalfeatures__enabled": { "value": "true" }, diff --git a/e2e_deployment_files/edgehub_restart_deployment.template.json b/e2e_deployment_files/edgehub_restart_deployment.template.json index 164da4dbd97..010d43023d2 100644 --- a/e2e_deployment_files/edgehub_restart_deployment.template.json +++ b/e2e_deployment_files/edgehub_restart_deployment.template.json @@ -46,9 +46,6 @@ "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}],\"9600/tcp\": [{\"HostPort\": \"9601\"}]}}}" }, "env": { - "CollectMetrics": { - "value": "true" - }, "experimentalfeatures__enabled": { "value": "true" }, diff --git a/e2e_deployment_files/long_haul_deployment.template.json b/e2e_deployment_files/long_haul_deployment.template.json index 5f32c1911d3..a938c1ae548 100644 --- a/e2e_deployment_files/long_haul_deployment.template.json +++ b/e2e_deployment_files/long_haul_deployment.template.json @@ -24,8 +24,7 @@ "image": "/microsoft/azureiotedge-agent:-linux-", "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"615m\",\"max-file\":\"2\"}}}}" }, - "env": { - } + "env": {} }, "edgeHub": { "type": "docker", @@ -33,11 +32,7 @@ "image": "/microsoft/azureiotedge-hub:-linux-", "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"615m\",\"max-file\":\"2\"}},\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}]}}}" }, - "env": { - "CollectMetrics": { - "value": "true" - } - }, + "env": {}, "status": "running", "restartPolicy": "always" } @@ -81,66 +76,66 @@ }, "twinTester1": { "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" }, "type": "docker", "version": "1.0", "env": { - "TransportType": { - "value": "amqp" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TwinUpdateSize": { - "value": "" - }, - "TwinUpdateFrequency": { - "value": "" - }, - "TwinUpdateFailureThreshold": { - "value": "" - }, - "EdgeHubRestartFailureTolerance": { - "value": "" - }, - "testStartDelay": { - "value": "" - } + "TransportType": { + "value": "amqp" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TwinUpdateSize": { + "value": "" + }, + "TwinUpdateFrequency": { + "value": "" + }, + "TwinUpdateFailureThreshold": { + "value": "" + }, + "EdgeHubRestartFailureTolerance": { + "value": "" + }, + "testStartDelay": { + "value": "" + } }, "status": "running", "restartPolicy": "always" }, "twinTester2": { "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" }, "type": "docker", "version": "1.0", "env": { - "TransportType": { - "value": "mqtt" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TwinUpdateSize": { - "value": "" - }, - "TwinUpdateFrequency": { - "value": "" - }, - "TwinUpdateFailureThreshold": { - "value": "" - }, - "EdgeHubRestartFailureTolerance": { - "value": "" - }, - "testStartDelay": { - "value": "" - } + "TransportType": { + "value": "mqtt" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TwinUpdateSize": { + "value": "" + }, + "TwinUpdateFrequency": { + "value": "" + }, + "TwinUpdateFailureThreshold": { + "value": "" + }, + "EdgeHubRestartFailureTolerance": { + "value": "" + }, + "testStartDelay": { + "value": "" + } }, "status": "running", "restartPolicy": "always" @@ -291,8 +286,7 @@ "status": "running", "restartPolicy": "always", "env": { - "ReportingEndpointUrl": - { + "ReportingEndpointUrl": { "value": "http://analyzer:15000" }, "InvocationSource": { @@ -334,8 +328,7 @@ "status": "running", "restartPolicy": "always", "env": { - "ReportingEndpointUrl": - { + "ReportingEndpointUrl": { "value": "http://analyzer:15000" }, "InvocationSource": { @@ -398,28 +391,28 @@ "status": "running", "restartPolicy": "always", "env": { - "LogAnalyticsWorkspaceId": { - "value": "" - }, - "LogAnalyticsSharedKey": { - "value": "" - }, - "LogAnalyticsLogType": { - "value": "testMetricsV2" - }, - "MetricsEndpointsCSV": { - "value": "" - }, - "ScrapeFrequencyInSecs": { - "value": "" - }, - "UploadTarget": { - "value": "" - } + "LogAnalyticsWorkspaceId": { + "value": "" + }, + "LogAnalyticsSharedKey": { + "value": "" + }, + "LogAnalyticsLogType": { + "value": "testMetricsV2" + }, + "MetricsEndpointsCSV": { + "value": "" + }, + "ScrapeFrequencyInSecs": { + "value": "" + }, + "UploadTarget": { + "value": "" + } }, "settings": { - "image": "/microsoft/azureiotedge-metrics-collector:-linux-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-metrics-collector:-linux-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" } } } diff --git a/e2e_deployment_files/long_haul_deployment.template.windows.json b/e2e_deployment_files/long_haul_deployment.template.windows.json index 31995ffbe43..4a32290ed34 100644 --- a/e2e_deployment_files/long_haul_deployment.template.windows.json +++ b/e2e_deployment_files/long_haul_deployment.template.windows.json @@ -24,8 +24,7 @@ "image": "/microsoft/azureiotedge-agent:-windows-", "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"615m\",\"max-file\":\"2\"}}}}" }, - "env": { - } + "env": {} }, "edgeHub": { "type": "docker", @@ -33,11 +32,7 @@ "image": "/microsoft/azureiotedge-hub:-windows-", "createOptions": "{\"User\": \"ContainerAdministrator\",\"HostConfig\": {\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"615m\",\"max-file\":\"2\"}},\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}]}}}" }, - "env": { - "CollectMetrics": { - "value": "true" - } - }, + "env": {}, "status": "running", "restartPolicy": "always" } @@ -81,66 +76,66 @@ }, "twinTester1": { "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-windows-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-twin-tester:-windows-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" }, "type": "docker", "version": "1.0", "env": { - "TransportType": { - "value": "amqp" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TwinUpdateSize": { - "value": "" - }, - "TwinUpdateFrequency": { - "value": "" - }, - "TwinUpdateFailureThreshold": { - "value": "" - }, - "EdgeHubRestartFailureTolerance": { - "value": "" - }, - "testStartDelay": { - "value": "" - } + "TransportType": { + "value": "amqp" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TwinUpdateSize": { + "value": "" + }, + "TwinUpdateFrequency": { + "value": "" + }, + "TwinUpdateFailureThreshold": { + "value": "" + }, + "EdgeHubRestartFailureTolerance": { + "value": "" + }, + "testStartDelay": { + "value": "" + } }, "status": "running", "restartPolicy": "always" }, "twinTester2": { "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-windows-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-twin-tester:-windows-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" }, "type": "docker", "version": "1.0", "env": { - "TransportType": { - "value": "mqtt" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TwinUpdateSize": { - "value": "" - }, - "TwinUpdateFrequency": { - "value": "" - }, - "TwinUpdateFailureThreshold": { - "value": "" - }, - "EdgeHubRestartFailureTolerance": { - "value": "" - }, - "testStartDelay": { - "value": "" - } + "TransportType": { + "value": "mqtt" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TwinUpdateSize": { + "value": "" + }, + "TwinUpdateFrequency": { + "value": "" + }, + "TwinUpdateFailureThreshold": { + "value": "" + }, + "EdgeHubRestartFailureTolerance": { + "value": "" + }, + "testStartDelay": { + "value": "" + } }, "status": "running", "restartPolicy": "always" @@ -294,8 +289,7 @@ "status": "running", "restartPolicy": "always", "env": { - "ReportingEndpointUrl": - { + "ReportingEndpointUrl": { "value": "http://analyzer:15000" }, "InvocationSource": { @@ -337,8 +331,7 @@ "status": "running", "restartPolicy": "always", "env": { - "ReportingEndpointUrl": - { + "ReportingEndpointUrl": { "value": "http://analyzer:15000" }, "InvocationSource": { @@ -401,28 +394,28 @@ "status": "running", "restartPolicy": "always", "env": { - "LogAnalyticsWorkspaceId": { - "value": "" - }, - "LogAnalyticsSharedKey": { - "value": "" - }, - "LogAnalyticsLogType": { - "value": "testMetricsV2" - }, - "MetricsEndpointsCSV": { - "value": "" - }, - "ScrapeFrequencyInSecs": { - "value": "" - }, - "UploadTarget": { - "value": "" - } + "LogAnalyticsWorkspaceId": { + "value": "" + }, + "LogAnalyticsSharedKey": { + "value": "" + }, + "LogAnalyticsLogType": { + "value": "testMetricsV2" + }, + "MetricsEndpointsCSV": { + "value": "" + }, + "ScrapeFrequencyInSecs": { + "value": "" + }, + "UploadTarget": { + "value": "" + } }, "settings": { - "image": "/microsoft/azureiotedge-metrics-collector:-windows-", - "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" + "image": "/microsoft/azureiotedge-metrics-collector:-windows-", + "createOptions": "{\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"4m\",\"max-file\":\"7\"}}}}" } } } @@ -452,4 +445,4 @@ } } } -} +} \ No newline at end of file diff --git a/e2e_deployment_files/nested_connectivity_deployment.template.json b/e2e_deployment_files/nested_connectivity_deployment.template.json new file mode 100644 index 00000000000..9dc542710dd --- /dev/null +++ b/e2e_deployment_files/nested_connectivity_deployment.template.json @@ -0,0 +1,896 @@ +{ + "modulesContent": { + "$edgeAgent": { + "properties.desired": { + "schemaVersion": "1.0", + "runtime": { + "type": "docker", + "settings": { + "minDockerVersion": "v1.25", + "loggingOptions": "", + "registryCredentials": { + "rc1": { + "username": "", + "password": "", + "address": "" + } + } + } + }, + "systemModules": { + "edgeAgent": { + "type": "docker", + "env": { + "UpstreamProtocol": { + "value": "" + }, + "experimentalfeatures__enabled": { + "value": "true" + }, + "experimentalfeatures__enableMetrics": { + "value": "true" + }, + "ExperimentalFeatures__EnableUploadLogs": { + "value": "true" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-agent:-linux-", + "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"9600/tcp\": [{\"HostPort\": \"9600\"}]}}}" + } + }, + "edgeHub": { + "type": "docker", + "settings": { + "image": "/microsoft/azureiotedge-hub:-linux-", + "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}],\"9600/tcp\": [{\"HostPort\": \"9601\"}]}}}" + }, + "env": { + "experimentalfeatures__enabled": { + "value": "true" + }, + "experimentalfeatures__enableMetrics": { + "value": "true" + }, + "NestedEdgeEnabled": { + "value": "true" + }, + "mqttBrokerSettings:enabled": { + "value": "true" + } + }, + "status": "running", + "restartPolicy": "always" + } + }, + "modules": { + "loadGen1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "messageFrequency": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "trackingId": { + "value": "" + }, + "transportType": { + "value": "Amqp" + }, + "outputName": { + "value": "output1" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-load-gen:-linux-", + "createOptions": "" + } + }, + "loadGen2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "messageFrequency": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "trackingId": { + "value": "" + }, + "transportType": { + "value": "Mqtt" + }, + "outputName": { + "value": "output2" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-load-gen:-linux-", + "createOptions": "" + } + }, + "directMethodSender1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "DirectMethodResultType": { + "value": "DirectMethodTestResult" + }, + "InvocationSource": { + "value": "Cloud" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "TargetModuleId": { + "value": "directMethodReceiver1" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "ReportingEndpointUrl": { + "value": "http://localhost:5001" + }, + "trackingId": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "directMethodReceiver1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "ClientTransportType": { + "value": "Amqp" + }, + "ReportingEndpointUrl": { + "value": "http://testResultCoordinator:5001" + }, + "trackingId": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-direct-method-receiver:-linux-", + "createOptions": "" + } + }, + "directMethodSender2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "DirectMethodResultType": { + "value": "DirectMethodTestResult" + }, + "InvocationSource": { + "value": "Cloud" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "TargetModuleId": { + "value": "directMethodReceiver2" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "ReportingEndpointUrl": { + "value": "http://localhost:5001" + }, + "trackingId": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "directMethodReceiver2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "ClientTransportType": { + "value": "Mqtt" + }, + "ReportingEndpointUrl": { + "value": "http://testResultCoordinator:5001" + }, + "trackingId": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-direct-method-receiver:-linux-", + "createOptions": "" + } + }, + "directMethodSender3": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "DirectMethodResultType": { + "value": "DirectMethodTestResult" + }, + "DirectMethodName": { + "value": "ping" + }, + "InvocationSource": { + "value": "Cloud" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "TargetModuleId": { + "value": "$edgeAgent" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "ReportingEndpointUrl": { + "value": "http://localhost:5001" + }, + "trackingId": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "relayer1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "transportType": { + "value": "Amqp" + }, + "inputName": { + "value": "input1" + }, + "outputName": { + "value": "output1" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-relayer:-linux-", + "createOptions": "" + } + }, + "relayer2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "transportType": { + "value": "Mqtt" + }, + "inputName": { + "value": "input2" + }, + "outputName": { + "value": "output2" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-relayer:-linux-", + "createOptions": "" + } + }, + "testResultCoordinator": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "Logging:LogLevel:Microsoft": { + "value": "Error" + }, + "trackingId": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "verificationDelay": { + "value": "" + }, + "eventHubConnectionString": { + "value": "" + }, + "ConsumerGroupName": { + "value": "" + }, + "optimizeForPerformance": { + "value": "" + }, + "logAnalyticsWorkspaceId": { + "value": "" + }, + "logAnalyticsSharedKey": { + "value": "" + }, + "logAnalyticsLogType": { + "value": "" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "logUploadEnabled": { + "value": "" + }, + "STORAGE_ACCOUNT_CONNECTION_STRING": { + "value": "" + }, + "NetworkControllerRunProfile": { + "value": "" + }, + "TEST_INFO": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-test-result-coordinator:-linux-", + "createOptions": "{\"HostConfig\": {\"PortBindings\": {\"5001/tcp\": [{\"HostPort\": \"5001\"}]}}}" + } + }, + "twinTester1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://localhost:5001" + }, + "TwinTestMode": { + "value": "TwinCloudOperations" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TargetModuleId": { + "value": "twinTester2" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "twinTester2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + }, + "TwinTestMode": { + "value": "TwinEdgeOperations" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TransportType": { + "value": "Amqp" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "" + } + }, + "twinTester3": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://localhost:5001" + }, + "TwinTestMode": { + "value": "TwinCloudOperations" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TargetModuleId": { + "value": "twinTester4" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "twinTester4": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + }, + "TwinTestMode": { + "value": "TwinEdgeOperations" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "ServiceClientConnectionString": { + "value": "" + }, + "TransportType": { + "value": "Mqtt" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-twin-tester:-linux-", + "createOptions": "" + } + }, + "deploymentTester1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "DEPLOYMENT_TESTER_MODE": { + "value": "Sender" + }, + "testStartDelay": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "trackingId": { + "value": "" + }, + "targetModuleId": { + "value": "deploymentTester2" + }, + "testResultCoordinatorUrl": { + "value": "http://localhost:5001" + }, + "DEPLOYMENT_UPDATE_PERIOD": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-deployment-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "deploymentTester2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "DEPLOYMENT_TESTER_MODE": { + "value": "Receiver" + }, + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-deployment-tester:-linux-", + "createOptions": "" + } + }, + "cloudToDeviceMessageSender1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "C2DMESSAGE_TESTER_MODE": { + "value": "Sender" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "trackingId": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "ReportingEndpointUrl": { + "value": "http://localhost:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "cloudToDeviceMessageReceiver1": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "C2DMESSAGE_TESTER_MODE": { + "value": "Receiver" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "transportType": { + "value": "Amqp" + }, + "ReportingEndpointUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", + "createOptions": "" + } + }, + "cloudToDeviceMessageSender2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "C2DMESSAGE_TESTER_MODE": { + "value": "Sender" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "trackingId": { + "value": "" + }, + "testDuration": { + "value": "" + }, + "testStartDelay": { + "value": "" + }, + "transportType": { + "value": "Mqtt" + }, + "ReportingEndpointUrl": { + "value": "http://localhost:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "cloudToDeviceMessageReceiver2": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "C2DMESSAGE_TESTER_MODE": { + "value": "Receiver" + }, + "IOT_HUB_CONNECTION_STRING": { + "value": "" + }, + "transportType": { + "value": "Mqtt" + }, + "ReportingEndpointUrl": { + "value": "http://testResultCoordinator:5001" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", + "createOptions": "" + } + }, + "networkController": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "trackingId": { + "value": "" + }, + "testResultCoordinatorUrl": { + "value": "http://localhost:5001" + }, + "RunFrequencies__0__OfflineFrequency": { + "value": "" + }, + "RunFrequencies__0__OnlineFrequency": { + "value": "" + }, + "RunFrequencies__0__RunsCount": { + "value": "" + }, + "NetworkControllerRunProfile": { + "value": "" + }, + "StartAfter": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-network-controller:-linux-", + "createOptions": "{\"HostConfig\":{\"Privileged\":\"true\",\"NetworkMode\":\"host\",\"Binds\":[\"/var/run/docker.sock:/var/run/docker.sock\"]},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + }, + "metricsCollector": { + "version": "1.0", + "type": "docker", + "status": "running", + "restartPolicy": "always", + "env": { + "LogAnalyticsWorkspaceId": { + "value": "" + }, + "LogAnalyticsSharedKey": { + "value": "" + }, + "LogAnalyticsLogType": { + "value": "testMetricsV2" + }, + "MetricsEndpointsCSV": { + "value": "" + }, + "ScrapeFrequencyInSecs": { + "value": "" + }, + "UploadTarget": { + "value": "" + } + }, + "settings": { + "image": "/microsoft/azureiotedge-metrics-collector:-linux-", + "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" + } + } + } + } + }, + "$edgeHub": { + "properties.desired": { + "schemaVersion": "1.0", + "routes": { + "loadGen1ToRelayer1": "FROM /messages/modules/loadGen1/outputs/output1 INTO BrokeredEndpoint(\"/modules/relayer1/inputs/input1\")", + "relayer1ToCloud": "FROM /messages/modules/relayer1/outputs/output1 INTO $upstream", + "loadGen2ToRelayer2": "FROM /messages/modules/loadGen2/outputs/output2 INTO BrokeredEndpoint(\"/modules/relayer2/inputs/input2\")", + "relayer2ToCloud": "FROM /messages/modules/relayer2/outputs/output2 INTO $upstream" + }, + "storeAndForwardConfiguration": { + "timeToLiveSecs": 86400 + } + } + }, + "metricsCollector": { + "properties.desired": { + "additionalTags": "" + } + }, + "testResultCoordinator": { + "properties.desired": { + "schemaVersion": "1.0", + "reportMetadataList": { + "reportMetadata1": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "loadGen1.send", + "ActualSource": "relayer1.receive", + "TestDescription": "messages | local | amqp" + }, + "reportMetadata2": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "relayer1.send", + "ActualSource": "relayer1.eventHub", + "TestDescription": "messages | upstream | amqp" + }, + "reportMetadata3": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "loadGen2.send", + "ActualSource": "relayer2.receive", + "TestDescription": "messages | local | mqtt" + }, + "reportMetadata4": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "relayer2.send", + "ActualSource": "relayer2.eventHub", + "TestDescription": "messages | upstream | mqtt" + }, + "reportMetadata5": { + "TestReportType": "TwinCountingReport", + "TwinTestPropertyType": "Desired", + "ExpectedSource": "twinTester1.desiredUpdated", + "ActualSource": "twinTester2.desiredReceived", + "TestDescription": "twin | desired property | amqp" + }, + "reportMetadata6": { + "TestReportType": "TwinCountingReport", + "TwinTestPropertyType": "Reported", + "ExpectedSource": "twinTester2.reportedReceived", + "ActualSource": "twinTester2.reportedUpdated", + "TestDescription": "twin | reported property | amqp" + }, + "reportMetadata7": { + "TestReportType": "TwinCountingReport", + "TwinTestPropertyType": "Desired", + "ExpectedSource": "twinTester3.desiredUpdated", + "ActualSource": "twinTester4.desiredReceived", + "TestDescription": "twin | desired property | mqtt" + }, + "reportMetadata8": { + "TestReportType": "TwinCountingReport", + "TwinTestPropertyType": "Reported", + "ExpectedSource": "twinTester4.reportedReceived", + "ActualSource": "twinTester4.reportedUpdated", + "TestDescription": "twin | reported property | mqtt" + }, + "reportMetadata9": { + "TestReportType": "DeploymentTestReport", + "ExpectedSource": "deploymentTester1.send", + "ActualSource": "deploymentTester2.receive", + "TestDescription": "deployment" + }, + "reportMetadata10": { + "TestReportType": "DirectMethodReport", + "SenderSource": "directMethodSender1.send", + "ReceiverSource": "directMethodReceiver1.receive", + "TolerancePeriod": "00:01:00", + "TestDescription": "direct method | cloud | amqp" + }, + "reportMetadata11": { + "TestReportType": "DirectMethodReport", + "SenderSource": "directMethodSender2.send", + "ReceiverSource": "directMethodReceiver2.receive", + "TolerancePeriod": "00:01:00", + "TestDescription": "direct method | cloud | mqtt" + }, + "reportMetadata12": { + "TestReportType": "DirectMethodReport", + "SenderSource": "directMethodSender3.send", + "TolerancePeriod": "00:01:00", + "TestDescription": "edge agent ping" + }, + "reportMetadata13": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "cloudToDeviceMessageSender1.send", + "ActualSource": "cloudToDeviceMessageReceiver1.receive", + "TestDescription": "C2D | amqp" + }, + "reportMetadata14": { + "TestReportType": "CountingReport", + "TestOperationResultType": "Messages", + "ExpectedSource": "cloudToDeviceMessageSender2.send", + "ActualSource": "cloudToDeviceMessageReceiver2.receive", + "TestDescription": "C2D | mqtt" + }, + "reportMetadata15": { + "TestReportType": "NetworkControllerReport", + "Source": "networkController", + "TestDescription": "network controller" + }, + "reportMetadata16": { + "TestReportType": "ErrorReport", + "TestDescription": "test configuration" + }, + "reportMetadata17": { + "TestReportType": "TestInfoReport", + "TestDescription": "test info" + } + } + } + } + } +} \ No newline at end of file diff --git a/e2e_deployment_files/stress_deployment.template.json b/e2e_deployment_files/stress_deployment.template.json index 2a601bcb2a5..afdd83e3264 100644 --- a/e2e_deployment_files/stress_deployment.template.json +++ b/e2e_deployment_files/stress_deployment.template.json @@ -40,9 +40,6 @@ "createOptions": "{\"HostConfig\": {\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}]}}}" }, "env": { - "CollectMetrics": { - "value": "true" - }, "amqpSettings__enabled": { "value": "" }, diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/ConnectionManager.cs b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/ConnectionManager.cs index 7cb8eb3cb85..011049ae91c 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/ConnectionManager.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/ConnectionManager.cs @@ -45,7 +45,6 @@ public ConnectionManager( this.identityProvider = Preconditions.CheckNotNull(identityProvider, nameof(identityProvider)); this.connectivityManager = Preconditions.CheckNotNull(connectivityManager, nameof(connectivityManager)); this.connectivityManager.DeviceDisconnected += (o, args) => this.HandleDeviceCloudConnectionDisconnected(); - Util.Metrics.MetricsV0.RegisterGaugeCallback(() => MetricsV0.SetConnectedClientCountGauge(this)); this.closeCloudConnectionOnDeviceDisconnect = closeCloudConnectionOnDeviceDisconnect; } @@ -574,7 +573,6 @@ public static void SetConnectedClientCountGauge(ConnectionManager connectionMana { // Subtract EdgeHub from the list of connected clients int connectedClients = connectionManager.GetConnectedClients().Count() - 1; - Util.Metrics.MetricsV0.SetGauge(ConnectedClientGaugeOptions, connectedClients); } } diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/CloudEndpoint.cs b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/CloudEndpoint.cs index d3bc15308f1..efcdf85752b 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/CloudEndpoint.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/CloudEndpoint.cs @@ -210,19 +210,14 @@ async Task> ProcessClientMessagesBatch(string id, L .Select(r => this.cloudEndpoint.messageConverter.ToMessage(r)) .ToList(); - using (MetricsV0.CloudLatency(id)) + if (messages.Count == 1) { - if (messages.Count == 1) - { - await cp.SendMessageAsync(messages[0]); - } - else - { - await cp.SendMessageBatchAsync(messages); - } + await cp.SendMessageAsync(messages[0]); + } + else + { + await cp.SendMessageBatchAsync(messages); } - - MetricsV0.MessageCount(id, messages.Count); return new SinkResult(routingMessages); } @@ -375,12 +370,6 @@ static class MetricsV0 RateUnit = TimeUnit.Seconds }; - public static void MessageCount(string identity, int count) - => Util.Metrics.MetricsV0.CountIncrement(GetTags(identity), EdgeHubToCloudMessageCountOptions, count); - - public static IDisposable CloudLatency(string identity) - => Util.Metrics.MetricsV0.Latency(GetTags(identity), EdgeHubToCloudMessageLatencyOptions); - static MetricTags GetTags(string id) { return new MetricTags("DeviceId", id); diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/RoutingEdgeHub.cs b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/RoutingEdgeHub.cs index f66c1c39805..f1c0887babe 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/RoutingEdgeHub.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/RoutingEdgeHub.cs @@ -57,14 +57,12 @@ public Task ProcessDeviceMessage(IIdentity identity, IMessage message) Preconditions.CheckNotNull(message, nameof(message)); Preconditions.CheckNotNull(identity, nameof(identity)); Events.MessageReceived(identity, message); - MetricsV0.MessageCount(identity, 1); - using (MetricsV0.MessageLatency(identity)) - { - IRoutingMessage routingMessage = this.ProcessMessageInternal(message, true); - Metrics.AddMessageSize(routingMessage.Size(), identity.Id); - Metrics.AddReceivedMessage(identity.Id, message.GetOutput()); - return this.router.RouteAsync(routingMessage); - } + + IRoutingMessage routingMessage = this.ProcessMessageInternal(message, true); + Metrics.AddMessageSize(routingMessage.Size(), identity.Id); + Metrics.AddReceivedMessage(identity.Id, message.GetOutput()); + + return this.router.RouteAsync(routingMessage); } public Task ProcessDeviceMessageBatch(IIdentity identity, IEnumerable messages) @@ -72,7 +70,6 @@ public Task ProcessDeviceMessageBatch(IIdentity identity, IEnumerable IList messagesList = messages as IList ?? Preconditions.CheckNotNull(messages, nameof(messages)).ToList(); Events.MessagesReceived(identity, messagesList); - MetricsV0.MessageCount(identity, messagesList.Count); IEnumerable routingMessages = messagesList .Select( @@ -309,10 +306,6 @@ static class MetricsV0 RateUnit = TimeUnit.Seconds }; - public static void MessageCount(IIdentity identity, long count) => Util.Metrics.MetricsV0.CountIncrement(GetTags(identity), EdgeHubMessageReceivedCountOptions, count); - - public static IDisposable MessageLatency(IIdentity identity) => Util.Metrics.MetricsV0.Latency(GetTags(identity), EdgeHubMessageLatencyOptions); - static MetricTags GetTags(IIdentity identity) { return new MetricTags("Id", identity.Id); diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/storage/MessageStore.cs b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/storage/MessageStore.cs index bb223fe90fc..b9f90af7b5b 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/storage/MessageStore.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/storage/MessageStore.cs @@ -96,26 +96,20 @@ public async Task Add(string endpointId, IMessage message, uint timeTo // entity store. But that should be rare enough that it might be okay. Also it is better than not being able to forward the message. // Alternative is to add retry logic to the pump, but that is more complicated, and could affect performance. // TODO - Need to support transactions for these operations. The underlying storage layers support it. - using (MetricsV0.MessageStoreLatency(endpointId)) - { - await this.messageEntityStore.PutOrUpdate( - edgeMessageId, - new MessageWrapper(message), - (m) => - { - m.RefCount++; - return m; - }); - } + await this.messageEntityStore.PutOrUpdate( + edgeMessageId, + new MessageWrapper(message), + (m) => + { + m.RefCount++; + return m; + }); try { - using (MetricsV0.SequentialStoreLatency(endpointId)) - { - long offset = await sequentialStore.Append(new MessageRef(edgeMessageId, timeToLive)); - Events.MessageAdded(offset, edgeMessageId, endpointId); - return new MessageWithOffset(message, offset); - } + long offset = await sequentialStore.Append(new MessageRef(edgeMessageId, timeToLive)); + Events.MessageAdded(offset, edgeMessageId, endpointId); + return new MessageWithOffset(message, offset); } catch (Exception) { @@ -635,10 +629,6 @@ static class MetricsV0 RateUnit = TimeUnit.Seconds }; - public static IDisposable MessageStoreLatency(string identity) => Util.Metrics.MetricsV0.Latency(GetTags(identity), MessageEntityStorePutOrUpdateLatencyOptions); - - public static IDisposable SequentialStoreLatency(string identity) => Util.Metrics.MetricsV0.Latency(GetTags(identity), SequentialStoreAppendLatencyOptions); - internal static MetricTags GetTags(string id) { return new MetricTags("EndpointId", id); diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/Program.cs b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/Program.cs index 8726aaf5b43..f0efb42e79b 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/Program.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/Program.cs @@ -72,9 +72,6 @@ static async Task MainAsync(IConfigurationRoot configuration) var metricsProvider = container.Resolve(); Metrics.InitWithAspNet(metricsProvider, logger); // Note this requires App.UseMetricServer() to be called in Startup.cs - // Init V0 Metrics - MetricsV0.BuildMetricsCollector(configuration); - // EdgeHub and CloudConnectionProvider have a circular dependency. So need to Bind the EdgeHub to the CloudConnectionProvider. IEdgeHub edgeHub = await container.Resolve>(); ICloudConnectionProvider cloudConnectionProvider = await container.Resolve>(); diff --git a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/appsettings_hub.json b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/appsettings_hub.json index 9150e57f3e0..b8fb2e9215d 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/appsettings_hub.json +++ b/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Service/appsettings_hub.json @@ -66,12 +66,8 @@ "ConnectivityCheckFrequencySecs": 300, "MaxConnectedClients": 100, "CacheTokens": false, - "CollectMetrics": false, - "Metrics": { - "MetricsStoreType": "influxdb" - }, "AuthenticationMode": "CloudAndScope", "DeviceScopeCacheRefreshRateSecs": 3600, "CloudConnectionIdleTimeoutSecs": 3600, "CloseCloudConnectionOnIdleTimeout": true -} +} \ No newline at end of file diff --git a/edge-hub/src/Microsoft.Azure.Devices.Routing.Core/endpoints/StoringAsyncEndpointExecutor.cs b/edge-hub/src/Microsoft.Azure.Devices.Routing.Core/endpoints/StoringAsyncEndpointExecutor.cs index 04f5e2b2313..bf39324e357 100644 --- a/edge-hub/src/Microsoft.Azure.Devices.Routing.Core/endpoints/StoringAsyncEndpointExecutor.cs +++ b/edge-hub/src/Microsoft.Azure.Devices.Routing.Core/endpoints/StoringAsyncEndpointExecutor.cs @@ -61,19 +61,15 @@ public async Task Invoke(IMessage message, uint priority, uint timeToLiveSecs) throw new InvalidOperationException($"Endpoint executor for endpoint {this.Endpoint} is closed."); } - using (MetricsV0.StoreLatency(this.Endpoint.Id)) - { - // Get the checkpointer corresponding to the queue for this priority - ImmutableDictionary snapshot = this.prioritiesToFsms; - ICheckpointer checkpointer = snapshot[priority].Checkpointer; + // Get the checkpointer corresponding to the queue for this priority + ImmutableDictionary snapshot = this.prioritiesToFsms; + ICheckpointer checkpointer = snapshot[priority].Checkpointer; - IMessage storedMessage = await this.messageStore.Add(MessageQueueIdHelper.GetMessageQueueId(this.Endpoint.Id, priority), message, timeToLiveSecs); - checkpointer.Propose(storedMessage); - Events.AddMessageSuccess(this, storedMessage.Offset, priority, timeToLiveSecs); - } + IMessage storedMessage = await this.messageStore.Add(MessageQueueIdHelper.GetMessageQueueId(this.Endpoint.Id, priority), message, timeToLiveSecs); + checkpointer.Propose(storedMessage); + Events.AddMessageSuccess(this, storedMessage.Offset, priority, timeToLiveSecs); this.hasMessagesInQueue.Set(); - MetricsV0.StoredCountIncrement(this.Endpoint.Id, priority); } catch (Exception ex) { @@ -254,7 +250,6 @@ async Task SendMessagesPump() Events.ProcessingMessages(this, messages, priority); await this.ProcessMessages(messages, fsm); Events.SendMessagesSuccess(this, messages, priority); - MetricsV0.DrainedCountIncrement(this.Endpoint.Id, messages.Length, priority); // Only move on to the next priority if the queue for the current // priority is empty. If we processed any messages, break out of @@ -500,12 +495,6 @@ static class MetricsV0 RateUnit = TimeUnit.Seconds }; - public static void StoredCountIncrement(string identity, uint priority) => Edge.Util.Metrics.MetricsV0.CountIncrement(GetTagsWithPriority(identity, priority), EndpointMessageStoredCountOptions, 1); - - public static void DrainedCountIncrement(string identity, long amount, uint priority) => Edge.Util.Metrics.MetricsV0.CountIncrement(GetTagsWithPriority(identity, priority), EndpointMessageDrainedCountOptions, amount); - - public static IDisposable StoreLatency(string identity) => Edge.Util.Metrics.MetricsV0.Latency(GetTags(identity), EndpointMessageLatencyOptions); - internal static MetricTags GetTags(string id) { return new MetricTags("EndpointId", id); diff --git a/edge-util/src/Microsoft.Azure.Devices.Edge.Storage.RocksDb/ColumnFamilyDbStore.cs b/edge-util/src/Microsoft.Azure.Devices.Edge.Storage.RocksDb/ColumnFamilyDbStore.cs index 4875d1d310f..82b7a815824 100644 --- a/edge-util/src/Microsoft.Azure.Devices.Edge.Storage.RocksDb/ColumnFamilyDbStore.cs +++ b/edge-util/src/Microsoft.Azure.Devices.Edge.Storage.RocksDb/ColumnFamilyDbStore.cs @@ -42,12 +42,9 @@ public async Task> Get(byte[] key, CancellationToken cancellation Preconditions.CheckNotNull(key, nameof(key)); Option returnValue; - using (MetricsV0.DbGetLatency("all")) - { - Func operation = () => this.db.Get(key, this.Handle); - byte[] value = await operation.ExecuteUntilCancelled(cancellationToken); - returnValue = value != null ? Option.Some(value) : Option.None(); - } + Func operation = () => this.db.Get(key, this.Handle); + byte[] value = await operation.ExecuteUntilCancelled(cancellationToken); + returnValue = value != null ? Option.Some(value) : Option.None(); return returnValue; } @@ -57,11 +54,8 @@ public Task Put(byte[] key, byte[] value, CancellationToken cancellationToken) Preconditions.CheckNotNull(key, nameof(key)); Preconditions.CheckNotNull(value, nameof(value)); - using (MetricsV0.DbPutLatency("all")) - { - Action operation = () => this.db.Put(key, value, this.Handle); - return operation.ExecuteUntilCancelled(cancellationToken); - } + Action operation = () => this.db.Put(key, value, this.Handle); + return operation.ExecuteUntilCancelled(cancellationToken); } public Task Remove(byte[] key, CancellationToken cancellationToken) @@ -167,33 +161,5 @@ async Task IterateBatch(Action seeker, int batchSize, Func Util.Metrics.MetricsV0.Latency(GetTags(identity), DbPutLatencyOptions); - - public static IDisposable DbGetLatency(string identity) => Util.Metrics.MetricsV0.Latency(GetTags(identity), DbGetLatencyOptions); - - static MetricTags GetTags(string id) - { - return new MetricTags("EndpointId", id); - } - } } } diff --git a/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Microsoft.Azure.Devices.Edge.Util.csproj b/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Microsoft.Azure.Devices.Edge.Util.csproj index fbf6bd0531f..324c80f0a96 100644 --- a/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Microsoft.Azure.Devices.Edge.Util.csproj +++ b/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Microsoft.Azure.Devices.Edge.Util.csproj @@ -11,8 +11,6 @@ - - diff --git a/edge-util/src/Microsoft.Azure.Devices.Edge.Util/metrics/MetricsV0.cs b/edge-util/src/Microsoft.Azure.Devices.Edge.Util/metrics/MetricsV0.cs deleted file mode 100644 index 34dffa9ce7f..00000000000 --- a/edge-util/src/Microsoft.Azure.Devices.Edge.Util/metrics/MetricsV0.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -namespace Microsoft.Azure.Devices.Edge.Util.Metrics -{ - using System; - using System.Collections.Generic; - using System.Threading.Tasks; - using App.Metrics; - using App.Metrics.Counter; - using App.Metrics.Formatters.Json; - using App.Metrics.Gauge; - using App.Metrics.Scheduling; - using App.Metrics.Timer; - using Microsoft.Extensions.Configuration; - - public static class MetricsV0 - { - static readonly object gaugeListLock; - - static MetricsV0() - { - MetricsCollector = Option.None(); - Gauges = new List(); - gaugeListLock = new object(); - } - - public static Option MetricsCollector { get; private set; } - - static List Gauges { get; set; } - - public static void BuildMetricsCollector(IConfigurationRoot configuration) - { - bool collectMetrics = configuration.GetValue("CollectMetrics", false); - - if (collectMetrics) - { - IConfiguration metricsConfigurationSection = configuration.GetSection("Metrics"); - string metricsStoreType = metricsConfigurationSection.GetValue("MetricsStoreType"); - - if (metricsStoreType == "influxdb") - { - string metricsDbName = metricsConfigurationSection.GetValue("MetricsDbName", "metricsdatabase"); - string influxDbUrl = metricsConfigurationSection.GetValue("InfluxDbUrl", "http://influxdb:8086"); - IMetricsRoot metricsCollector = new MetricsBuilder() - .Report.ToInfluxDb( - options => - { - options.InfluxDb.BaseUri = new Uri(influxDbUrl); - options.InfluxDb.Database = metricsDbName; - options.InfluxDb.CreateDataBaseIfNotExists = true; - options.FlushInterval = TimeSpan.FromSeconds(10); - }).Build(); - MetricsCollector = Option.Some(metricsCollector); - StartReporting(metricsCollector); - } - else - { - string metricsStoreLocation = metricsConfigurationSection.GetValue("MetricsStoreLocation", "metrics"); - bool appendToMetricsFile = metricsConfigurationSection.GetValue("MetricsStoreAppend", false); - IMetricsRoot metricsCollector = new MetricsBuilder() - .Report.ToTextFile( - options => - { - options.MetricsOutputFormatter = new MetricsJsonOutputFormatter(); - options.AppendMetricsToTextFile = appendToMetricsFile; - options.FlushInterval = TimeSpan.FromSeconds(20); - options.OutputPathAndFileName = metricsStoreLocation; - }).Build(); - MetricsCollector = Option.Some(metricsCollector); - StartReporting(metricsCollector); - } - } - } - - public static void RegisterGaugeCallback(Action callback) - { - lock (gaugeListLock) - { - Gauges.Add(callback); - } - } - - public static void CountIncrement(MetricTags tags, CounterOptions options, long amount) - { - Preconditions.CheckNotNull(tags); - Preconditions.CheckNotNull(options); - Preconditions.CheckNotNull(amount); - - MetricsCollector.ForEach(mroot => { mroot.Measure.Counter.Increment(options, tags, amount); }); - } - - public static void CountDecrement(MetricTags tags, CounterOptions options, long amount) - { - Preconditions.CheckNotNull(tags); - Preconditions.CheckNotNull(options); - Preconditions.CheckNotNull(amount); - - MetricsCollector.ForEach(mroot => { mroot.Measure.Counter.Decrement(options, tags, amount); }); - } - - public static void CountIncrement(CounterOptions options, long amount) - { - Preconditions.CheckNotNull(options); - Preconditions.CheckNotNull(amount); - - MetricsCollector.ForEach(mroot => { mroot.Measure.Counter.Increment(options, amount); }); - } - - public static void CountDecrement(CounterOptions options, long amount) - { - Preconditions.CheckNotNull(options); - Preconditions.CheckNotNull(amount); - - MetricsCollector.ForEach(mroot => { mroot.Measure.Counter.Decrement(options, amount); }); - } - - public static IDisposable Latency(MetricTags tags, TimerOptions options) - { - Preconditions.CheckNotNull(tags); - Preconditions.CheckNotNull(options); - - return MetricsCollector.Map(mroot => mroot.Measure.Timer.Time(options, tags) as IDisposable).GetOrElse(() => new NullDisposable()); - } - - public static void SetGauge(GaugeOptions options, long amount) - { - Preconditions.CheckNotNull(options); - Preconditions.CheckNotNull(amount); - - MetricsCollector.ForEach(mroot => { mroot.Measure.Gauge.SetValue(options, amount); }); - } - - static void StartReporting(IMetricsRoot metricsCollector) - { - // Start reporting metrics every 5s - var scheduler = new AppMetricsTaskScheduler( - TimeSpan.FromSeconds(5), - async () => - { - foreach (var callback in Gauges) - { - callback(); - } - - await Task.WhenAll(metricsCollector.ReportRunner.RunAllAsync()); - }); - scheduler.Start(); - } - - class NullDisposable : IDisposable - { - public void Dispose() - { - } - } - } -} From 12defecac03763cfd6003562744d6e32da9a0d1c Mon Sep 17 00:00:00 2001 From: "REDMOND\\ancan" Date: Mon, 21 Dec 2020 14:16:36 -0800 Subject: [PATCH 2/3] fix merge --- ...sted_connectivity_deployment.template.json | 896 ------------------ 1 file changed, 896 deletions(-) delete mode 100644 e2e_deployment_files/nested_connectivity_deployment.template.json diff --git a/e2e_deployment_files/nested_connectivity_deployment.template.json b/e2e_deployment_files/nested_connectivity_deployment.template.json deleted file mode 100644 index 9dc542710dd..00000000000 --- a/e2e_deployment_files/nested_connectivity_deployment.template.json +++ /dev/null @@ -1,896 +0,0 @@ -{ - "modulesContent": { - "$edgeAgent": { - "properties.desired": { - "schemaVersion": "1.0", - "runtime": { - "type": "docker", - "settings": { - "minDockerVersion": "v1.25", - "loggingOptions": "", - "registryCredentials": { - "rc1": { - "username": "", - "password": "", - "address": "" - } - } - } - }, - "systemModules": { - "edgeAgent": { - "type": "docker", - "env": { - "UpstreamProtocol": { - "value": "" - }, - "experimentalfeatures__enabled": { - "value": "true" - }, - "experimentalfeatures__enableMetrics": { - "value": "true" - }, - "ExperimentalFeatures__EnableUploadLogs": { - "value": "true" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-agent:-linux-", - "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"9600/tcp\": [{\"HostPort\": \"9600\"}]}}}" - } - }, - "edgeHub": { - "type": "docker", - "settings": { - "image": "/microsoft/azureiotedge-hub:-linux-", - "createOptions": "{\"ExposedPorts\": {\"9600/tcp\": {}}, \"HostConfig\": {\"PortBindings\": {\"8883/tcp\": [{\"HostPort\": \"8883\"}],\"5671/tcp\": [{\"HostPort\": \"5671\"}],\"9600/tcp\": [{\"HostPort\": \"9601\"}]}}}" - }, - "env": { - "experimentalfeatures__enabled": { - "value": "true" - }, - "experimentalfeatures__enableMetrics": { - "value": "true" - }, - "NestedEdgeEnabled": { - "value": "true" - }, - "mqttBrokerSettings:enabled": { - "value": "true" - } - }, - "status": "running", - "restartPolicy": "always" - } - }, - "modules": { - "loadGen1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "messageFrequency": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "trackingId": { - "value": "" - }, - "transportType": { - "value": "Amqp" - }, - "outputName": { - "value": "output1" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-load-gen:-linux-", - "createOptions": "" - } - }, - "loadGen2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "messageFrequency": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "trackingId": { - "value": "" - }, - "transportType": { - "value": "Mqtt" - }, - "outputName": { - "value": "output2" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-load-gen:-linux-", - "createOptions": "" - } - }, - "directMethodSender1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "DirectMethodResultType": { - "value": "DirectMethodTestResult" - }, - "InvocationSource": { - "value": "Cloud" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "TargetModuleId": { - "value": "directMethodReceiver1" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "ReportingEndpointUrl": { - "value": "http://localhost:5001" - }, - "trackingId": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "directMethodReceiver1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "ClientTransportType": { - "value": "Amqp" - }, - "ReportingEndpointUrl": { - "value": "http://testResultCoordinator:5001" - }, - "trackingId": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-direct-method-receiver:-linux-", - "createOptions": "" - } - }, - "directMethodSender2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "DirectMethodResultType": { - "value": "DirectMethodTestResult" - }, - "InvocationSource": { - "value": "Cloud" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "TargetModuleId": { - "value": "directMethodReceiver2" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "ReportingEndpointUrl": { - "value": "http://localhost:5001" - }, - "trackingId": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "directMethodReceiver2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "ClientTransportType": { - "value": "Mqtt" - }, - "ReportingEndpointUrl": { - "value": "http://testResultCoordinator:5001" - }, - "trackingId": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-direct-method-receiver:-linux-", - "createOptions": "" - } - }, - "directMethodSender3": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "DirectMethodResultType": { - "value": "DirectMethodTestResult" - }, - "DirectMethodName": { - "value": "ping" - }, - "InvocationSource": { - "value": "Cloud" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "TargetModuleId": { - "value": "$edgeAgent" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "ReportingEndpointUrl": { - "value": "http://localhost:5001" - }, - "trackingId": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-direct-method-sender:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "relayer1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "transportType": { - "value": "Amqp" - }, - "inputName": { - "value": "input1" - }, - "outputName": { - "value": "output1" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-relayer:-linux-", - "createOptions": "" - } - }, - "relayer2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "transportType": { - "value": "Mqtt" - }, - "inputName": { - "value": "input2" - }, - "outputName": { - "value": "output2" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-relayer:-linux-", - "createOptions": "" - } - }, - "testResultCoordinator": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "Logging:LogLevel:Microsoft": { - "value": "Error" - }, - "trackingId": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "verificationDelay": { - "value": "" - }, - "eventHubConnectionString": { - "value": "" - }, - "ConsumerGroupName": { - "value": "" - }, - "optimizeForPerformance": { - "value": "" - }, - "logAnalyticsWorkspaceId": { - "value": "" - }, - "logAnalyticsSharedKey": { - "value": "" - }, - "logAnalyticsLogType": { - "value": "" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "logUploadEnabled": { - "value": "" - }, - "STORAGE_ACCOUNT_CONNECTION_STRING": { - "value": "" - }, - "NetworkControllerRunProfile": { - "value": "" - }, - "TEST_INFO": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-test-result-coordinator:-linux-", - "createOptions": "{\"HostConfig\": {\"PortBindings\": {\"5001/tcp\": [{\"HostPort\": \"5001\"}]}}}" - } - }, - "twinTester1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://localhost:5001" - }, - "TwinTestMode": { - "value": "TwinCloudOperations" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TargetModuleId": { - "value": "twinTester2" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "twinTester2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - }, - "TwinTestMode": { - "value": "TwinEdgeOperations" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TransportType": { - "value": "Amqp" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "" - } - }, - "twinTester3": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://localhost:5001" - }, - "TwinTestMode": { - "value": "TwinCloudOperations" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TargetModuleId": { - "value": "twinTester4" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "twinTester4": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - }, - "TwinTestMode": { - "value": "TwinEdgeOperations" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "ServiceClientConnectionString": { - "value": "" - }, - "TransportType": { - "value": "Mqtt" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-twin-tester:-linux-", - "createOptions": "" - } - }, - "deploymentTester1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "DEPLOYMENT_TESTER_MODE": { - "value": "Sender" - }, - "testStartDelay": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "trackingId": { - "value": "" - }, - "targetModuleId": { - "value": "deploymentTester2" - }, - "testResultCoordinatorUrl": { - "value": "http://localhost:5001" - }, - "DEPLOYMENT_UPDATE_PERIOD": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-deployment-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "deploymentTester2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "DEPLOYMENT_TESTER_MODE": { - "value": "Receiver" - }, - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-deployment-tester:-linux-", - "createOptions": "" - } - }, - "cloudToDeviceMessageSender1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "C2DMESSAGE_TESTER_MODE": { - "value": "Sender" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "trackingId": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "ReportingEndpointUrl": { - "value": "http://localhost:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "cloudToDeviceMessageReceiver1": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "C2DMESSAGE_TESTER_MODE": { - "value": "Receiver" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "transportType": { - "value": "Amqp" - }, - "ReportingEndpointUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", - "createOptions": "" - } - }, - "cloudToDeviceMessageSender2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "C2DMESSAGE_TESTER_MODE": { - "value": "Sender" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "trackingId": { - "value": "" - }, - "testDuration": { - "value": "" - }, - "testStartDelay": { - "value": "" - }, - "transportType": { - "value": "Mqtt" - }, - "ReportingEndpointUrl": { - "value": "http://localhost:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "cloudToDeviceMessageReceiver2": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "C2DMESSAGE_TESTER_MODE": { - "value": "Receiver" - }, - "IOT_HUB_CONNECTION_STRING": { - "value": "" - }, - "transportType": { - "value": "Mqtt" - }, - "ReportingEndpointUrl": { - "value": "http://testResultCoordinator:5001" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-c2dmessage-tester:-linux-", - "createOptions": "" - } - }, - "networkController": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "trackingId": { - "value": "" - }, - "testResultCoordinatorUrl": { - "value": "http://localhost:5001" - }, - "RunFrequencies__0__OfflineFrequency": { - "value": "" - }, - "RunFrequencies__0__OnlineFrequency": { - "value": "" - }, - "RunFrequencies__0__RunsCount": { - "value": "" - }, - "NetworkControllerRunProfile": { - "value": "" - }, - "StartAfter": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-network-controller:-linux-", - "createOptions": "{\"HostConfig\":{\"Privileged\":\"true\",\"NetworkMode\":\"host\",\"Binds\":[\"/var/run/docker.sock:/var/run/docker.sock\"]},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - }, - "metricsCollector": { - "version": "1.0", - "type": "docker", - "status": "running", - "restartPolicy": "always", - "env": { - "LogAnalyticsWorkspaceId": { - "value": "" - }, - "LogAnalyticsSharedKey": { - "value": "" - }, - "LogAnalyticsLogType": { - "value": "testMetricsV2" - }, - "MetricsEndpointsCSV": { - "value": "" - }, - "ScrapeFrequencyInSecs": { - "value": "" - }, - "UploadTarget": { - "value": "" - } - }, - "settings": { - "image": "/microsoft/azureiotedge-metrics-collector:-linux-", - "createOptions": "{\"HostConfig\":{\"NetworkMode\":\"host\"},\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}}}" - } - } - } - } - }, - "$edgeHub": { - "properties.desired": { - "schemaVersion": "1.0", - "routes": { - "loadGen1ToRelayer1": "FROM /messages/modules/loadGen1/outputs/output1 INTO BrokeredEndpoint(\"/modules/relayer1/inputs/input1\")", - "relayer1ToCloud": "FROM /messages/modules/relayer1/outputs/output1 INTO $upstream", - "loadGen2ToRelayer2": "FROM /messages/modules/loadGen2/outputs/output2 INTO BrokeredEndpoint(\"/modules/relayer2/inputs/input2\")", - "relayer2ToCloud": "FROM /messages/modules/relayer2/outputs/output2 INTO $upstream" - }, - "storeAndForwardConfiguration": { - "timeToLiveSecs": 86400 - } - } - }, - "metricsCollector": { - "properties.desired": { - "additionalTags": "" - } - }, - "testResultCoordinator": { - "properties.desired": { - "schemaVersion": "1.0", - "reportMetadataList": { - "reportMetadata1": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "loadGen1.send", - "ActualSource": "relayer1.receive", - "TestDescription": "messages | local | amqp" - }, - "reportMetadata2": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "relayer1.send", - "ActualSource": "relayer1.eventHub", - "TestDescription": "messages | upstream | amqp" - }, - "reportMetadata3": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "loadGen2.send", - "ActualSource": "relayer2.receive", - "TestDescription": "messages | local | mqtt" - }, - "reportMetadata4": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "relayer2.send", - "ActualSource": "relayer2.eventHub", - "TestDescription": "messages | upstream | mqtt" - }, - "reportMetadata5": { - "TestReportType": "TwinCountingReport", - "TwinTestPropertyType": "Desired", - "ExpectedSource": "twinTester1.desiredUpdated", - "ActualSource": "twinTester2.desiredReceived", - "TestDescription": "twin | desired property | amqp" - }, - "reportMetadata6": { - "TestReportType": "TwinCountingReport", - "TwinTestPropertyType": "Reported", - "ExpectedSource": "twinTester2.reportedReceived", - "ActualSource": "twinTester2.reportedUpdated", - "TestDescription": "twin | reported property | amqp" - }, - "reportMetadata7": { - "TestReportType": "TwinCountingReport", - "TwinTestPropertyType": "Desired", - "ExpectedSource": "twinTester3.desiredUpdated", - "ActualSource": "twinTester4.desiredReceived", - "TestDescription": "twin | desired property | mqtt" - }, - "reportMetadata8": { - "TestReportType": "TwinCountingReport", - "TwinTestPropertyType": "Reported", - "ExpectedSource": "twinTester4.reportedReceived", - "ActualSource": "twinTester4.reportedUpdated", - "TestDescription": "twin | reported property | mqtt" - }, - "reportMetadata9": { - "TestReportType": "DeploymentTestReport", - "ExpectedSource": "deploymentTester1.send", - "ActualSource": "deploymentTester2.receive", - "TestDescription": "deployment" - }, - "reportMetadata10": { - "TestReportType": "DirectMethodReport", - "SenderSource": "directMethodSender1.send", - "ReceiverSource": "directMethodReceiver1.receive", - "TolerancePeriod": "00:01:00", - "TestDescription": "direct method | cloud | amqp" - }, - "reportMetadata11": { - "TestReportType": "DirectMethodReport", - "SenderSource": "directMethodSender2.send", - "ReceiverSource": "directMethodReceiver2.receive", - "TolerancePeriod": "00:01:00", - "TestDescription": "direct method | cloud | mqtt" - }, - "reportMetadata12": { - "TestReportType": "DirectMethodReport", - "SenderSource": "directMethodSender3.send", - "TolerancePeriod": "00:01:00", - "TestDescription": "edge agent ping" - }, - "reportMetadata13": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "cloudToDeviceMessageSender1.send", - "ActualSource": "cloudToDeviceMessageReceiver1.receive", - "TestDescription": "C2D | amqp" - }, - "reportMetadata14": { - "TestReportType": "CountingReport", - "TestOperationResultType": "Messages", - "ExpectedSource": "cloudToDeviceMessageSender2.send", - "ActualSource": "cloudToDeviceMessageReceiver2.receive", - "TestDescription": "C2D | mqtt" - }, - "reportMetadata15": { - "TestReportType": "NetworkControllerReport", - "Source": "networkController", - "TestDescription": "network controller" - }, - "reportMetadata16": { - "TestReportType": "ErrorReport", - "TestDescription": "test configuration" - }, - "reportMetadata17": { - "TestReportType": "TestInfoReport", - "TestDescription": "test info" - } - } - } - } - } -} \ No newline at end of file From a32ea7a1fb44bf5ba934217981d770fa50d9743b Mon Sep 17 00:00:00 2001 From: Anca Antochi Date: Mon, 4 Jan 2021 11:18:21 -0800 Subject: [PATCH 3/3] remove metrics v0 doc (#4162) metrics v0 were removed so doc is not relevant --- doc/[Old]Metrics.md | 133 -------------------------------------------- 1 file changed, 133 deletions(-) delete mode 100644 doc/[Old]Metrics.md diff --git a/doc/[Old]Metrics.md b/doc/[Old]Metrics.md deleted file mode 100644 index 0780e712815..00000000000 --- a/doc/[Old]Metrics.md +++ /dev/null @@ -1,133 +0,0 @@ - -# **!!! IMPORTANT NOTE !!! The metrics described here were removed in release 1.1.0. They are superseded by [edge metrics V2](BuiltInMetrics.md).** - -## Metrics in EdgeHub - -EdgeHub is intrumented to collect the following metrics: - -| MetricName | Description | Unit | -| ------------- |:-------------:|:-----:| -| EdgeHubToCloudMessageLatencyMs | Time taken by EdgeHub to send a message to the cloud | Milliseconds** | -| EdgeHubToCloudMessageSentCount | Number of messages sent by EdgeHub to the cloud | Count resets each reporting interval* | -| EdgeHubConnectedClientGauge | Number of clients/devices currently connected to EdgeHub | Count | -| EndpointMessageStoredLatencyMs | Time taken by EdgeHub to acknowledge receipt of a message | Milliseconds** | -| EndpointMessageStoredCount | Total number of messages stored by EdgeHub | Last recorded total | -| EndpointMessageDrainedCount | Total number of messages sent to a message endpoint by EdgeHub | Last recorded total | -| MessageEntityStorePutOrUpdateLatencyMs | Time taken by EdgeHub to record a message in an internal reference counting db store | Milliseconds** | -| SequentialStoreAppendLatencyMs | Time taken by EdgeHub to store a message in an append log | Milliseconds** | -| DbGetLatencyMs | Time taken by EdgeHub to get a message from the store-and-forward db | Milliseconds** | -| DbPutLatencyMs | Time taken by EdgeHub to write a message to the store-and-forward db | Milliseconds** | - -\* EdgeHub reports metrics to InfluxDb every 5s. Counters are reset after each reporting interval so that if the time series is summed up over a large interval, it returns the true sum as opposed to a sum of sums. - -\** Latency measurements are recorded per operation being measured. The Edge runtime does not aggregate measurements. The measurements are reported to InfluxDb at a regular interval, currently set to 5s. Aggregations can be done via queries from the database. - -## Configuring EdgeHub to record metrics - -EdgeHub can be configured to record metrics by setting an environment variable called **'CollectMetrics'** to **'true'**. -This can be done via the portal in the 'Configure advanced Edge Runtime settings' section. If CollectMetrics is set to true, the default -storage location for metrics is an InfluxDb container running on the same docker network as EdgeHub. - -The following defaults can be modified by setting environment variables in EdgeHub: - -| Environment variable | Description | Default | -|----------------------|:-----------:|:--------:| -| Metrics__MetricsDbName | Name of metrics database in InfluxDb | metricsdatabase | -| Metrics__InfluxDbUrl | Network address of InfluxDb | http://influxdb:8086 | - -## Creating a deployment for metrics collection - -Besides setting the EdgeHub environment variables as described in the previous section, an InfluxDb container needs to be added to the -deployment as a module with the following configuration: - -``` -"influxdb": { - "type": "docker", - "settings": { - "image": "registry.hub.docker.com/library/influxdb:latest", - "createOptions": "" - }, - "version": "1.0", - "status": "running", - "restartPolicy": "always" -} -``` -## Viewing metrics from EdgeHub - -Metrics captured by EdgeHub can be viewed using Chronograf (https://www.influxdata.com/time-series-platform/chronograf/). A Chronograf module can be -added to the deployment with the following parameters: - -``` -"chronograf": { - "type": "docker", - "settings": { - "image": "registry.hub.docker.com/library/chronograf:latest", - "createOptions": "{\r\n \"PortBindings\": {\r\n \"8888/tcp\": [\r\n {\r\n \"HostPort\": \"8888\"\r\n }]\r\n }\r\n}" - }, - "status": "running", - "restartPolicy": "always", - "version": "1.0" -} -``` -After the modules are deployed, Chronograf can be reached at http://localhost:8888. InfluxDb should be configured as a data source for Chronograf. The InfluxDb instance should be reachable at http://influxdb:8086. - -## Example InfluxDb queries - -For example InfluxDb queries, please look at https://github.com/Azure/iotedge/blob/master/tools/snitch/snitcher/src/settings.yaml#L16 - -## Collecting CPU and memory stats from EdgeHub and other containers - -A telegraf container can be added to the deployment to collect stats about all containers in the deployment. Telegraf uses a configuration file on the device to configure itself. Azure IoT Edge deployments can only mount files in to a container but cannot pass a configuration file to the device from the cloud. For this reason, the configuration has to be done on the device as follows: -``` -mkdir telegraf -docker run --rm telegraf telegraf config > telegraf/telegraf.conf -``` -Edit the file to reflect the following changes: -``` -[[outputs.influxdb]] - urls = ["http://influxdb:8086"] -[[inputs.docker]] - endpoint = "unix:///var/run/docker.sock" -``` -The telegraf container can be run manually on the device as follows: -``` -docker run -d --name=telegraf --net=azure-iot-edge -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf -``` -Or the container can be added to an Azure IoT Edge deployment using the following deployment information: -``` -"telegraf": { - "type": "docker", - "settings": { - "image": "registry.hub.docker.com/library/telegraf:latest", - "createOptions": "{\"HostConfig\":{\"Binds\":[\"/var/run/docker.sock:/var/run/docker.sock\",\"/home/jadsa/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf\"]}}" - }, - "version": "1.0", - "status": "running", - "restartPolicy": "always" -} -``` -After telegraf is running on the device it will emit metrics about the docker containers. These metrics can be viewed in Chronograf under the telegraf.autogen metrics database. -More details on telegraf docker images can be found at https://hub.docker.com/_/telegraf/. - -## Setting up alerts - -Alerts can be setup using the Kapacitor component of the TICK stack. Kapacitor can be run manually on the device as follows: -``` -mkdir kapacitor -docker run --rm kapacitor kapacitord config > kapacitor/kapacitor.conf -docker run -d --name=kapacitor --net=azure-iot-edge -p 9092:9092 -v $PWD/kapacitor/kapacitor.conf:/etc/kapacitor/kapacitor.conf:ro kapacitor -``` -Alternatively, the container can be run via an Azure IoT Edge deployment using the following deployment information: -``` -"kapacitor": { - "type": "docker", - "settings": { - "image": "registry.hub.docker.com/library/kapacitor:latest", - "createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/jadsa/kapacitor/kapacitor.conf:/etc/kapacitor/kapacitor.conf\"]}}" - }, - "status": "running", - "restartPolicy": "always", - "version": "1.0" -} -``` -Details on setting up alerts using Kapacitor can be found at https://docs.influxdata.com/kapacitor/v1.5/working/kapa-and-chrono/. More details on kapacitor docker images can be found at https://hub.docker.com/_/kapacitor/.