Repository: microsoft/ApplicationInsights-node.js
Pull request #1015 (2022-09-22 21:07:10)

[Preview] Add custom metrics functionality
Removed old metrics exporter
Disabling Statsbeat metrics


Patch:
diff --git a/README.md b/README.md
index dc8655e..580c691 100644
--- a/README.md
+++ b/README.md
@@ -201,7 +201,6 @@ appInsights.setup("<YOUR_CONNECTION_STRING>")
     .setSendLiveMetrics(false)
     .setAutoCollectHeartbeat(false)
     .setInternalLogging(false, true)
-    .setDistributedTracingMode(appInsights.DistributedTracingModes.AI_AND_W3C)
     .start();
 ```
 
@@ -220,49 +219,29 @@ client.config.PROPERTYNAME = VALUE;
 These properties are client specific, so you can configure `appInsights.defaultClient`
 separately from clients created with `new appInsights.TelemetryClient()`.
 
-| Property                        | Description                                                                                                |
-| ------------------------------- |------------------------------------------------------------------------------------------------------------|
-| instrumentationKey              | Application Insights Instrumentation Key                                                                   |
-| endpointUrl                     | The ingestion endpoint to send telemetry payloads to                                                       |
-| proxyHttpUrl                    | A proxy server for SDK HTTP traffic (Optional, Default pulled from `http_proxy` environment variable)      |
-| proxyHttpsUrl                   | A proxy server for SDK HTTPS traffic (Optional, Default pulled from `https_proxy` environment variable)    |
-| maxBatchSize                    | The maximum number of telemetry items to include in a payload to the ingestion endpoint (Default `250`)    |
-| maxBatchIntervalMs              | The maximum amount of time to wait to for a payload to reach maxBatchSize (Default `15000`)                |
-| disableAppInsights              | A flag indicating if telemetry transmission is disabled (Default `false`)                                  |
-| samplingPercentage              | The percentage of telemetry items tracked that should be transmitted (Default `100`)                       |
-| correlationIdRetryIntervalMs    | The time to wait before retrying to retrieve the id for cross-component correlation (Default `30000`)      |
-| correlationHeaderExcludedDomains| A list of domains to exclude from cross-component correlation header injection (Default See [Config.ts][]) |
-| ignoreLegacyHeaders             | Disable including legacy headers in outgoing requests, x-ms-request-id                                     |
-| distributedTracingMode          | Sets the distributed tracing modes (Default=AI)                                                            |
-| enableAutoCollectExternalLoggers| Sets the state of console. If true logger activity will be sent to Application Insights |
-| enableAutoCollectConsole        | Sets the state of logger tracking (enabled by default for third-party loggers only). If true, logger auto collection will include console.log calls (default false) |
-| enableAutoCollectExceptions     | Sets the state of exception tracking (enabled by default). If true uncaught exceptions will be sent to Application Insights |
-| enableAutoCollectPerformance    | Sets the state of performance tracking (enabled by default). If true performance counters will be collected every second and sent to Application Insights |
-| enableAutoCollectExtendedMetrics| Sets the state of performance tracking (enabled by default). If true, extended metrics counters will be collected every minute and sent to Application Insights |
-| enableAutoCollectPreAggregatedMetrics | Sets the state of pre aggregated metrics tracking (enabled by default). If true pre aggregated metrics will be collected every minute and sent to Application Insights |
-| enableAutoCollectHeartbeat      | Sets the state of request tracking (enabled by default). If true HeartBeat metric data will be collected every 15 minutes and sent to Application Insights |
-| enableAutoCollectRequests      | Sets the state of request tracking (enabled by default). If true requests will be sent to Application Insights |
-| enableAutoCollectDependencies  | Sets the state of dependency tracking (enabled by default). If true dependencies will be sent to Application Insights |
-| enableAutoDependencyCorrelation| Sets the state of automatic dependency correlation (enabled by default). If true dependencies will be correlated with requests |
-| enableUseAsyncHooks            | Sets the state of automatic dependency correlation (enabled by default). If true, forces use of experimental async_hooks module to provide correlation. If false, instead uses only patching-based techniques. If left blank, the best option is chosen for you based on your version of Node.js. |
-| enableUseDiskRetryCaching     | If true events that occurred while client is offline will be cached on disk |
-| enableResendInterval          | The wait interval for resending cached events. |
-| enableMaxBytesOnDisk          | The maximum size (in bytes) that the created temporary directory for cache events can grow to, before caching is disabled. |
-| enableInternalDebugLogging    | Enables debug and warning logging for AppInsights itself. If true, enables debug logging |
-| enableInternalWarningLogging  | Enables debug and warning logging for AppInsights itself. If true, enables warning logging |
-| enableSendLiveMetrics         | Enables communication with Application Insights Live Metrics. If true, enables communication with the live metrics service |
-| disableAllExtendedMetrics     | Disable all environment variables set |
-| extendedMetricDisablers       | Disable individual environment variables set. `"extendedMetricDisablers": "..."` |
-| noDiagnosticChannel           | In order to track context across asynchronous calls, some changes are required in third party libraries such as mongodb and redis. By default ApplicationInsights will use diagnostic-channel-publishers to monkey-patch some of these libraries. This property is to disable the feature. Note that by setting this flag, events may no longer be correctly associated with the right operation.  |
-| noPatchModules                | Disable individual monkey-patches. Set `noPatchModules` to a comma separated list of packages to disable. e.g. `"noPatchModules": "console,redis"` to avoid patching the console and redis packages. The following modules are available: `azuresdk, bunyan, console, mongodb, mongodb-core, mysql, redis, winston, pg`, and `pg-pool`. Visit the [diagnostic-channel-publishers' README](https://github.com/microsoft/node-diagnostic-channel/blob/master/src/diagnostic-channel-publishers/README.md) for information about exactly which versions of these packages are patched. |
-| noHttpAgentKeepAlive          | HTTPS without a passed in agent |
-| httpAgent                       | An http.Agent to use for SDK HTTP traffic (Optional, Default undefined)                                    |
-| httpsAgent                      | An https.Agent to use for SDK HTTPS traffic (Optional, Default undefined)       
-| aadTokenCredential| Azure Credential instance to be used to authenticate the App. [AAD Identity Credential Classes](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credential-classes) |                            |
+|Property|Description|Default|
+| ------------------------------- |------------------------------------------------------------------------------------------------------------|-------|
+| endpointUrl                     | The ingestion endpoint to send telemetry payloads.to                                                       | |
+| samplingPercentage              | The percentage of telemetry items tracked that should be transmitted.                       | 100|                             |                                                  |
+| enableAutoCollectExternalLoggers| Sets the state of console. If true logger activity will be sent to Application Insights. |
+| enableAutoCollectConsole        | Sets the state of logger tracking (enabled by default for third-party loggers only). If true, logger auto collection will include console.log calls. | false |
+| enableAutoCollectExceptions     | Sets the state of exception tracking. If true uncaught exceptions will be sent to Application Insights | true|
+| enableAutoCollectPerformance    | Sets the state of performance tracking. If true performance counters will be collected every second and sent to Application Insights | true|
+| enableAutoCollectExtendedMetrics| Sets the state of performance tracking. If true, extended metrics counters will be collected every minute and sent to Application Insights | true|
+| enableAutoCollectPreAggregatedMetrics | Sets the state of pre aggregated metrics tracking. If true pre aggregated metrics will be collected every minute and sent to Application Insights | true|
+| enableAutoCollectHeartbeat      | Sets the state of request tracking. If true HeartBeat metric data will be collected every 15 minutes and sent to Application Insights | true|
+| enableAutoCollectRequests      | Sets the state of request tracking. If true requests will be sent to Application Insights | true|
+| enableAutoCollectDependencies  | Sets the state of dependency tracking. If true dependencies will be sent to Application Insights | true|
+| enableInternalDebugLogging    | Enables debug and warning logging for AppInsights itself. If true, enables debug logging |true|
+| enableInternalWarningLogging  | Enables debug and warning logging for AppInsights itself. If true, enables warning logging |true|
+| enableSendLiveMetrics         | Enables communication with Application Insights Live Metrics. If true, enables communication with the live metrics service |false|
+| disableAllExtendedMetrics     | Disable all environment variables set |true|
+| extendedMetricDisablers       | Disable individual environment variables set. `"extendedMetricDisablers": "..."` ||
+| aadTokenCredential| Azure Credential instance to be used to authenticate the App. [AAD Identity Credential Classes](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#credential-classes) | |
 
 [Config.ts]: https://github.com/microsoft/ApplicationInsights-node.js/blob/develop/Library/Config.ts
 
-All these properties except httpAgent, httpsAgent and aadTokenCredential could be configured using configuration file `applicationinsights.json` located under root folder of applicationinsights package installation folder, Ex: `node_modules/applicationinsights`. These configuration values will be applied to all TelemetryClients created in the SDK. 
+All these properties except aadTokenCredential could be configured using configuration file `applicationinsights.json` located under root folder of applicationinsights package installation folder, Ex: `node_modules/applicationinsights`. These configuration values will be applied to all TelemetryClients created in the SDK. 
 
 
 ```javascript
@@ -350,16 +329,6 @@ Currently, the native metrics package performs autocollection of Garbage Collect
 - **Event Loop:** How many ticks occurred and how much CPU time was spent in total.
 - **Heap vs Non-Heap:** How much of your app's memory usage is in the heap or non-heap.
 
-### Distributed Tracing Modes
-By default, this SDK will send headers understood by other applications/services instrumented with an Application Insights SDK. You can optionally enable sending/receiving of [W3C Trace Context](https://github.com/w3c/trace-context) headers in addition to the existing AI headers, so you will not break correlation with any of your existing legacy services. Enabling W3C headers will allow your app to correlate with other services not instrumented with Application Insights, but do adopt this W3C standard.
-
-```js
-const appInsights = require("applicationinsights");
-appInsights
-  .setup("<YOUR_CONNECTION_STRING>")
-  .setDistributedTracingMode(appInsights.DistributedTracingModes.AI_AND_W3C)
-  .start()
-```
 
 ## Track custom telemetry
 
diff --git a/package-lock.json b/package-lock.json
index 3222211..bceacdb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -17,17 +17,17 @@
         "@opentelemetry/api": "^1.2.0",
         "@opentelemetry/api-metrics": "^0.32.0",
         "@opentelemetry/core": "^1.6.0",
-        "@opentelemetry/instrumentation": "^0.32.0",
-        "@opentelemetry/instrumentation-http": "^0.32.0",
+        "@opentelemetry/instrumentation": "^0.33.0",
+        "@opentelemetry/instrumentation-http": "^0.33.0",
         "@opentelemetry/instrumentation-mongodb": "^0.32.0",
         "@opentelemetry/instrumentation-mysql": "^0.31.0",
         "@opentelemetry/instrumentation-pg": "^0.31.0",
         "@opentelemetry/instrumentation-redis": "^0.33.0",
         "@opentelemetry/instrumentation-redis-4": "^0.32.0",
-        "@opentelemetry/sdk-metrics": "^0.32.0",
-        "@opentelemetry/sdk-trace-base": "^1.6.0",
-        "@opentelemetry/sdk-trace-node": "^1.6.0",
-        "@opentelemetry/semantic-conventions": "^1.6.0",
+        "@opentelemetry/sdk-metrics": "^0.33.0",
+        "@opentelemetry/sdk-trace-base": "^1.7.0",
+        "@opentelemetry/sdk-trace-node": "^1.7.0",
+        "@opentelemetry/semantic-conventions": "^1.7.0",
         "diagnostic-channel": "1.1.0",
         "diagnostic-channel-publishers": "1.0.4",
         "semver": "^7.3.5"
@@ -1028,11 +1028,11 @@
       }
     },
     "node_modules/@opentelemetry/instrumentation": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
-      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.33.0.tgz",
+      "integrity": "sha512-8joPjKJ6TznNt04JbnzZG+m1j/4wm1OIrX7DEw/V5lyZ9/2fahIqG72jeZ26VKOZnLOpVzUUnU/dweURqBzT3Q==",
       "dependencies": {
-        "@opentelemetry/api-metrics": "0.32.0",
+        "@opentelemetry/api-metrics": "0.33.0",
         "require-in-the-middle": "^5.0.3",
         "semver": "^7.3.2",
         "shimmer": "^1.2.1"
@@ -1045,13 +1045,15 @@
       }
     },
     "node_modules/@opentelemetry/instrumentation-http": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.32.0.tgz",
-      "integrity": "sha512-EbNdJl6IjouphbxPVGV8/utiqB2DhveyH5TD6vxjc2OXlQ3A/mKg3fYSSWB+rYQBuuli+jWQfBJe2ntOFZtTMw==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.33.0.tgz",
+      "integrity": "sha512-8Ny31T1SEX9OKp89sMfLV7tP8WO5m6iBTZgmTC53Wu4t8kcNH6Y00tooMzypL/PgVtglgPXzv4T5mFLABo59AA==",
       "dependencies": {
-        "@opentelemetry/core": "1.6.0",
-        "@opentelemetry/instrumentation": "0.32.0",
-        "@opentelemetry/semantic-conventions": "1.6.0",
+        "@opentelemetry/api-metrics": "0.33.0",
+        "@opentelemetry/core": "1.7.0",
+        "@opentelemetry/instrumentation": "0.33.0",
+        "@opentelemetry/sdk-metrics": "0.33.0",
+        "@opentelemetry/semantic-conventions": "1.7.0",
         "semver": "^7.3.5"
       },
       "engines": {
@@ -1061,24 +1063,13 @@
         "@opentelemetry/api": "^1.0.0"
       }
     },
-    "node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/core": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.6.0.tgz",
-      "integrity": "sha512-MsEhsyCTfYme6frK8/AqEWwbS9SB3Ta5bjgz4jPQJjL7ijUM3JiLVvqh/kHo1UlUjbUbLmGG7jA5Nw4d7SMcLQ==",
+    "node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/api-metrics": {
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+      "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
       "dependencies": {
-        "@opentelemetry/semantic-conventions": "1.6.0"
-      },
-      "engines": {
-        "node": ">=14"
+        "@opentelemetry/api": "^1.0.0"
       },
-      "peerDependencies": {
-        "@opentelemetry/api": ">=1.0.0 <1.3.0"
-      }
-    },
-    "node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/semantic-conventions": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.6.0.tgz",
-      "integrity": "sha512-aPfcBeLErM/PPiAuAbNFLN5sNbZLc3KZlar27uohllN8Zs6jJbHyJU1y7cMA6W/zuq+thkaG8mujiS+3iD/FWQ==",
       "engines": {
         "node": ">=14"
       }
@@ -1098,6 +1089,23 @@
         "@opentelemetry/api": "^1.0.0"
       }
     },
+    "node_modules/@opentelemetry/instrumentation-mongodb/node_modules/@opentelemetry/instrumentation": {
+      "version": "0.32.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "dependencies": {
+        "@opentelemetry/api-metrics": "0.32.0",
+        "require-in-the-middle": "^5.0.3",
+        "semver": "^7.3.2",
+        "shimmer": "^1.2.1"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      }
+    },
     "node_modules/@opentelemetry/instrumentation-mysql": {
       "version": "0.31.1",
       "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-mysql/-/instrumentation-mysql-0.31.1.tgz",
@@ -1114,6 +1122,23 @@
         "@opentelemetry/api": "^1.0.0"
       }
     },
+    "node_modules/@opentelemetry/instrumentation-mysql/node_modules/@opentelemetry/instrumentation": {
+      "version": "0.32.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "dependencies": {
+        "@opentelemetry/api-metrics": "0.32.0",
+        "require-in-the-middle": "^5.0.3",
+        "semver": "^7.3.2",
+        "shimmer": "^1.2.1"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      }
+    },
     "node_modules/@opentelemetry/instrumentation-pg": {
       "version": "0.31.1",
       "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-pg/-/instrumentation-pg-0.31.1.tgz",
@@ -1131,6 +1156,23 @@
         "@opentelemetry/api": "^1.0.0"
       }
     },
+    "node_modules/@opentelemetry/instrumentation-pg/node_modules/@opentelemetry/instrumentation": {
+      "version": "0.32.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "dependencies": {
+        "@opentelemetry/api-metrics": "0.32.0",
+        "require-in-the-middle": "^5.0.3",
+        "semver": "^7.3.2",
+        "shimmer": "^1.2.1"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      }
+    },
     "node_modules/@opentelemetry/instrumentation-redis": {
       "version": "0.33.0",
       "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-redis/-/instrumentation-redis-0.33.0.tgz",
@@ -1162,6 +1204,51 @@
         "@opentelemetry/api": "^1.0.0"
       }
     },
+    "node_modules/@opentelemetry/instrumentation-redis-4/node_modules/@opentelemetry/instrumentation": {
+      "version": "0.32.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "dependencies": {
+        "@opentelemetry/api-metrics": "0.32.0",
+        "require-in-the-middle": "^5.0.3",
+        "semver": "^7.3.2",
+        "shimmer": "^1.2.1"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      }
+    },
+    "node_modules/@opentelemetry/instrumentation-redis/node_modules/@opentelemetry/instrumentation": {
+      "version": "0.32.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "dependencies": {
+        "@opentelemetry/api-metrics": "0.32.0",
+        "require-in-the-middle": "^5.0.3",
+        "semver": "^7.3.2",
+        "shimmer": "^1.2.1"
+      },
+      "engines": {
+        "node": ">=14"
+      },
+      "peerDependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      }
+    },
+    "node_modules/@opentelemetry/instrumentation/node_modules/@opentelemetry/api-metrics": {
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+      "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
+      "dependencies": {
+        "@opentelemetry/api": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=14"
+      }
+    },
     "node_modules/@opentelemetry/propagator-b3": {
       "version": "1.7.0",
       "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.7.0.tgz",
@@ -1206,13 +1293,13 @@
       }
     },
     "node_modules/@opentelemetry/sdk-metrics": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-0.32.0.tgz",
-      "integrity": "sha512-zC9RCOIsXRqOHWmWfcxArtDHbip2/jaIH1yu/OKau/shDZYFluAxY6zAEYIb4YEAzKKEF+fpaoRgpodDWNGVGA==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-0.33.0.tgz",
+      "integrity": "sha512-ZXPixOlTd/FHLwpkmm5nTpJE7bZOPfmbSz8hBVFCEHkXE1aKEKaM38UFnZ+2xzOY1tDsDwyxEiiBiDX8y3039A==",
       "dependencies": {
-        "@opentelemetry/api-metrics": "0.32.0",
-        "@opentelemetry/core": "1.6.0",
-        "@opentelemetry/resources": "1.6.0",
+        "@opentelemetry/api-metrics": "0.33.0",
+        "@opentelemetry/core": "1.7.0",
+        "@opentelemetry/resources": "1.7.0",
         "lodash.merge": "4.6.2"
       },
       "engines": {
@@ -1288,39 +1375,13 @@
         "node": ">=8.12.0"
       }
     },
-    "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/core": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.6.0.tgz",
-      "integrity": "sha512-MsEhsyCTfYme6frK8/AqEWwbS9SB3Ta5bjgz4jPQJjL7ijUM3JiLVvqh/kHo1UlUjbUbLmGG7jA5Nw4d7SMcLQ==",
-      "dependencies": {
-        "@opentelemetry/semantic-conventions": "1.6.0"
-      },
-      "engines": {
-        "node": ">=14"
-      },
-      "peerDependencies": {
-        "@opentelemetry/api": ">=1.0.0 <1.3.0"
-      }
-    },
-    "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/resources": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.6.0.tgz",
-      "integrity": "sha512-07GlHuq72r2rnJugYVdGumviQvfrl8kEPidkZSVoseLVfIjV7nzxxt5/vqs9pK7JItWOrvjRdr/jTBVayFBr/w==",
+    "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/api-metrics": {
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+      "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
       "dependencies": {
-        "@opentelemetry/core": "1.6.0",
-        "@opentelemetry/semantic-conventions": "1.6.0"
-      },
-      "engines": {
-        "node": ">=14"
+        "@opentelemetry/api": "^1.0.0"
       },
-      "peerDependencies": {
-        "@opentelemetry/api": ">=1.0.0 <1.3.0"
-      }
-    },
-    "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/semantic-conventions": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.6.0.tgz",
-      "integrity": "sha512-aPfcBeLErM/PPiAuAbNFLN5sNbZLc3KZlar27uohllN8Zs6jJbHyJU1y7cMA6W/zuq+thkaG8mujiS+3iD/FWQ==",
       "engines": {
         "node": ">=14"
       }
@@ -7254,39 +7315,46 @@
       }
     },
     "@opentelemetry/instrumentation": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
-      "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.33.0.tgz",
+      "integrity": "sha512-8joPjKJ6TznNt04JbnzZG+m1j/4wm1OIrX7DEw/V5lyZ9/2fahIqG72jeZ26VKOZnLOpVzUUnU/dweURqBzT3Q==",
       "requires": {
-        "@opentelemetry/api-metrics": "0.32.0",
+        "@opentelemetry/api-metrics": "0.33.0",
         "require-in-the-middle": "^5.0.3",
         "semver": "^7.3.2",
         "shimmer": "^1.2.1"
+      },
+      "dependencies": {
+        "@opentelemetry/api-metrics": {
+          "version": "0.33.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+          "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
+          "requires": {
+            "@opentelemetry/api": "^1.0.0"
+          }
+        }
       }
     },
     "@opentelemetry/instrumentation-http": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.32.0.tgz",
-      "integrity": "sha512-EbNdJl6IjouphbxPVGV8/utiqB2DhveyH5TD6vxjc2OXlQ3A/mKg3fYSSWB+rYQBuuli+jWQfBJe2ntOFZtTMw==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.33.0.tgz",
+      "integrity": "sha512-8Ny31T1SEX9OKp89sMfLV7tP8WO5m6iBTZgmTC53Wu4t8kcNH6Y00tooMzypL/PgVtglgPXzv4T5mFLABo59AA==",
       "requires": {
-        "@opentelemetry/core": "1.6.0",
-        "@opentelemetry/instrumentation": "0.32.0",
-        "@opentelemetry/semantic-conventions": "1.6.0",
+        "@opentelemetry/api-metrics": "0.33.0",
+        "@opentelemetry/core": "1.7.0",
+        "@opentelemetry/instrumentation": "0.33.0",
+        "@opentelemetry/sdk-metrics": "0.33.0",
+        "@opentelemetry/semantic-conventions": "1.7.0",
         "semver": "^7.3.5"
       },
       "dependencies": {
-        "@opentelemetry/core": {
-          "version": "1.6.0",
-          "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.6.0.tgz",
-          "integrity": "sha512-MsEhsyCTfYme6frK8/AqEWwbS9SB3Ta5bjgz4jPQJjL7ijUM3JiLVvqh/kHo1UlUjbUbLmGG7jA5Nw4d7SMcLQ==",
+        "@opentelemetry/api-metrics": {
+          "version": "0.33.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+          "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
           "requires": {
-            "@opentelemetry/semantic-conventions": "1.6.0"
+            "@opentelemetry/api": "^1.0.0"
           }
-        },
-        "@opentelemetry/semantic-conventions": {
-          "version": "1.6.0",
-          "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.6.0.tgz",
-          "integrity": "sha512-aPfcBeLErM/PPiAuAbNFLN5sNbZLc3KZlar27uohllN8Zs6jJbHyJU1y7cMA6W/zuq+thkaG8mujiS+3iD/FWQ=="
         }
       }
     },
@@ -7297,6 +7365,19 @@
       "requires": {
         "@opentelemetry/instrumentation": "^0.32.0",
         "@opentelemetry/semantic-conventions": "^1.0.0"
+      },
+      "dependencies": {
+        "@opentelemetry/instrumentation": {
+          "version": "0.32.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+          "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+          "requires": {
+            "@opentelemetry/api-metrics": "0.32.0",
+            "require-in-the-middle": "^5.0.3",
+            "semver": "^7.3.2",
+            "shimmer": "^1.2.1"
+          }
+        }
       }
     },
     "@opentelemetry/instrumentation-mysql": {
@@ -7307,6 +7388,19 @@
         "@opentelemetry/instrumentation": "^0.32.0",
         "@opentelemetry/semantic-conventions": "^1.0.0",
         "@types/mysql": "2.15.19"
+      },
+      "dependencies": {
+        "@opentelemetry/instrumentation": {
+          "version": "0.32.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+          "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+          "requires": {
+            "@opentelemetry/api-metrics": "0.32.0",
+            "require-in-the-middle": "^5.0.3",
+            "semver": "^7.3.2",
+            "shimmer": "^1.2.1"
+          }
+        }
       }
     },
     "@opentelemetry/instrumentation-pg": {
@@ -7318,6 +7412,19 @@
         "@opentelemetry/semantic-conventions": "^1.0.0",
         "@types/pg": "8.6.1",
         "@types/pg-pool": "2.0.3"
+      },
+      "dependencies": {
+        "@opentelemetry/instrumentation": {
+          "version": "0.32.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+          "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+          "requires": {
+            "@opentelemetry/api-metrics": "0.32.0",
+            "require-in-the-middle": "^5.0.3",
+            "semver": "^7.3.2",
+            "shimmer": "^1.2.1"
+          }
+        }
       }
     },
     "@opentelemetry/instrumentation-redis": {
@@ -7328,6 +7435,19 @@
         "@opentelemetry/instrumentation": "^0.32.0",
         "@opentelemetry/semantic-conventions": "^1.0.0",
         "@types/redis": "2.8.31"
+      },
+      "dependencies": {
+        "@opentelemetry/instrumentation": {
+          "version": "0.32.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+          "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+          "requires": {
+            "@opentelemetry/api-metrics": "0.32.0",
+            "require-in-the-middle": "^5.0.3",
+            "semver": "^7.3.2",
+            "shimmer": "^1.2.1"
+          }
+        }
       }
     },
     "@opentelemetry/instrumentation-redis-4": {
@@ -7337,6 +7457,19 @@
       "requires": {
         "@opentelemetry/instrumentation": "^0.32.0",
         "@opentelemetry/semantic-conventions": "^1.0.0"
+      },
+      "dependencies": {
+        "@opentelemetry/instrumentation": {
+          "version": "0.32.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.32.0.tgz",
+          "integrity": "sha512-y6ADjHpkUz/v1nkyyYjsQa/zorhX+0qVGpFvXMcbjU4sHnBnC02c6wcc93sIgZfiQClIWo45TGku1KQxJ5UUbQ==",
+          "requires": {
+            "@opentelemetry/api-metrics": "0.32.0",
+            "require-in-the-middle": "^5.0.3",
+            "semver": "^7.3.2",
+            "shimmer": "^1.2.1"
+          }
+        }
       }
     },
     "@opentelemetry/propagator-b3": {
@@ -7365,37 +7498,23 @@
       }
     },
     "@opentelemetry/sdk-metrics": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-0.32.0.tgz",
-      "integrity": "sha512-zC9RCOIsXRqOHWmWfcxArtDHbip2/jaIH1yu/OKau/shDZYFluAxY6zAEYIb4YEAzKKEF+fpaoRgpodDWNGVGA==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-0.33.0.tgz",
+      "integrity": "sha512-ZXPixOlTd/FHLwpkmm5nTpJE7bZOPfmbSz8hBVFCEHkXE1aKEKaM38UFnZ+2xzOY1tDsDwyxEiiBiDX8y3039A==",
       "requires": {
-        "@opentelemetry/api-metrics": "0.32.0",
-        "@opentelemetry/core": "1.6.0",
-        "@opentelemetry/resources": "1.6.0",
+        "@opentelemetry/api-metrics": "0.33.0",
+        "@opentelemetry/core": "1.7.0",
+        "@opentelemetry/resources": "1.7.0",
         "lodash.merge": "4.6.2"
       },
       "dependencies": {
-        "@opentelemetry/core": {
-          "version": "1.6.0",
-          "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.6.0.tgz",
-          "integrity": "sha512-MsEhsyCTfYme6frK8/AqEWwbS9SB3Ta5bjgz4jPQJjL7ijUM3JiLVvqh/kHo1UlUjbUbLmGG7jA5Nw4d7SMcLQ==",
-          "requires": {
-            "@opentelemetry/semantic-conventions": "1.6.0"
-          }
-        },
-        "@opentelemetry/resources": {
-          "version": "1.6.0",
-          "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.6.0.tgz",
-          "integrity": "sha512-07GlHuq72r2rnJugYVdGumviQvfrl8kEPidkZSVoseLVfIjV7nzxxt5/vqs9pK7JItWOrvjRdr/jTBVayFBr/w==",
+        "@opentelemetry/api-metrics": {
+          "version": "0.33.0",
+          "resolved": "https://registry.npmjs.org/@opentelemetry/api-metrics/-/api-metrics-0.33.0.tgz",
+          "integrity": "sha512-78evfPRRRnJA6uZ3xuBuS3VZlXTO/LRs+Ff1iv3O/7DgibCtq9k27T6Zlj8yRdJDFmcjcbQrvC0/CpDpWHaZYA==",
           "requires": {
-            "@opentelemetry/core": "1.6.0",
-            "@opentelemetry/semantic-conventions": "1.6.0"
+            "@opentelemetry/api": "^1.0.0"
           }
-        },
-        "@opentelemetry/semantic-conventions": {
-          "version": "1.6.0",
-          "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.6.0.tgz",
-          "integrity": "sha512-aPfcBeLErM/PPiAuAbNFLN5sNbZLc3KZlar27uohllN8Zs6jJbHyJU1y7cMA6W/zuq+thkaG8mujiS+3iD/FWQ=="
         }
       }
     },
diff --git a/package.json b/package.json
index f5176bf..a2e8836 100644
--- a/package.json
+++ b/package.json
@@ -74,17 +74,17 @@
     "@opentelemetry/api": "^1.2.0",
     "@opentelemetry/api-metrics": "^0.32.0",
     "@opentelemetry/core": "^1.6.0",
-    "@opentelemetry/instrumentation": "^0.32.0",
-    "@opentelemetry/instrumentation-http": "^0.32.0",
+    "@opentelemetry/instrumentation": "^0.33.0",
+    "@opentelemetry/instrumentation-http": "^0.33.0",
     "@opentelemetry/instrumentation-mongodb": "^0.32.0",
     "@opentelemetry/instrumentation-mysql": "^0.31.0",
     "@opentelemetry/instrumentation-pg": "^0.31.0",
     "@opentelemetry/instrumentation-redis": "^0.33.0",
     "@opentelemetry/instrumentation-redis-4": "^0.32.0",
-    "@opentelemetry/sdk-metrics": "^0.32.0",
-    "@opentelemetry/sdk-trace-base": "^1.6.0",
-    "@opentelemetry/sdk-trace-node": "^1.6.0",
-    "@opentelemetry/semantic-conventions": "^1.6.0",
+    "@opentelemetry/sdk-metrics": "^0.33.0",
+    "@opentelemetry/sdk-trace-base": "^1.7.0",
+    "@opentelemetry/sdk-trace-node": "^1.7.0",
+    "@opentelemetry/semantic-conventions": "^1.7.0",
     "diagnostic-channel": "1.1.0",
     "diagnostic-channel-publishers": "1.0.4",
     "semver": "^7.3.5"
diff --git a/src/autoCollection/console.ts b/src/autoCollection/console.ts
index 58c645a..bd7b780 100644
--- a/src/autoCollection/console.ts
+++ b/src/autoCollection/console.ts
@@ -1,5 +1,6 @@
 import { LogHandler } from "../library/handlers";
-import * as DiagChannel from "./diagnostic-channel/initialization";
+import { enablePublishers } from "./diagnostic-channel/initialization";
+enablePublishers();
 
 export class AutoCollectConsole {
     private _handler: LogHandler;
@@ -9,13 +10,11 @@ export class AutoCollectConsole {
     }
 
     public enable(isEnabled: boolean, collectConsoleLog: boolean) {
-        if (DiagChannel.IsInitialized) {
-            require("./diagnostic-channel/console.sub").enable(
-                isEnabled && collectConsoleLog,
-                this._handler
-            );
-            require("./diagnostic-channel/bunyan.sub").enable(isEnabled, this._handler);
-            require("./diagnostic-channel/winston.sub").enable(isEnabled, this._handler);
-        }
+        require("./diagnostic-channel/console.sub").enable(
+            isEnabled && collectConsoleLog,
+            this._handler
+        );
+        require("./diagnostic-channel/bunyan.sub").enable(isEnabled, this._handler);
+        require("./diagnostic-channel/winston.sub").enable(isEnabled, this._handler);
     }
 }
diff --git a/src/autoCollection/diagnostic-channel/initialization.ts b/src/autoCollection/diagnostic-channel/initialization.ts
index ff750b5..9961d21 100644
--- a/src/autoCollection/diagnostic-channel/initialization.ts
+++ b/src/autoCollection/diagnostic-channel/initialization.ts
@@ -2,44 +2,27 @@
 // Licensed under the MIT license. See LICENSE file in the project root for details.
 
 // Don't reference modules from these directly. Use only for types.
-// This is to avoid requiring the actual module if the NO_DIAGNOSTIC_CHANNEL env is present
 import * as DiagChannelPublishers from "diagnostic-channel-publishers";
-import * as DiagChannel from "diagnostic-channel";
 import { Logger } from "../../library/logging";
-import { JsonConfig } from "../../library/configuration";
 
-export const IsInitialized = !JsonConfig.getInstance().noDiagnosticChannel;
 const TAG = "DiagnosticChannel";
+let isInitialized = false;
 
-if (IsInitialized) {
-    const publishers: typeof DiagChannelPublishers = require("diagnostic-channel-publishers");
-    const individualOptOuts: string = JsonConfig.getInstance().noPatchModules;
-    const unpatchedModules = individualOptOuts.split(",");
-    const modules: { [key: string]: any } = {
-        bunyan: publishers.bunyan,
-        console: publishers.console,
-        winston: publishers.winston
-    };
-    for (const mod in modules) {
-        if (unpatchedModules.indexOf(mod) === -1) {
+
+export function enablePublishers() {
+    // Only register monkey patchs once
+    if (!isInitialized) {
+        isInitialized = true;
+        const publishers: typeof DiagChannelPublishers = require("diagnostic-channel-publishers");
+        const modules: { [key: string]: any } = {
+            bunyan: publishers.bunyan,
+            console: publishers.console,
+            winston: publishers.winston
+        };
+
+        for (const mod in modules) {
             modules[mod].enable();
             Logger.getInstance().info(TAG, `Subscribed to ${mod} events`);
         }
     }
-    if (unpatchedModules.length > 0) {
-        Logger.getInstance().info(TAG, "Some modules will not be patched", unpatchedModules);
-    }
-} else {
-    Logger.getInstance().info(
-        TAG,
-        "Not subscribing to dependency auto collection because APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL was set"
-    );
-}
-
-export function registerContextPreservation(cb: (cb: Function) => Function) {
-    if (!IsInitialized) {
-        return;
-    }
-    const diagChannel = require("diagnostic-channel") as typeof DiagChannel;
-    diagChannel.channel.addContextPreservation(cb);
 }
diff --git a/src/autoCollection/index.ts b/src/autoCollection/index.ts
index f99947c..26a6c9c 100644
--- a/src/autoCollection/index.ts
+++ b/src/autoCollection/index.ts
@@ -6,3 +6,4 @@ export { AutoCollectExceptions } from "./exceptions";
 export { PerformanceCounterMetricsHandler } from "./metrics/handlers/performanceCounterMetricsHandler";
 export { StandardMetricsHandler } from "./metrics/handlers/standardMetricsHandler";
 export { LiveMetricsHandler } from "./metrics/handlers/liveMetricsHandler";
+export { CustomMetricsHandler } from "./metrics/handlers/customMetricsHandler";
diff --git a/src/autoCollection/metrics/handlers/customMetricsHandler.ts b/src/autoCollection/metrics/handlers/customMetricsHandler.ts
new file mode 100644
index 0000000..7bf5dd4
--- /dev/null
+++ b/src/autoCollection/metrics/handlers/customMetricsHandler.ts
@@ -0,0 +1,43 @@
+import { AzureExporterConfig, AzureMonitorMetricExporter } from "@azure/monitor-opentelemetry-exporter";
+import { Meter } from "@opentelemetry/api-metrics";
+import { MeterProvider, MeterProviderOptions, PeriodicExportingMetricReader, PeriodicExportingMetricReaderOptions, View } from "@opentelemetry/sdk-metrics";
+import { Config } from "../../../library";
+import { ResourceManager } from "../../../library/handlers";
+
+
+export class CustomMetricsHandler {
+    private _config: Config;
+    private _collectionInterval: number = 60000; // 60 seconds
+    private _meterProvider: MeterProvider;
+    private _azureExporter: AzureMonitorMetricExporter;
+    private _metricReader: PeriodicExportingMetricReader;
+    private _meter: Meter;
+
+    constructor(config: Config, options?: { collectionInterval: number }) {
+        this._config = config;
+        const meterProviderConfig: MeterProviderOptions = {
+            resource: ResourceManager.getInstance().getMetricResource(),
+        };
+        this._meterProvider = new MeterProvider(meterProviderConfig);
+        let exporterConfig: AzureExporterConfig = {
+            connectionString: this._config.getConnectionString(),
+            aadTokenCredential: this._config.aadTokenCredential
+        };
+        this._azureExporter = new AzureMonitorMetricExporter(exporterConfig);
+        const metricReaderOptions: PeriodicExportingMetricReaderOptions = {
+            exporter: this._azureExporter as any,
+            exportIntervalMillis: options?.collectionInterval || this._collectionInterval
+        };
+        this._metricReader = new PeriodicExportingMetricReader(metricReaderOptions);
+        this._meterProvider.addMetricReader(this._metricReader);
+        this._meter = this._meterProvider.getMeter("ApplicationInsightsCustomMetricsMeter");
+    }
+
+    public shutdown() {
+        this._meterProvider.shutdown();
+    }
+
+    public getMeter(): Meter {
+        return this._meter;
+    }
+}
diff --git a/src/autoCollection/metrics/statsbeat/statsbeat.ts b/src/autoCollection/metrics/statsbeat/statsbeat.ts
index 96e6aaf..0072ff9 100644
--- a/src/autoCollection/metrics/statsbeat/statsbeat.ts
+++ b/src/autoCollection/metrics/statsbeat/statsbeat.ts
@@ -362,7 +362,7 @@ export class Statsbeat {
                 metrics: [statsbeat],
                 properties: this._statbeatMetrics[i].properties,
             };
-            this._metricHandler.trackStatsbeatMetric(metricTelemetry);
+            // this._metricHandler.trackStatsbeatMetric(metricTelemetry);
         }
     }
 
diff --git a/src/declarations/enumerators.ts b/src/declarations/enumerators.ts
deleted file mode 100644
index 3a10852..0000000
--- a/src/declarations/enumerators.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export enum DistributedTracingModes {
-    /**
-     * (Default) Send Application Insights correlation headers
-     */
-    AI = 0,
-    /**
-     * Send both W3C Trace Context headers and back-compatibility Application Insights headers
-     */
-    AI_AND_W3C,
-}
diff --git a/src/library/client.ts b/src/library/client.ts
index 5128ead..16925e2 100644
--- a/src/library/client.ts
+++ b/src/library/client.ts
@@ -1,14 +1,11 @@
 import { Config } from "./configuration";
 import { Statsbeat } from "../autoCollection/metrics/statsbeat";
 import { Logger } from "./logging";
-import { QuickPulseStateManager } from "./quickPulse";
 import { LogHandler, MetricHandler, TraceHandler } from "./handlers";
 
 
 export class Client {
-
     private _config: Config;
-    private _quickPulseClient: QuickPulseStateManager;
     private _statsbeat: Statsbeat;
     private _traceHandler: TraceHandler;
     private _metricHandler: MetricHandler;
diff --git a/src/library/configuration/config.ts b/src/library/configuration/config.ts
index 87cf266..40f8eb6 100644
--- a/src/library/configuration/config.ts
+++ b/src/library/configuration/config.ts
@@ -1,5 +1,3 @@
-import * as http from "http";
-import * as https from "https";
 import * as url from "url";
 import * as azureCore from "@azure/core-http";
 
@@ -13,17 +11,7 @@ import { IConfig, IDisabledExtendedMetrics, iInstrumentation, InstrumentationTyp
 export class Config implements IConfig {
     // IConfig properties
     public endpointUrl: string;
-    public maxBatchSize: number;
-    public maxBatchIntervalMs: number;
-    public disableAppInsights: boolean;
     public samplingPercentage: number;
-    public correlationIdRetryIntervalMs: number;
-    public correlationHeaderExcludedDomains: string[];
-    public proxyHttpUrl: string;
-    public proxyHttpsUrl: string;
-    public httpAgent: http.Agent;
-    public httpsAgent: https.Agent;
-    public ignoreLegacyHeaders: boolean;
     public aadTokenCredential?: azureCore.TokenCredential;
     public enableAutoCollectConsole: boolean;
     public enableAutoCollectExceptions: boolean;
@@ -33,13 +21,8 @@ export class Config implements IConfig {
     public enableAutoCollectHeartbeat: boolean;
     public enableAutoCollectRequests: boolean;
     public enableAutoCollectDependencies: boolean;
-    public enableAutoDependencyCorrelation: boolean;
     public enableSendLiveMetrics: boolean;
-    public enableUseDiskRetryCaching: boolean;
-    public enableUseAsyncHooks: boolean;
     public enableAutoCollectExtendedMetrics: boolean | IDisabledExtendedMetrics;
-    public enableResendInterval: number;
-    public enableMaxBytesOnDisk: number;
     public disableAllExtendedMetrics: boolean;
     public disableStatsbeat: boolean;
     public extendedMetricDisablers: string;
@@ -53,9 +36,9 @@ export class Config implements IConfig {
 
     constructor(setupString?: string) {
         this.setupString = setupString;
-        this._loadDefaultValues();
         // Load config values from env variables and JSON if available
         this._mergeConfig();
+        this._loadDefaultValues();
         const connectionStringEnv: string | undefined = this._connectionString;
         let connectionStringPrser = new ConnectionStringParser();
         const csCode = connectionStringPrser.parse(setupString);
@@ -75,20 +58,6 @@ export class Config implements IConfig {
             csEnv.ingestionendpoint ||
             this._endpointBase
             }/v2.1/track`;
-        this.maxBatchSize = this.maxBatchSize || 250;
-        this.maxBatchIntervalMs = this.maxBatchIntervalMs || 15000;
-        this.disableAppInsights = this.disableAppInsights || false;
-        this.samplingPercentage = this.samplingPercentage || 100;
-        this.correlationIdRetryIntervalMs = this.correlationIdRetryIntervalMs || 30 * 1000;
-        this.correlationHeaderExcludedDomains = this.correlationHeaderExcludedDomains || [
-            "*.core.windows.net",
-            "*.core.chinacloudapi.cn",
-            "*.core.cloudapi.de",
-            "*.core.usgovcloudapi.net",
-            "*.core.microsoft.scloud",
-            "*.core.eaglex.ic.gov",
-        ];
-        this.ignoreLegacyHeaders = this.ignoreLegacyHeaders || false;
         this.quickPulseHost =
             this.quickPulseHost ||
             csCode.liveendpoint ||
@@ -102,13 +71,31 @@ export class Config implements IConfig {
     }
 
     private _loadDefaultValues() {
-        this.instrumentations = {};
-        this.instrumentations[InstrumentationType.azureSdk] = { enabled: false };
-        this.instrumentations[InstrumentationType.mongoDb] = { enabled: false };
-        this.instrumentations[InstrumentationType.mySql] = { enabled: false };
-        this.instrumentations[InstrumentationType.postgreSql] = { enabled: false };
-        this.instrumentations[InstrumentationType.redis] = { enabled: false };
-        this.instrumentations[InstrumentationType.redis4] = { enabled: false };
+        this.disableAllExtendedMetrics = this.disableAllExtendedMetrics != undefined ? this.disableAllExtendedMetrics : false;
+        this.disableStatsbeat = this.disableStatsbeat != undefined ? this.disableStatsbeat : false;
+        this.enableAutoCollectConsole = this.enableAutoCollectConsole != undefined ? this.enableAutoCollectConsole : false;
+        this.enableAutoCollectConsole = this.enableAutoCollectExternalLoggers != undefined ? this.enableAutoCollectConsole : true;
+
+        this.enableAutoCollectDependencies = this.enableAutoCollectDependencies != undefined ? this.enableAutoCollectDependencies : true;
+        this.enableAutoCollectRequests = this.enableAutoCollectRequests != undefined ? this.enableAutoCollectRequests : true;
+        
+        this.enableAutoCollectExceptions = this.enableAutoCollectExceptions != undefined ? this.enableAutoCollectExceptions : true;
+        this.enableAutoCollectExtendedMetrics = this.enableAutoCollectExtendedMetrics != undefined ? this.enableAutoCollectExtendedMetrics : true;
+        this.enableAutoCollectHeartbeat = this.enableAutoCollectHeartbeat != undefined ? this.enableAutoCollectHeartbeat : true;
+        this.enableAutoCollectPerformance = this.enableAutoCollectPerformance != undefined ? this.enableAutoCollectPerformance : true;
+        this.enableAutoCollectPreAggregatedMetrics = this.enableAutoCollectPreAggregatedMetrics != undefined ? this.enableAutoCollectPreAggregatedMetrics : true;
+        
+        this.enableSendLiveMetrics = this.enableSendLiveMetrics != undefined ? this.enableSendLiveMetrics : false;
+        this.samplingPercentage = this.samplingPercentage != undefined ? this.samplingPercentage : 100;
+        if (!this.instrumentations) {
+            this.instrumentations = {};
+            this.instrumentations[InstrumentationType.azureSdk] = { enabled: false };
+            this.instrumentations[InstrumentationType.mongoDb] = { enabled: false };
+            this.instrumentations[InstrumentationType.mySql] = { enabled: false };
+            this.instrumentations[InstrumentationType.postgreSql] = { enabled: false };
+            this.instrumentations[InstrumentationType.redis] = { enabled: false };
+            this.instrumentations[InstrumentationType.redis4] = { enabled: false };
+        }
     }
 
     public set instrumentationKey(iKey: string) {
@@ -134,10 +121,7 @@ export class Config implements IConfig {
     private _mergeConfig() {
         let jsonConfig = JsonConfig.getInstance();
         this._connectionString = jsonConfig.connectionString;
-        this.correlationHeaderExcludedDomains = jsonConfig.correlationHeaderExcludedDomains;
-        this.correlationIdRetryIntervalMs = jsonConfig.correlationIdRetryIntervalMs;
         this.disableAllExtendedMetrics = jsonConfig.disableAllExtendedMetrics;
-        this.disableAppInsights = jsonConfig.disableAppInsights;
         this.disableStatsbeat = jsonConfig.disableStatsbeat;
         this.enableAutoCollectConsole = jsonConfig.enableAutoCollectConsole;
         this.enableAutoCollectDependencies = jsonConfig.enableAutoCollectDependencies;
@@ -148,22 +132,12 @@ export class Config implements IConfig {
         this.enableAutoCollectPerformance = jsonConfig.enableAutoCollectPerformance;
         this.enableAutoCollectPreAggregatedMetrics = jsonConfig.enableAutoCollectPreAggregatedMetrics;
         this.enableAutoCollectRequests = jsonConfig.enableAutoCollectRequests;
-        this.enableAutoDependencyCorrelation = jsonConfig.enableAutoDependencyCorrelation;
-        this.enableResendInterval = jsonConfig.enableResendInterval;
-        this.enableMaxBytesOnDisk = jsonConfig.enableMaxBytesOnDisk;
         this.enableSendLiveMetrics = jsonConfig.enableSendLiveMetrics;
-        this.enableUseAsyncHooks = jsonConfig.enableUseAsyncHooks;
-        this.enableUseDiskRetryCaching = jsonConfig.enableUseDiskRetryCaching;
         this.endpointUrl = jsonConfig.endpointUrl;
         this.extendedMetricDisablers = jsonConfig.extendedMetricDisablers;
-        this.ignoreLegacyHeaders = jsonConfig.ignoreLegacyHeaders;
-        this.maxBatchIntervalMs = jsonConfig.maxBatchIntervalMs;
-        this.maxBatchSize = jsonConfig.maxBatchSize;
-        this.proxyHttpUrl = jsonConfig.proxyHttpUrl;
-        this.proxyHttpsUrl = jsonConfig.proxyHttpsUrl;
         this.quickPulseHost = jsonConfig.quickPulseHost;
         this.samplingPercentage = jsonConfig.samplingPercentage;
-        //this.instrumentations = jsonConfig.instrumentations;
+        this.instrumentations = jsonConfig.instrumentations;
     }
 
     private _getInstrumentationKey(): string {
diff --git a/src/library/configuration/interfaces.ts b/src/library/configuration/interfaces.ts
index e403640..adb3f5f 100644
--- a/src/library/configuration/interfaces.ts
+++ b/src/library/configuration/interfaces.ts
@@ -1,30 +1,10 @@
-import * as http from "http";
-import * as https from "https";
 import * as azureCore from "@azure/core-http";
 
 export interface IBaseConfig {
-    /** Application Insights resource instrumentation key */
-    instrumentationKey: string;
     /** The ingestion endpoint to send telemetry payloads to */
     endpointUrl: string;
-    /** The maximum number of telemetry items to include in a payload to the ingestion endpoint (Default 250) */
-    maxBatchSize: number;
-    /** The maximum amount of time to wait for a payload to reach maxBatchSize (Default 15000) */
-    maxBatchIntervalMs: number;
-    /** A flag indicating if telemetry transmission is disabled (Default false) */
-    disableAppInsights: boolean;
     /** The percentage of telemetry items tracked that should be transmitted (Default 100) */
     samplingPercentage: number;
-    /** The time to wait before retrying to retrieve the id for cross-component correlation (Default 30000) */
-    correlationIdRetryIntervalMs: number;
-    /** A list of domains to exclude from cross-component header injection */
-    correlationHeaderExcludedDomains: string[];
-    /** A proxy server for SDK HTTP traffic (Optional, Default pulled from `http_proxy` environment variable) */
-    proxyHttpUrl: string;
-    /** A proxy server for SDK HTTPS traffic (Optional, Default pulled from `https_proxy` environment variable) */
-    proxyHttpsUrl: string;
-    /** Disable including legacy headers in outgoing requests, x-ms-request-id */
-    ignoreLegacyHeaders: boolean;
     /**
      * Sets the state of console
      * if true logger activity will be sent to Application Insights
@@ -70,28 +50,6 @@ export interface IBaseConfig {
      * if true dependencies will be sent to Application Insights
      */
     enableAutoCollectDependencies: boolean;
-    /**
-     * Sets the state of automatic dependency correlation (enabled by default)
-     * if true dependencies will be correlated with requests
-     */
-    enableAutoDependencyCorrelation: boolean;
-    /**
-     * Sets the state of automatic dependency correlation (enabled by default)
-     * if true, forces use of experimental async_hooks module to provide correlation. If false, instead uses only patching-based techniques. If left blank, the best option is chosen for you based on your version of Node.js.
-     */
-    enableUseAsyncHooks: boolean;
-    /**
-     * Enable or disable disk-backed retry caching to cache events when client is offline (enabled by default)
-     * Note that this method only applies to the default client. Disk-backed retry caching is disabled by default for additional clients.
-     * For enable for additional clients, use client.channel.setUseDiskRetryCaching(true).
-     * These cached events are stored in your system or user's temporary directory and access restricted to your user when possible.
-     * enableUseDiskRetryCaching if true events that occured while client is offline will be cached on disk
-     * enableResendInterval The wait interval for resending cached events.
-     * enableMaxBytesOnDisk The maximum size (in bytes) that the created temporary directory for cache events can grow to, before caching is disabled.
-     */
-    enableUseDiskRetryCaching: boolean;
-    enableResendInterval: number;
-    enableMaxBytesOnDisk: number;
     /**
      * Enables communication with Application Insights Live Metrics.
      * if true, enables communication with the live metrics service
@@ -133,34 +91,11 @@ export const enum InstrumentationType {
 export interface IEnvironmentConfig {
     /** Connection String used to send telemetry payloads to */
     connectionString: string;
-    /**
-     * In order to track context across asynchronous calls,
-     * some changes are required in third party libraries such as mongodb and redis.
-     * By default ApplicationInsights will use diagnostic-channel-publishers to monkey-patch some of these libraries.
-     * This property is to disable the feature.
-     * Note that by setting this flag, events may no longer be correctly associated with the right operation.
-     */
-    noDiagnosticChannel: boolean;
-    /**
-     * Disable individual monkey-patches.
-     * Set `noPatchModules` to a comma separated list of packages to disable.
-     * e.g. `"noPatchModules": "console,redis"` to avoid patching the console and redis packages.
-     * The following modules are available: `azuresdk, bunyan, console, mongodb, mongodb-core, mysql, redis, winston, pg`, and `pg-pool`.
-     */
-    noPatchModules: string;
-    /**
-     * HTTPS without a passed in agent
-     */
-    noHttpAgentKeepAlive: boolean;
 }
 
 export interface IJsonConfig extends IBaseConfig, IEnvironmentConfig { }
 
 export interface IConfig extends IBaseConfig {
-    /** An http.Agent to use for SDK HTTP traffic (Optional, Default undefined) */
-    httpAgent: http.Agent;
-    /** An https.Agent to use for SDK HTTPS traffic (Optional, Default undefined) */
-    httpsAgent: https.Agent;
     /** AAD TokenCredential to use to authenticate the app */
     aadTokenCredential?: azureCore.TokenCredential;
 }
diff --git a/src/library/configuration/jsonConfig.ts b/src/library/configuration/jsonConfig.ts
index 36e18e8..d4173b8 100644
--- a/src/library/configuration/jsonConfig.ts
+++ b/src/library/configuration/jsonConfig.ts
@@ -9,12 +9,7 @@ const ENV_connectionString = "APPLICATIONINSIGHTS_CONNECTION_STRING";
 // Native Metrics Opt Outs
 const ENV_nativeMetricsDisablers = "APPLICATION_INSIGHTS_DISABLE_EXTENDED_METRIC";
 const ENV_nativeMetricsDisableAll = "APPLICATION_INSIGHTS_DISABLE_ALL_EXTENDED_METRICS";
-const ENV_http_proxy = "http_proxy";
-const ENV_https_proxy = "https_proxy";
-const ENV_noDiagnosticChannel = "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL";
 const ENV_noStatsbeat = "APPLICATION_INSIGHTS_NO_STATSBEAT";
-const ENV_noHttpAgentKeepAlive = "APPLICATION_INSIGHTS_NO_HTTP_AGENT_KEEP_ALIVE";
-const ENV_noPatchModules = "APPLICATION_INSIGHTS_NO_PATCH_MODULES";
 
 export class JsonConfig implements IJsonConfig {
     private static _instance: JsonConfig;
@@ -22,15 +17,7 @@ export class JsonConfig implements IJsonConfig {
     public connectionString: string;
     public instrumentationKey: string;
     public endpointUrl: string;
-    public maxBatchSize: number;
-    public maxBatchIntervalMs: number;
-    public disableAppInsights: boolean;
     public samplingPercentage: number;
-    public correlationIdRetryIntervalMs: number;
-    public correlationHeaderExcludedDomains: string[];
-    public proxyHttpUrl: string;
-    public proxyHttpsUrl: string;
-    public ignoreLegacyHeaders: boolean;
     public enableAutoCollectExternalLoggers: boolean;
     public enableAutoCollectConsole: boolean;
     public enableAutoCollectExceptions: boolean;
@@ -40,18 +27,10 @@ export class JsonConfig implements IJsonConfig {
     public enableAutoCollectHeartbeat: boolean;
     public enableAutoCollectRequests: boolean;
     public enableAutoCollectDependencies: boolean;
-    public enableAutoDependencyCorrelation: boolean;
-    public enableUseAsyncHooks: boolean;
-    public enableUseDiskRetryCaching: boolean;
-    public enableResendInterval: number;
-    public enableMaxBytesOnDisk: number;
     public enableSendLiveMetrics: boolean;
     public disableAllExtendedMetrics: boolean;
     public extendedMetricDisablers: string;
     public disableStatsbeat: boolean;
-    public noDiagnosticChannel: boolean;
-    public noPatchModules: string;
-    public noHttpAgentKeepAlive: boolean;
     public quickPulseHost: string;
     public instrumentations: { [type: string]: iInstrumentation };
 
@@ -67,12 +46,7 @@ export class JsonConfig implements IJsonConfig {
         this.connectionString = process.env[ENV_connectionString];
         this.disableAllExtendedMetrics = !!process.env[ENV_nativeMetricsDisableAll];
         this.extendedMetricDisablers = process.env[ENV_nativeMetricsDisablers];
-        this.proxyHttpUrl = process.env[ENV_http_proxy];
-        this.proxyHttpsUrl = process.env[ENV_https_proxy];
-        this.noDiagnosticChannel = !!process.env[ENV_noDiagnosticChannel];
         this.disableStatsbeat = !!process.env[ENV_noStatsbeat];
-        this.noHttpAgentKeepAlive = !!process.env[ENV_noHttpAgentKeepAlive];
-        this.noPatchModules = process.env[ENV_noPatchModules] || "";
         this._loadJsonFile();
     }
 
@@ -96,41 +70,14 @@ export class JsonConfig implements IJsonConfig {
             if (jsonConfig.disableAllExtendedMetrics != undefined) {
                 this.disableAllExtendedMetrics = jsonConfig.disableStatsbeat;
             }
-            if (jsonConfig.noDiagnosticChannel != undefined) {
-                this.noDiagnosticChannel = jsonConfig.noDiagnosticChannel;
-            }
-            if (jsonConfig.noHttpAgentKeepAlive != undefined) {
-                this.noHttpAgentKeepAlive = jsonConfig.noHttpAgentKeepAlive;
-            }
             if (jsonConfig.connectionString != undefined) {
                 this.connectionString = jsonConfig.connectionString;
             }
             if (jsonConfig.extendedMetricDisablers != undefined) {
                 this.extendedMetricDisablers = jsonConfig.extendedMetricDisablers;
             }
-            if (jsonConfig.noDiagnosticChannel != undefined) {
-                this.noDiagnosticChannel = jsonConfig.noDiagnosticChannel;
-            }
-            if (jsonConfig.proxyHttpUrl != undefined) {
-                this.proxyHttpUrl = jsonConfig.proxyHttpUrl;
-            }
-            if (jsonConfig.proxyHttpsUrl != undefined) {
-                this.proxyHttpsUrl = jsonConfig.proxyHttpsUrl;
-            }
-            if (jsonConfig.proxyHttpsUrl != undefined) {
-                this.proxyHttpsUrl = jsonConfig.proxyHttpsUrl;
-            }
-            if (jsonConfig.noPatchModules != undefined) {
-                this.noPatchModules = jsonConfig.noPatchModules;
-            }
             this.endpointUrl = jsonConfig.endpointUrl;
-            this.maxBatchSize = jsonConfig.maxBatchSize;
-            this.maxBatchIntervalMs = jsonConfig.maxBatchIntervalMs;
-            this.disableAppInsights = jsonConfig.disableAppInsights;
             this.samplingPercentage = jsonConfig.samplingPercentage;
-            this.correlationIdRetryIntervalMs = jsonConfig.correlationIdRetryIntervalMs;
-            this.correlationHeaderExcludedDomains = jsonConfig.correlationHeaderExcludedDomains;
-            this.ignoreLegacyHeaders = jsonConfig.ignoreLegacyHeaders;
             this.enableAutoCollectExternalLoggers = jsonConfig.enableAutoCollectExternalLoggers;
             this.enableAutoCollectConsole = jsonConfig.enableAutoCollectConsole;
             this.enableAutoCollectExceptions = jsonConfig.enableAutoCollectExceptions;
@@ -141,11 +88,6 @@ export class JsonConfig implements IJsonConfig {
             this.enableAutoCollectHeartbeat = jsonConfig.enableAutoCollectHeartbeat;
             this.enableAutoCollectRequests = jsonConfig.enableAutoCollectRequests;
             this.enableAutoCollectDependencies = jsonConfig.enableAutoCollectDependencies;
-            this.enableAutoDependencyCorrelation = jsonConfig.enableAutoDependencyCorrelation;
-            this.enableUseAsyncHooks = jsonConfig.enableUseAsyncHooks;
-            this.enableUseDiskRetryCaching = jsonConfig.enableUseDiskRetryCaching;
-            this.enableResendInterval = jsonConfig.enableResendInterval;
-            this.enableMaxBytesOnDisk = jsonConfig.enableMaxBytesOnDisk;
             this.enableSendLiveMetrics = jsonConfig.enableSendLiveMetrics;
             this.quickPulseHost = jsonConfig.quickPulseHost;
             this.instrumentations = jsonConfig.instrumentations;
diff --git a/src/library/exporters/index.ts b/src/library/exporters/index.ts
index fa0029a..7f547ac 100644
--- a/src/library/exporters/index.ts
+++ b/src/library/exporters/index.ts
@@ -2,4 +2,3 @@
 // Licensed under the MIT license.
 
 export { LogExporter } from "./logExporter";
-export { MetricExporter } from "./metricExporter";
diff --git a/src/library/exporters/metricExporter.ts b/src/library/exporters/metricExporter.ts
deleted file mode 100644
index 2c35f57..0000000
--- a/src/library/exporters/metricExporter.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-import { AzureExporterConfig } from "@azure/monitor-opentelemetry-exporter";
-import { BaseExporter } from "./shared";
-import { Config } from "../configuration";
-import { Logger } from "../logging"
-
-export class MetricExporter extends BaseExporter {
-
-    constructor(config: Config) {
-        let ingestionEndpoint = config.endpointUrl.replace("/v2.1/track", "");
-        let connectionString = `InstrumentationKey=${config.instrumentationKey};IngestionEndpoint=${ingestionEndpoint}`;
-        let exporterConfig: AzureExporterConfig = {
-            connectionString: connectionString,
-        };
-        super(exporterConfig);
-    }
-
-    /**
-     * Shutdown AzureMonitorTraceExporter.
-     */
-    public async shutdown(): Promise<void> {
-        Logger.getInstance().info("Azure Monitor Metrics Exporter shutting down");
-        return this._sender.shutdown();
-    }
-}
diff --git a/src/library/handlers/metricHandler.ts b/src/library/handlers/metricHandler.ts
index 55cd145..6887da9 100644
--- a/src/library/handlers/metricHandler.ts
+++ b/src/library/handlers/metricHandler.ts
@@ -1,46 +1,30 @@
 // Copyright (c) Microsoft Corporation.
 // Licensed under the MIT license.
-import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
-
 import { BatchProcessor } from "./shared/batchProcessor";
 import { Config } from "../configuration";
 import {
+    CustomMetricsHandler,
     StandardMetricsHandler,
     PerformanceCounterMetricsHandler,
+    LiveMetricsHandler,
 } from "../../autoCollection";
-import { MetricTelemetry } from "../../declarations/contracts";
-import * as Contracts from "../../declarations/contracts";
-import * as Constants from "../../declarations/constants";
-import {
-    TelemetryItem as Envelope,
-    MetricsData,
-    MetricDataPoint,
-    KnownDataPointType,
-    KnownContextTagKeys,
-} from "../../declarations/generated";
-import { ResourceManager } from "./resourceManager";
 import { HeartBeatHandler } from "../../autoCollection/metrics/handlers/heartBeatHandler";
-import { Util } from "../util";
 import { HttpMetricsInstrumentation } from "../../autoCollection/metrics/collection/httpMetricsInstrumentation";
 import { IMetricExceptionDimensions, IMetricTraceDimensions } from "../../autoCollection/metrics/types";
-import { LiveMetricsHandler } from "../../autoCollection/metrics/handlers/liveMetricsHandler";
-import { MetricExporter } from "../exporters";
 
 
 export class MetricHandler {
     private _config: Config;
     private _batchProcessor: BatchProcessor;
-    private _exporter: MetricExporter;
     private _perfCounterMetricsHandler: PerformanceCounterMetricsHandler;
     private _standardMetricsHandler: StandardMetricsHandler;
     private _liveMetricsHandler: LiveMetricsHandler;
     private _heartbeatHandler: HeartBeatHandler;
+    private _customMetricsHandler: CustomMetricsHandler;
 
     constructor(config: Config) {
         this._config = config;
-        this._exporter = new MetricExporter(this._config);
-        this._batchProcessor = new BatchProcessor(this._config, this._exporter);
-        // Create StandardMetrics, PerfCounters and LiveMetrics Handlers
+        this._customMetricsHandler = new CustomMetricsHandler(config);
         if (this._config.enableAutoCollectPreAggregatedMetrics) {
             this._standardMetricsHandler = new StandardMetricsHandler(this._config);
         }
@@ -63,6 +47,7 @@ export class MetricHandler {
     }
 
     public async shutdown(): Promise<void> {
+        this._customMetricsHandler.shutdown();
         this._perfCounterMetricsHandler?.shutdown();
         this._standardMetricsHandler?.shutdown();
         this._liveMetricsHandler?.shutdown();
@@ -73,6 +58,10 @@ export class MetricHandler {
         return this._config;
     }
 
+    public getCustomMetricsHandler(): CustomMetricsHandler {
+        return this._customMetricsHandler;
+    }
+
     public getStandardMetricsHandler(): StandardMetricsHandler {
         return this._standardMetricsHandler;
     }
@@ -95,98 +84,4 @@ export class MetricHandler {
     public async flush(): Promise<void> {
         await this._batchProcessor.triggerSend();
     }
-
-    public async trackMetric(telemetry: Contracts.MetricTelemetry): Promise<void> {
-        const envelope = this._metricToEnvelope(telemetry, this._config.instrumentationKey);
-        this.track(envelope);
-    }
-
-    public async trackStatsbeatMetric(telemetry: Contracts.MetricTelemetry): Promise<void> {
-        const envelope = this._metricToEnvelope(telemetry, this._config.instrumentationKey);
-        envelope.name = Constants.StatsbeatTelemetryName;
-        this.track(envelope);
-    }
-
-    /**
-     * Log a user action or other occurrence.
-     * @param telemetry      Object encapsulating tracking options
-     */
-    public track(telemetry: Envelope): void {
-        this._batchProcessor.send(telemetry);
-    }
-
-    /**
-     * Metric to Azure envelope parsing.
-     * @internal
-     */
-    private _metricToEnvelope(telemetry: MetricTelemetry, instrumentationKey: string): Envelope {
-        let baseType = "MetricData";
-        let version = 1;
-        let baseData: MetricsData = {
-            metrics: [],
-            version: 2,
-        };
-        const time = telemetry.time || new Date();
-        // Exclude metrics from sampling by default
-        let sampleRate = 100;
-        let properties = {};
-
-        const tags = this._getTags();
-        let name =
-            "Microsoft.ApplicationInsights." +
-            instrumentationKey.replace(/-/g, "") +
-            "." +
-            baseType.substring(0, baseType.length - 4);
-        if (telemetry.properties) {
-            // sanitize properties
-            properties = Util.getInstance().validateStringMap(telemetry.properties);
-        }
-
-        telemetry.metrics.forEach((metricPoint) => {
-            var metricDataPoint: MetricDataPoint = {
-                name: metricPoint.name,
-                value: metricPoint.value,
-            };
-            metricDataPoint.count = !isNaN(metricPoint.count) ? metricPoint.count : 1;
-            metricDataPoint.dataPointType = metricPoint.kind || KnownDataPointType.Aggregation; // Aggregation for Manual APIs
-            metricDataPoint.max = !isNaN(metricPoint.max) ? metricPoint.max : metricPoint.value;
-            metricDataPoint.min = !isNaN(metricPoint.min) ? metricPoint.min : metricPoint.value;
-            metricDataPoint.stdDev = !isNaN(metricPoint.stdDev) ? metricPoint.stdDev : 0;
-            metricDataPoint.namespace = metricPoint.namespace;
-            baseData.metrics.push(metricDataPoint);
-        });
-
-        return {
-            name,
-            sampleRate,
-            time,
-            instrumentationKey,
-            tags,
-            version: version,
-            data: {
-                baseType,
-                baseData: {
-                    ...baseData,
-                    properties,
-                },
-            },
-        };
-    }
-
-    private _getTags() {
-        var tags = <{ [key: string]: string }>{};
-        const attributes = ResourceManager.getInstance().getMetricResource().attributes;
-        const serviceName = attributes[SemanticResourceAttributes.SERVICE_NAME];
-        const serviceNamespace = attributes[SemanticResourceAttributes.SERVICE_NAMESPACE];
-        if (serviceName) {
-            if (serviceNamespace) {
-                tags[KnownContextTagKeys.AiCloudRole] = `${serviceNamespace}.${serviceName}`;
-            } else {
-                tags[KnownContextTagKeys.AiCloudRole] = String(serviceName);
-            }
-        }
-        const serviceInstanceId = attributes[SemanticResourceAttributes.SERVICE_INSTANCE_ID];
-        tags[KnownContextTagKeys.AiCloudRoleInstance] = String(serviceInstanceId);
-        return tags;
-    }
 }
diff --git a/src/library/handlers/shared/batchProcessor.ts b/src/library/handlers/shared/batchProcessor.ts
index 4ec30b0..f4c137c 100644
--- a/src/library/handlers/shared/batchProcessor.ts
+++ b/src/library/handlers/shared/batchProcessor.ts
@@ -9,8 +9,6 @@ import { ExportResult, ExportResultCode } from "@opentelemetry/core";
 export class BatchProcessor {
     protected _lastSend: number;
     protected _timeoutHandle: any;
-
-    protected _isDisabled: () => boolean;
     protected _getBatchSize: () => number;
     protected _getBatchIntervalMs: () => number;
 
@@ -21,20 +19,14 @@ export class BatchProcessor {
         this._buffer = [];
         this._lastSend = 0;
         this._exporter = exporter;
-        this._isDisabled = () => config.disableAppInsights;
-        this._getBatchSize = () => config.maxBatchSize;
-        this._getBatchIntervalMs = () => config.maxBatchIntervalMs;
+        this._getBatchSize = () => 250;
+        this._getBatchIntervalMs = () => 15000;
     }
 
     /**
      * Add a telemetry item to the send buffer
      */
     public send(envelope: Envelope) {
-        // if master off switch is set, don't send any data
-        if (this._isDisabled()) {
-            // Do not send/save data
-            return;
-        }
         // validate input
         if (!envelope) {
             Logger.getInstance().warn("Cannot send null/undefined telemetry");
diff --git a/src/library/quickPulse/quickPulseSender.ts b/src/library/quickPulse/quickPulseSender.ts
index e75b2a3..1eab90d 100644
--- a/src/library/quickPulse/quickPulseSender.ts
+++ b/src/library/quickPulse/quickPulseSender.ts
@@ -125,11 +125,7 @@ export class QuickPulseSender {
         }
 
         // HTTPS only
-        if (this._config.httpsAgent) {
-            (<any>options).agent = this._config.httpsAgent;
-        } else {
-            (<any>options).agent = Util.getInstance().tlsRestrictedAgent;
-        }
+        (<any>options).agent = Util.getInstance().tlsRestrictedAgent;
 
         const req = https.request(options, (res: http.IncomingMessage) => {
             if (res.statusCode == 200) {
diff --git a/src/library/util/util.ts b/src/library/util/util.ts
index e4e2983..e4b60f7 100644
--- a/src/library/util/util.ts
+++ b/src/library/util/util.ts
@@ -11,12 +11,10 @@ import { Config } from "../configuration";
 import { Client } from "../client";
 import { RequestHeaders } from "../../declarations/requestResponseHeaders";
 import { HttpRequest } from "../../declarations/functions";
-import { JsonConfig } from "../configuration";
 
 export class Util {
     private static _instance: Util;
     private readonly _idGenerator: IdGenerator;
-    private _useKeepAlive = !JsonConfig.getInstance().noHttpAgentKeepAlive;
     private _listenerAttached = false;
 
     public MAX_PROPERTY_LENGTH = 8192;
@@ -199,48 +197,6 @@ export class Util {
         return map;
     }
 
-    /**
-     * Checks if a request url is not on a excluded domain list
-     * and if it is safe to add correlation headers
-     */
-    public canIncludeCorrelationHeader(client: Client, requestUrl: string) {
-        let excludedDomains =
-            client && client.getConfig() && client.getConfig().correlationHeaderExcludedDomains;
-        if (!excludedDomains || excludedDomains.length == 0 || !requestUrl) {
-            return true;
-        }
-
-        for (let i = 0; i < excludedDomains.length; i++) {
-            let regex = new RegExp(excludedDomains[i].replace(/\./g, ".").replace(/\*/g, ".*"));
-            try {
-                if (regex.test(new url.URL(requestUrl).hostname)) {
-                    return false;
-                }
-            } catch (ex) {
-                // Ignore error
-            }
-        }
-
-        return true;
-    }
-
-    public getCorrelationContextTarget(
-        response: http.ClientResponse | http.ServerRequest | HttpRequest,
-        key: string
-    ) {
-        const contextHeaders =
-            response.headers && response.headers[RequestHeaders.requestContextHeader];
-        if (contextHeaders) {
-            const keyValues = (<any>contextHeaders).split(",");
-            for (let i = 0; i < keyValues.length; ++i) {
-                const keyValue = keyValues[i].split("=");
-                if (keyValue.length == 2 && keyValue[0] == key) {
-                    return keyValue[1];
-                }
-            }
-        }
-    }
-
     public isDbDependency(dependencyType: string) {
         return (
             dependencyType.indexOf("SQL") > -1 ||
@@ -285,12 +241,6 @@ export class Util {
 
         var proxyUrl: string = undefined;
         if (useProxy) {
-            if (requestUrlParsed.protocol === "https:") {
-                proxyUrl = config.proxyHttpsUrl || undefined;
-            }
-            if (requestUrlParsed.protocol === "http:") {
-                proxyUrl = config.proxyHttpUrl || undefined;
-            }
             if (proxyUrl) {
                 if (proxyUrl.indexOf("//") === 0) {
                     proxyUrl = "http:" + proxyUrl;
@@ -321,13 +271,9 @@ export class Util {
 
         var isHttps = requestUrlParsed.protocol === "https:" && !proxyUrl;
         if (useAgent) {
-            if (isHttps && config.httpsAgent !== undefined) {
-                options.agent = config.httpsAgent;
-            } else if (!isHttps && config.httpAgent !== undefined) {
-                options.agent = config.httpAgent;
-            } else if (isHttps) {
+            if (isHttps) {
                 // HTTPS without a passed in agent. Use one that enforces our TLS rules
-                options.agent = this._useKeepAlive ? this.keepAliveAgent : this.tlsRestrictedAgent;
+                options.agent = this.tlsRestrictedAgent;
             }
         }
         if (isHttps) {
@@ -371,7 +317,6 @@ export class Util {
         if (!this._listenerAttached) {
             process.on("exit", () => {
                 this.isNodeExit = true;
-                this._useKeepAlive = false;
             });
             this._listenerAttached = true;
         }
diff --git a/src/shim/applicationinsights.ts b/src/shim/applicationinsights.ts
index e493a87..5d893f2 100644
--- a/src/shim/applicationinsights.ts
+++ b/src/shim/applicationinsights.ts
@@ -5,7 +5,6 @@ import { Logger } from "../library/logging";
 import { IDisabledExtendedMetrics, InstrumentationType } from "../library/configuration/interfaces";
 import { QuickPulseStateManager } from "../library/quickPulse";
 import { ICorrelationContext } from "../declarations/interfaces";
-import { DistributedTracingModes } from "../declarations/enumerators";
 import { TelemetryClient } from "./telemetryClient";
 import * as Contracts from "../declarations/contracts";
 import * as azureFunctionsTypes from "../declarations/functions";
@@ -13,7 +12,7 @@ import * as azureFunctionsTypes from "../declarations/functions";
 
 // We export these imports so that SDK users may use these classes directly.
 // They're exposed using "export import" so that types are passed along as expected
-export { Contracts, TelemetryClient, DistributedTracingModes, azureFunctionsTypes, InstrumentationType };
+export { Contracts, TelemetryClient, azureFunctionsTypes, InstrumentationType };
 
 /**
  * The default client, initialized when setup was called. To initialize a different client
@@ -21,9 +20,6 @@ export { Contracts, TelemetryClient, DistributedTracingModes, azureFunctionsType
  */
 export let defaultClient: TelemetryClient;
 export let liveMetricsClient: QuickPulseStateManager;
-let _isDiskRetry = true;
-let _diskRetryInterval: number = undefined;
-let _diskRetryMaxBytes: number = undefined;
 
 /**
  * Initializes the default client. Should be called after setting
@@ -41,10 +37,6 @@ export function setup(setupString?: string) {
         if (defaultClient.config.enableSendLiveMetrics) {
             Configuration.setSendLiveMetrics(defaultClient.config.enableSendLiveMetrics);
         }
-        if (defaultClient.config.enableUseDiskRetryCaching) {
-            _isDiskRetry = defaultClient.config.enableUseDiskRetryCaching;
-        }
-        Configuration.setUseDiskRetryCaching(_isDiskRetry, _diskRetryInterval, _diskRetryMaxBytes);
     } else {
         Logger.getInstance().info("The default client is already setup");
     }
@@ -125,17 +117,6 @@ export class Configuration {
     // Convenience shortcut to ApplicationInsights.start
     public static start = start;
 
-    /**
-     * Sets the distributed tracing modes. If W3C mode is enabled, W3C trace context
-     * headers (traceparent/tracestate) will be parsed in all incoming requests, and included in outgoing
-     * requests. In W3C mode, existing back-compatibility AI headers will also be parsed and included.
-     * Enabling W3C mode will not break existing correlation with other Application Insights instrumented
-     * services. Default=AI
-     */
-    public static setDistributedTracingMode(value: DistributedTracingModes) {
-        return Configuration;
-    }
-
     /**
      * Sets the state of console and logger tracking (enabled by default for third-party loggers only)
      * @param value if true logger activity will be sent to Application Insights
@@ -231,14 +212,6 @@ export class Configuration {
      * @returns {Configuration} this class
      */
 
-    public static setUseDiskRetryCaching(
-        value: boolean,
-        resendInterval?: number,
-        maxBytesOnDisk?: number
-    ) {
-        return Configuration;
-    }
-
     /**
      * Enables debug and warning Logger for AppInsights itself.
      * @param enableDebugLogger if true, enables debug Logger
diff --git a/src/shim/telemetryClient.ts b/src/shim/telemetryClient.ts
index a5aecc0..2469835 100644
--- a/src/shim/telemetryClient.ts
+++ b/src/shim/telemetryClient.ts
@@ -56,16 +56,6 @@ export class TelemetryClient {
         this.client.getLogHandler().trackTrace(telemetry);
     }
 
-    /**
-     * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
-     * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
-     * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
-     * @param telemetry      Object encapsulating tracking options
-     */
-    public trackMetric(telemetry: Contracts.MetricTelemetry): void {
-        this.client.getMetricHandler().trackMetric(telemetry);
-    }
-
     /**
      * Log an exception
      * @param telemetry      Object encapsulating tracking options
@@ -82,6 +72,20 @@ export class TelemetryClient {
         this.client.getLogHandler().trackEvent(telemetry);
     }
 
+    /**
+     * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
+     * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
+     * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
+     * @param telemetry      Object encapsulating tracking options
+     */
+    public trackMetric(telemetry: Contracts.MetricTelemetry): void {
+        // TODO : Create custom metric
+        // let meter = this.client.getMetricHandler().getCustomMetricsHandler().getMeter();
+        // let metricName = "";
+        // let options: MetricOptions = {};
+        // meter.createHistogram(metricName, options)
+    }
+
     /**
      * Log a request. Note that the default client will attempt to collect HTTP requests automatically so only use this for requests
      * that aren't automatically captured or if you've disabled automatic request collection.


Test patch:
diff --git a/test/endToEnd/js/endToEnd.js b/test/endToEnd/js/endToEnd.js
index aa77d17..f3bd8c7 100644
--- a/test/endToEnd/js/endToEnd.js
+++ b/test/endToEnd/js/endToEnd.js
@@ -14,13 +14,11 @@ let nockScope = nock("https://centralus-0.in.applicationinsights.azure.com").pos
 if (process.argv.indexOf('embeddedTestCase-AppTerminates1') > -1) {
     var appInsights = require('../../../out/src/applicationinsights');
     appInsights.setup("InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/");
-    appInsights.defaultClient.config.httpsAgent = new https.Agent({ keepAlive: false });
     appInsights.start();
     return;
 } else if (process.argv.indexOf('embeddedTestCase-AppTerminates2') > -1) {
     var appInsights = require('../../../out/src/applicationinsights');
     appInsights.setup("InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/");
-    appInsights.defaultClient.config.httpsAgent = new https.Agent({ keepAlive: false });
     appInsights.start();
     appInsights.defaultClient.trackEvent({ name: 'testEvent' });
     appInsights.defaultClient.flush();
@@ -105,7 +103,6 @@ describe('module', function () {
         it('should crash on uncaught exceptions', function () {
             var appInsights = require('../../../out/src/applicationinsights');
             appInsights.setup('InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/').setAutoCollectExceptions(true);
-            appInsights.defaultClient.config.httpsAgent = new https.Agent({ keepAlive: false });
             appInsights.start();
             assert.ok(appInsights.defaultClient);
             var handler;
@@ -125,7 +122,6 @@ describe('module', function () {
         it('should not crash on uncaught exceptions if multiple handlers exist', function () {
             var appInsights = require('../../../out/src/applicationinsights');
             appInsights.setup('InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/').setAutoCollectExceptions(true);
-            appInsights.defaultClient.config.httpsAgent = new https.Agent({ keepAlive: false });
             appInsights.start();
             process.addListener(UNCAUGHT_EXCEPTION, function () { });
             assert.ok(appInsights.defaultClient);
diff --git a/test/functionalTests/testApp/main.js b/test/functionalTests/testApp/main.js
index 8480005..66847ef 100644
--- a/test/functionalTests/testApp/main.js
+++ b/test/functionalTests/testApp/main.js
@@ -14,10 +14,12 @@ if (testconfig.AppInsightsEnabled) {
     config.instrumentations["redis4"].enabled = true;
     config.enableAutoCollectDependencies = true;
     config.enableAutoCollectRequests = true;
+    config.enableAutoCollectExceptions = true;
+    config.enableAutoCollectConsole = true;
+    config.enableAutoCollectExternalLoggers = true;
 
     appInsights = new Client(config);
     appInsights.start();
-    appInsights.getLogHandler().setAutoCollectConsole(true, true);
 }
 
 var Tasks = require("./tasks");
diff --git a/test/unitTests/autoCollection/bunyan.tests.ts b/test/unitTests/autoCollection/bunyan.tests.ts
index 207a02e..2212323 100644
--- a/test/unitTests/autoCollection/bunyan.tests.ts
+++ b/test/unitTests/autoCollection/bunyan.tests.ts
@@ -5,7 +5,7 @@ import { bunyan } from "diagnostic-channel-publishers";
 
 import { enable, dispose } from "../../../src/autoCollection/diagnostic-channel/bunyan.sub";
 import { Util } from "../../../src/library/util";
-import { LogHandler, ResourceManager } from "../../../src/library/handlers";
+import { LogHandler } from "../../../src/library/handlers";
 import { Config } from "../../../src/library/configuration";
 
 describe("diagnostic-channel/bunyan", () => {
diff --git a/test/unitTests/autoCollection/customMetricsHandler.tests.ts b/test/unitTests/autoCollection/customMetricsHandler.tests.ts
new file mode 100644
index 0000000..8f82d3e
--- /dev/null
+++ b/test/unitTests/autoCollection/customMetricsHandler.tests.ts
@@ -0,0 +1,53 @@
+import { SpanKind } from "@opentelemetry/api";
+import * as assert from "assert";
+import * as sinon from "sinon";
+
+import { CustomMetricsHandler } from "../../../src/autoCollection/metrics/handlers/customMetricsHandler";
+import { Config } from "../../../src/library/configuration";
+
+
+describe("#LiveMetricsHandler", () => {
+    var sandbox: sinon.SinonSandbox;
+    let autoCollect: CustomMetricsHandler;
+
+    before(() => {
+        sandbox = sinon.createSandbox();
+        let config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
+        autoCollect = new CustomMetricsHandler(config, { collectionInterval: 100 });
+        sandbox.stub(autoCollect["_metricReader"]["_exporter"], "export");
+    });
+
+    afterEach(() => {
+        sandbox.restore();
+    });
+
+    after(() => {
+        autoCollect.shutdown();
+    });
+
+    it("should create a meter", () => {
+        assert.ok(autoCollect.getMeter(), "meter not available");
+    });
+
+    it("should observe instruments during collection", async () => {
+        let mockExport = sandbox.stub(autoCollect["_azureExporter"], "export");
+        autoCollect.getMeter().createCounter("testCounter", { description: "testDescription" });
+        await new Promise(resolve => setTimeout(resolve, 120));
+        assert.ok(mockExport.called);
+        let resourceMetrics = mockExport.args[0][0];
+        const scopeMetrics = resourceMetrics.scopeMetrics;
+        assert.strictEqual(scopeMetrics.length, 1, 'scopeMetrics count');
+        let metrics = scopeMetrics[0].metrics;
+        assert.strictEqual(metrics.length, 1, 'metrics count');
+        assert.equal(metrics[0].descriptor.name,"testCounter");
+        assert.equal(metrics[0].descriptor.description,"testDescription");
+    });
+
+    it("should not collect when disabled", async () => {
+        let mockExport = sandbox.stub(autoCollect["_azureExporter"], "export");
+        autoCollect.getMeter().createCounter("testCounter", { description: "testDescription" });
+        autoCollect.shutdown();
+        await new Promise(resolve => setTimeout(resolve, 120));
+        assert.ok(mockExport.notCalled);
+    });
+});
\ No newline at end of file
diff --git a/test/unitTests/autoCollection/httpMetricsInstrumentation.tests.ts b/test/unitTests/autoCollection/httpMetricsInstrumentation.tests.ts
index 5f94b58..e901901 100644
--- a/test/unitTests/autoCollection/httpMetricsInstrumentation.tests.ts
+++ b/test/unitTests/autoCollection/httpMetricsInstrumentation.tests.ts
@@ -108,7 +108,7 @@ describe("AutoCollection/HttpMetricsInstrumentation", () => {
     it("Server/Client Metric Duration", async () => {
         let mockExport = sandbox.stub(exporter, "export");
         await makeHttpRequest();
-        await new Promise(resolve => setTimeout(resolve, 150));
+        await new Promise(resolve => setTimeout(resolve, 250));
         assert.ok(mockExport.called);
         let resourceMetrics = mockExport.args[0][0];
         const scopeMetrics = resourceMetrics.scopeMetrics;
diff --git a/test/unitTests/autoCollection/statsbeat.tests.ts b/test/unitTests/autoCollection/statsbeat.tests.ts
index 8ae2237..0a72f9d 100644
--- a/test/unitTests/autoCollection/statsbeat.tests.ts
+++ b/test/unitTests/autoCollection/statsbeat.tests.ts
@@ -1,394 +1,394 @@
-import * as assert from "assert";
-import * as sinon from "sinon";
-import * as nock from "nock";
+// import * as assert from "assert";
+// import * as sinon from "sinon";
+// import * as nock from "nock";
 
-import { Statsbeat } from "../../../src/autoCollection/metrics/statsbeat";
-import * as Constants from "../../../src/declarations/constants";
-import { Config } from "../../../src/library/configuration";
+// import { Statsbeat } from "../../../src/autoCollection/metrics/statsbeat";
+// import * as Constants from "../../../src/declarations/constants";
+// import { Config } from "../../../src/library/configuration";
 
-describe("AutoCollection/Statsbeat", () => {
-    var sandbox: sinon.SinonSandbox;
-    const config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-    let statsBeat: Statsbeat = null;
+// describe("AutoCollection/Statsbeat", () => {
+//     var sandbox: sinon.SinonSandbox;
+//     const config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
+//     let statsBeat: Statsbeat = null;
 
-    beforeEach(() => {
-        sandbox = sinon.createSandbox();
-        statsBeat = new Statsbeat(config);
-        sandbox.stub(statsBeat["_metricHandler"], "trackStatsbeatMetric").value({}); // Avoid telemetry to be sent from tests
-    });
+//     beforeEach(() => {
+//         sandbox = sinon.createSandbox();
+//         statsBeat = new Statsbeat(config);
+//         sandbox.stub(statsBeat["_metricHandler"], "trackStatsbeatMetric").value({}); // Avoid telemetry to be sent from tests
+//     });
 
-    afterEach(() => {
-        sandbox.restore();
-        statsBeat.enable(false);
-        statsBeat = null;
-    });
+//     afterEach(() => {
+//         sandbox.restore();
+//         statsBeat.enable(false);
+//         statsBeat = null;
+//     });
 
-    after(() => {
-        nock.cleanAll();
-    });
+//     after(() => {
+//         nock.cleanAll();
+//     });
 
-    describe("#init and #disable()", () => {
-        it("init should enable and dispose autocollection handlers", () => {
-            let statsBeat = new Statsbeat(new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"));
-            statsBeat.enable(true);
-            assert.ok(statsBeat["_handle"]);
-            assert.ok(statsBeat["_longHandle"]);
-            statsBeat.enable(false);
-            assert.ok(!statsBeat["_handle"]);
-            assert.ok(!statsBeat["_longHandle"]);
-        });
-    });
+//     describe("#init and #disable()", () => {
+//         it("init should enable and dispose autocollection handlers", () => {
+//             let statsBeat = new Statsbeat(new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"));
+//             statsBeat.enable(true);
+//             assert.ok(statsBeat["_handle"]);
+//             assert.ok(statsBeat["_longHandle"]);
+//             statsBeat.enable(false);
+//             assert.ok(!statsBeat["_handle"]);
+//             assert.ok(!statsBeat["_longHandle"]);
+//         });
+//     });
 
-    describe("#Resource provider property", () => {
-        it("unknown resource provider", (done) => {
-            let interceptor = nock("http://169.254.169.254").get(
-                "/metadata/instance/compute",
-                (body: string) => {
-                    return true;
-                }
-            );
-            interceptor.reply(400, {});
-            statsBeat["_getResourceProvider"]()
-                .then(() => {
-                    assert.equal(statsBeat["_resourceProvider"], "unknown");
-                    assert.equal(statsBeat["_resourceIdentifier"], "unknown");
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//     describe("#Resource provider property", () => {
+//         it("unknown resource provider", (done) => {
+//             let interceptor = nock("http://169.254.169.254").get(
+//                 "/metadata/instance/compute",
+//                 (body: string) => {
+//                     return true;
+//                 }
+//             );
+//             interceptor.reply(400, {});
+//             statsBeat["_getResourceProvider"]()
+//                 .then(() => {
+//                     assert.equal(statsBeat["_resourceProvider"], "unknown");
+//                     assert.equal(statsBeat["_resourceIdentifier"], "unknown");
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("app service", (done) => {
-            var newEnv = <{ [id: string]: string }>{};
-            newEnv["WEBSITE_SITE_NAME"] = "Test Website";
-            newEnv["WEBSITE_HOME_STAMPNAME"] = "test_home";
-            var originalEnv = process.env;
-            process.env = newEnv;
-            statsBeat["_getResourceProvider"]()
-                .then(() => {
-                    process.env = originalEnv;
-                    assert.equal(statsBeat["_resourceProvider"], "appsvc");
-                    assert.equal(statsBeat["_resourceIdentifier"], "Test Website/test_home");
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("app service", (done) => {
+//             var newEnv = <{ [id: string]: string }>{};
+//             newEnv["WEBSITE_SITE_NAME"] = "Test Website";
+//             newEnv["WEBSITE_HOME_STAMPNAME"] = "test_home";
+//             var originalEnv = process.env;
+//             process.env = newEnv;
+//             statsBeat["_getResourceProvider"]()
+//                 .then(() => {
+//                     process.env = originalEnv;
+//                     assert.equal(statsBeat["_resourceProvider"], "appsvc");
+//                     assert.equal(statsBeat["_resourceIdentifier"], "Test Website/test_home");
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Azure Function", (done) => {
-            var newEnv = <{ [id: string]: string }>{};
-            newEnv["FUNCTIONS_WORKER_RUNTIME"] = "test";
-            newEnv["WEBSITE_HOSTNAME"] = "test_host";
-            var originalEnv = process.env;
-            process.env = newEnv;
-            statsBeat["_getResourceProvider"]()
-                .then(() => {
-                    process.env = originalEnv;
-                    assert.equal(statsBeat["_resourceProvider"], "functions");
-                    assert.equal(statsBeat["_resourceIdentifier"], "test_host");
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Azure Function", (done) => {
+//             var newEnv = <{ [id: string]: string }>{};
+//             newEnv["FUNCTIONS_WORKER_RUNTIME"] = "test";
+//             newEnv["WEBSITE_HOSTNAME"] = "test_host";
+//             var originalEnv = process.env;
+//             process.env = newEnv;
+//             statsBeat["_getResourceProvider"]()
+//                 .then(() => {
+//                     process.env = originalEnv;
+//                     assert.equal(statsBeat["_resourceProvider"], "functions");
+//                     assert.equal(statsBeat["_resourceIdentifier"], "test_host");
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Azure VM", (done) => {
-            var newEnv = <{ [id: string]: string }>{};
-            var originalEnv = process.env;
-            process.env = newEnv;
-            let interceptor = nock("http://169.254.169.254").get(
-                "/metadata/instance/compute",
-                (body: string) => {
-                    return true;
-                }
-            );
-            interceptor.reply(200, {
-                vmId: "testId",
-                subscriptionId: "testsubscriptionId",
-                osType: "testOsType",
-            });
-            statsBeat["_getResourceProvider"]()
-                .then(() => {
-                    process.env = originalEnv;
-                    assert.equal(statsBeat["_resourceProvider"], "vm");
-                    assert.equal(statsBeat["_resourceIdentifier"], "testId/testsubscriptionId");
-                    assert.equal(statsBeat["_os"], "testOsType");
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
-    });
+//         it("Azure VM", (done) => {
+//             var newEnv = <{ [id: string]: string }>{};
+//             var originalEnv = process.env;
+//             process.env = newEnv;
+//             let interceptor = nock("http://169.254.169.254").get(
+//                 "/metadata/instance/compute",
+//                 (body: string) => {
+//                     return true;
+//                 }
+//             );
+//             interceptor.reply(200, {
+//                 vmId: "testId",
+//                 subscriptionId: "testsubscriptionId",
+//                 osType: "testOsType",
+//             });
+//             statsBeat["_getResourceProvider"]()
+//                 .then(() => {
+//                     process.env = originalEnv;
+//                     assert.equal(statsBeat["_resourceProvider"], "vm");
+//                     assert.equal(statsBeat["_resourceIdentifier"], "testId/testsubscriptionId");
+//                     assert.equal(statsBeat["_os"], "testOsType");
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
+//     });
 
-    describe("#trackStatbeats", () => {
-        beforeEach(() => {
-            // Prevent handles to be initialized
-            statsBeat["_longHandle"] = setInterval(() => { }, 0);
-            statsBeat["_handle"] = setInterval(() => { }, 0);
-        });
+//     describe("#trackStatbeats", () => {
+//         beforeEach(() => {
+//             // Prevent handles to be initialized
+//             statsBeat["_longHandle"] = setInterval(() => { }, 0);
+//             statsBeat["_handle"] = setInterval(() => { }, 0);
+//         });
 
-        it("It adds correct network properties to custom metric", (done) => {
-            statsBeat.enable(true);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat.countRequest(1, "testEndpointHost", 123, true);
-            statsBeat.setCodelessAttach();
-            statsBeat
-                .trackShortIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Request Duration"
-                    )[0];
-                    assert.ok(metric, "Statsbeat Request not found");
-                    assert.equal(metric.value, 123);
-                    assert.equal((<any>metric.properties)["attach"], "codeless");
-                    assert.equal(
-                        (<any>metric.properties)["cikey"],
-                        "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
-                    );
-                    assert.equal((<any>metric.properties)["language"], "node");
-                    assert.equal((<any>metric.properties)["rp"], "unknown");
-                    assert.equal((<any>metric.properties)["endpoint"], 1);
-                    assert.equal((<any>metric.properties)["host"], "testEndpointHost");
-                    assert.ok((<any>metric.properties)["os"]);
-                    assert.ok((<any>metric.properties)["runtimeVersion"]);
-                    assert.ok((<any>metric.properties)["version"]);
+//         it("It adds correct network properties to custom metric", (done) => {
+//             statsBeat.enable(true);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat.countRequest(1, "testEndpointHost", 123, true);
+//             statsBeat.setCodelessAttach();
+//             statsBeat
+//                 .trackShortIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Request Duration"
+//                     )[0];
+//                     assert.ok(metric, "Statsbeat Request not found");
+//                     assert.equal(metric.value, 123);
+//                     assert.equal((<any>metric.properties)["attach"], "codeless");
+//                     assert.equal(
+//                         (<any>metric.properties)["cikey"],
+//                         "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
+//                     );
+//                     assert.equal((<any>metric.properties)["language"], "node");
+//                     assert.equal((<any>metric.properties)["rp"], "unknown");
+//                     assert.equal((<any>metric.properties)["endpoint"], 1);
+//                     assert.equal((<any>metric.properties)["host"], "testEndpointHost");
+//                     assert.ok((<any>metric.properties)["os"]);
+//                     assert.ok((<any>metric.properties)["runtimeVersion"]);
+//                     assert.ok((<any>metric.properties)["version"]);
 
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Track duration", (done) => {
-            statsBeat.enable(true);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat.countRequest(0, "test", 1000, true);
-            statsBeat.countRequest(0, "test", 500, false);
-            statsBeat
-                .trackShortIntervalStatsbeats()
-                .then((error) => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    assert.equal(statsBeat["_statbeatMetrics"].length, 3);
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Request Duration"
-                    )[0];
-                    assert.ok(metric, "Request Duration metric not found");
-                    assert.equal(metric.value, 750);
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Track duration", (done) => {
+//             statsBeat.enable(true);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat.countRequest(0, "test", 1000, true);
+//             statsBeat.countRequest(0, "test", 500, false);
+//             statsBeat
+//                 .trackShortIntervalStatsbeats()
+//                 .then((error) => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     assert.equal(statsBeat["_statbeatMetrics"].length, 3);
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Request Duration"
+//                     )[0];
+//                     assert.ok(metric, "Request Duration metric not found");
+//                     assert.equal(metric.value, 750);
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Track counts", (done) => {
-            statsBeat.enable(true);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat.countRequest(0, "test", 1, true);
-            statsBeat.countRequest(0, "test", 1, true);
-            statsBeat.countRequest(0, "test", 1, true);
-            statsBeat.countRequest(0, "test", 1, true);
-            statsBeat.countRequest(0, "test", 1, false);
-            statsBeat.countRequest(0, "test", 1, false);
-            statsBeat.countRequest(0, "test", 1, false);
-            statsBeat.countRetry(0, "test");
-            statsBeat.countRetry(0, "test");
-            statsBeat.countThrottle(0, "test");
-            statsBeat.countException(0, "test");
-            statsBeat
-                .trackShortIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    assert.equal(statsBeat["_statbeatMetrics"].length, 6);
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Request Success Count"
-                    )[0];
-                    assert.ok(metric, "Request Success Count metric not found");
-                    assert.equal(metric.value, 4);
-                    metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Request Failure Count"
-                    )[0];
-                    assert.ok(metric, "Request Failure Count metric not found");
-                    assert.equal(metric.value, 3);
-                    metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Retry Count"
-                    )[0];
-                    assert.ok(metric, "Retry Count metric not found");
-                    assert.equal(metric.value, 2);
-                    metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Throttle Count"
-                    )[0];
-                    assert.ok(metric, "Throttle Count metric not found");
-                    assert.equal(metric.value, 1);
-                    metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Exception Count"
-                    )[0];
-                    assert.ok(metric, "Exception Count metric not found");
-                    assert.equal(metric.value, 1);
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Track counts", (done) => {
+//             statsBeat.enable(true);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat.countRequest(0, "test", 1, true);
+//             statsBeat.countRequest(0, "test", 1, true);
+//             statsBeat.countRequest(0, "test", 1, true);
+//             statsBeat.countRequest(0, "test", 1, true);
+//             statsBeat.countRequest(0, "test", 1, false);
+//             statsBeat.countRequest(0, "test", 1, false);
+//             statsBeat.countRequest(0, "test", 1, false);
+//             statsBeat.countRetry(0, "test");
+//             statsBeat.countRetry(0, "test");
+//             statsBeat.countThrottle(0, "test");
+//             statsBeat.countException(0, "test");
+//             statsBeat
+//                 .trackShortIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     assert.equal(statsBeat["_statbeatMetrics"].length, 6);
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Request Success Count"
+//                     )[0];
+//                     assert.ok(metric, "Request Success Count metric not found");
+//                     assert.equal(metric.value, 4);
+//                     metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Request Failure Count"
+//                     )[0];
+//                     assert.ok(metric, "Request Failure Count metric not found");
+//                     assert.equal(metric.value, 3);
+//                     metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Retry Count"
+//                     )[0];
+//                     assert.ok(metric, "Retry Count metric not found");
+//                     assert.equal(metric.value, 2);
+//                     metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Throttle Count"
+//                     )[0];
+//                     assert.ok(metric, "Throttle Count metric not found");
+//                     assert.equal(metric.value, 1);
+//                     metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Exception Count"
+//                     )[0];
+//                     assert.ok(metric, "Exception Count metric not found");
+//                     assert.equal(metric.value, 1);
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Track attach Statbeat", (done) => {
-            statsBeat.enable(true);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat
-                .trackLongIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Attach"
-                    )[0];
-                    assert.ok(metric, "attach metric not found");
-                    assert.equal(metric.value, 1);
-                    assert.equal(
-                        (<any>metric.properties)["cikey"],
-                        "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
-                    );
-                    assert.equal((<any>metric.properties)["language"], "node");
-                    assert.equal((<any>metric.properties)["rp"], "unknown");
-                    assert.equal((<any>metric.properties)["rpId"], "unknown");
-                    assert.equal((<any>metric.properties)["attach"], "sdk");
-                    assert.ok((<any>metric.properties)["os"]);
-                    assert.ok((<any>metric.properties)["runtimeVersion"]);
-                    assert.ok((<any>metric.properties)["version"]);
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Track attach Statbeat", (done) => {
+//             statsBeat.enable(true);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat
+//                 .trackLongIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Attach"
+//                     )[0];
+//                     assert.ok(metric, "attach metric not found");
+//                     assert.equal(metric.value, 1);
+//                     assert.equal(
+//                         (<any>metric.properties)["cikey"],
+//                         "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
+//                     );
+//                     assert.equal((<any>metric.properties)["language"], "node");
+//                     assert.equal((<any>metric.properties)["rp"], "unknown");
+//                     assert.equal((<any>metric.properties)["rpId"], "unknown");
+//                     assert.equal((<any>metric.properties)["attach"], "sdk");
+//                     assert.ok((<any>metric.properties)["os"]);
+//                     assert.ok((<any>metric.properties)["runtimeVersion"]);
+//                     assert.ok((<any>metric.properties)["version"]);
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Track feature Statbeat", (done) => {
-            statsBeat.enable(true);
-            statsBeat.addFeature(Constants.StatsbeatFeature.DISK_RETRY);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat
-                .trackLongIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Feature"
-                    )[0];
-                    assert.ok(metric, "feature metric not found");
-                    assert.equal(metric.name, "Feature");
-                    assert.equal(metric.value, 1);
-                    assert.equal((<any>metric.properties)["type"], 0);
-                    assert.equal(
-                        (<any>metric.properties)["cikey"],
-                        "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
-                    );
-                    assert.equal((<any>metric.properties)["language"], "node");
-                    assert.equal((<any>metric.properties)["rp"], "unknown");
-                    assert.equal((<any>metric.properties)["attach"], "sdk");
-                    assert.equal((<any>metric.properties)["feature"], 1);
-                    assert.ok((<any>metric.properties)["os"]);
-                    assert.ok((<any>metric.properties)["runtimeVersion"]);
-                    assert.ok((<any>metric.properties)["version"]);
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Track feature Statbeat", (done) => {
+//             statsBeat.enable(true);
+//             statsBeat.addFeature(Constants.StatsbeatFeature.DISK_RETRY);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat
+//                 .trackLongIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Feature"
+//                     )[0];
+//                     assert.ok(metric, "feature metric not found");
+//                     assert.equal(metric.name, "Feature");
+//                     assert.equal(metric.value, 1);
+//                     assert.equal((<any>metric.properties)["type"], 0);
+//                     assert.equal(
+//                         (<any>metric.properties)["cikey"],
+//                         "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
+//                     );
+//                     assert.equal((<any>metric.properties)["language"], "node");
+//                     assert.equal((<any>metric.properties)["rp"], "unknown");
+//                     assert.equal((<any>metric.properties)["attach"], "sdk");
+//                     assert.equal((<any>metric.properties)["feature"], 1);
+//                     assert.ok((<any>metric.properties)["os"]);
+//                     assert.ok((<any>metric.properties)["runtimeVersion"]);
+//                     assert.ok((<any>metric.properties)["version"]);
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Track instrumentation Statbeat", (done) => {
-            statsBeat.enable(true);
-            statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat
-                .trackLongIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    let metric = statsBeat["_statbeatMetrics"].filter(
-                        (f) => f.name === "Feature"
-                    )[0];
-                    assert.ok(metric, "instrumentation metric not found");
-                    assert.equal(metric.name, "Feature");
-                    assert.equal(metric.value, 1);
-                    assert.equal((<any>metric.properties)["type"], 1);
-                    assert.equal(
-                        (<any>metric.properties)["cikey"],
-                        "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
-                    );
-                    assert.equal((<any>metric.properties)["language"], "node");
-                    assert.equal((<any>metric.properties)["rp"], "unknown");
-                    assert.equal((<any>metric.properties)["attach"], "sdk");
-                    assert.equal((<any>metric.properties)["feature"], 1);
-                    assert.ok((<any>metric.properties)["os"]);
-                    assert.ok((<any>metric.properties)["runtimeVersion"]);
-                    assert.ok((<any>metric.properties)["version"]);
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
+//         it("Track instrumentation Statbeat", (done) => {
+//             statsBeat.enable(true);
+//             statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat
+//                 .trackLongIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     let metric = statsBeat["_statbeatMetrics"].filter(
+//                         (f) => f.name === "Feature"
+//                     )[0];
+//                     assert.ok(metric, "instrumentation metric not found");
+//                     assert.equal(metric.name, "Feature");
+//                     assert.equal(metric.value, 1);
+//                     assert.equal((<any>metric.properties)["type"], 1);
+//                     assert.equal(
+//                         (<any>metric.properties)["cikey"],
+//                         "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"
+//                     );
+//                     assert.equal((<any>metric.properties)["language"], "node");
+//                     assert.equal((<any>metric.properties)["rp"], "unknown");
+//                     assert.equal((<any>metric.properties)["attach"], "sdk");
+//                     assert.equal((<any>metric.properties)["feature"], 1);
+//                     assert.ok((<any>metric.properties)["os"]);
+//                     assert.ok((<any>metric.properties)["runtimeVersion"]);
+//                     assert.ok((<any>metric.properties)["version"]);
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
 
-        it("Instrumentations", () => {
-            statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
-            assert.equal(statsBeat["_instrumentation"], 1);
-            statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.MONGODB);
-            assert.equal(statsBeat["_instrumentation"], 3);
-            statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.MYSQL);
-            assert.equal(statsBeat["_instrumentation"], 7);
-            statsBeat.removeInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
-            assert.equal(statsBeat["_instrumentation"], 6);
-            statsBeat.removeInstrumentation(Constants.StatsbeatInstrumentation.MYSQL);
-            assert.equal(statsBeat["_instrumentation"], 2);
-        });
+//         it("Instrumentations", () => {
+//             statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
+//             assert.equal(statsBeat["_instrumentation"], 1);
+//             statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.MONGODB);
+//             assert.equal(statsBeat["_instrumentation"], 3);
+//             statsBeat.addInstrumentation(Constants.StatsbeatInstrumentation.MYSQL);
+//             assert.equal(statsBeat["_instrumentation"], 7);
+//             statsBeat.removeInstrumentation(Constants.StatsbeatInstrumentation.AZURE_CORE_TRACING);
+//             assert.equal(statsBeat["_instrumentation"], 6);
+//             statsBeat.removeInstrumentation(Constants.StatsbeatInstrumentation.MYSQL);
+//             assert.equal(statsBeat["_instrumentation"], 2);
+//         });
 
-        it("Features", () => {
-            statsBeat.addFeature(Constants.StatsbeatFeature.DISK_RETRY);
-            assert.equal(statsBeat["_feature"], 1);
-            statsBeat.addFeature(Constants.StatsbeatFeature.AAD_HANDLING);
-            assert.equal(statsBeat["_feature"], 3);
-            statsBeat.removeFeature(Constants.StatsbeatFeature.DISK_RETRY);
-            assert.equal(statsBeat["_feature"], 2);
-        });
+//         it("Features", () => {
+//             statsBeat.addFeature(Constants.StatsbeatFeature.DISK_RETRY);
+//             assert.equal(statsBeat["_feature"], 1);
+//             statsBeat.addFeature(Constants.StatsbeatFeature.AAD_HANDLING);
+//             assert.equal(statsBeat["_feature"], 3);
+//             statsBeat.removeFeature(Constants.StatsbeatFeature.DISK_RETRY);
+//             assert.equal(statsBeat["_feature"], 2);
+//         });
 
-        it("Multiple network categories and endpoints", (done) => {
-            statsBeat.enable(true);
-            const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
-            statsBeat.countRequest(0, "breezeFirstEndpoint", 100, true);
-            statsBeat.countRequest(1, "quickpulseEndpoint", 200, true);
-            statsBeat.countRequest(0, "breezeSecondEndpoint", 400, true);
-            statsBeat
-                .trackShortIntervalStatsbeats()
-                .then(() => {
-                    assert.ok(sendStub.called, "should call _sendStatsbeats");
-                    let metric: any = statsBeat["_statbeatMetrics"].find(
-                        (f) => f.name === "Request Duration" && f.value === 100
-                    );
-                    assert.ok(metric, "breezeFirstEndpoint metric not found");
-                    assert.equal((<any>metric.properties)["endpoint"], 0);
-                    assert.equal((<any>metric.properties)["host"], "breezeFirstEndpoint");
-                    metric = statsBeat["_statbeatMetrics"].find(
-                        (f) => f.name === "Request Duration" && f.value === 200
-                    );
-                    assert.ok(metric, "quickpulseEndpoint metric not found");
-                    assert.equal((<any>metric.properties)["endpoint"], 1);
-                    assert.equal((<any>metric.properties)["host"], "quickpulseEndpoint");
-                    metric = statsBeat["_statbeatMetrics"].find(
-                        (f) => f.name === "Request Duration" && f.value === 400
-                    );
-                    assert.ok(metric, "breezeSecondEndpoint metric not found");
-                    assert.equal((<any>metric.properties)["endpoint"], 0);
-                    assert.equal((<any>metric.properties)["host"], "breezeSecondEndpoint");
-                    done();
-                })
-                .catch((error) => {
-                    done(error);
-                });
-        });
-    });
-});
+//         it("Multiple network categories and endpoints", (done) => {
+//             statsBeat.enable(true);
+//             const sendStub = sandbox.stub(statsBeat as any, "_sendStatsbeats");
+//             statsBeat.countRequest(0, "breezeFirstEndpoint", 100, true);
+//             statsBeat.countRequest(1, "quickpulseEndpoint", 200, true);
+//             statsBeat.countRequest(0, "breezeSecondEndpoint", 400, true);
+//             statsBeat
+//                 .trackShortIntervalStatsbeats()
+//                 .then(() => {
+//                     assert.ok(sendStub.called, "should call _sendStatsbeats");
+//                     let metric: any = statsBeat["_statbeatMetrics"].find(
+//                         (f) => f.name === "Request Duration" && f.value === 100
+//                     );
+//                     assert.ok(metric, "breezeFirstEndpoint metric not found");
+//                     assert.equal((<any>metric.properties)["endpoint"], 0);
+//                     assert.equal((<any>metric.properties)["host"], "breezeFirstEndpoint");
+//                     metric = statsBeat["_statbeatMetrics"].find(
+//                         (f) => f.name === "Request Duration" && f.value === 200
+//                     );
+//                     assert.ok(metric, "quickpulseEndpoint metric not found");
+//                     assert.equal((<any>metric.properties)["endpoint"], 1);
+//                     assert.equal((<any>metric.properties)["host"], "quickpulseEndpoint");
+//                     metric = statsBeat["_statbeatMetrics"].find(
+//                         (f) => f.name === "Request Duration" && f.value === 400
+//                     );
+//                     assert.ok(metric, "breezeSecondEndpoint metric not found");
+//                     assert.equal((<any>metric.properties)["endpoint"], 0);
+//                     assert.equal((<any>metric.properties)["host"], "breezeSecondEndpoint");
+//                     done();
+//                 })
+//                 .catch((error) => {
+//                     done(error);
+//                 });
+//         });
+//     });
+// });
diff --git a/test/unitTests/library/config.json b/test/unitTests/library/config.json
index 63243b0..0abb4a9 100644
--- a/test/unitTests/library/config.json
+++ b/test/unitTests/library/config.json
@@ -2,18 +2,7 @@
     "connectionString": "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/",
     "endpointUrl": "testEndpointUrl",
     "disableAllExtendedMetrics": false,
-    "maxBatchSize": 150,
-    "maxBatchIntervalMs": 12000,
-    "disableAppInsights": false,
     "samplingPercentage": 30,
-    "correlationIdRetryIntervalMs": 15000,
-    "correlationHeaderExcludedDomains": [
-        "domain1",
-        "domain2"
-    ],
-    "proxyHttpUrl": "testProxyHttpUrl",
-    "proxyHttpsUrl": "testProxyHttpsUrl",
-    "ignoreLegacyHeaders": false,
     "enableAutoCollectExternalLoggers": false,
     "enableAutoCollectConsole": false,
     "enableAutoCollectExceptions": false,
@@ -23,17 +12,8 @@
     "enableAutoCollectHeartbeat": false,
     "enableAutoCollectRequests": false,
     "enableAutoCollectDependencies": false,
-    "enableAutoDependencyCorrelation": false,
-    "enableUseAsyncHooks": false,
     "disableStatsbeat": false,
-    "noHttpAgentKeepAlive": false,
-    "distributedTracingMode": 0,
-    "enableUseDiskRetryCaching": false,
-    "enableResendInterval": 123,
-    "enableMaxBytesOnDisk": 456,
     "enableSendLiveMetrics": false,
     "extendedMetricDisablers": "gc,heap",
-    "noDiagnosticChannel": false,
-    "noPatchModules": "console,redis",
     "quickPulseHost": "testquickpulsehost.com"
 }
\ No newline at end of file
diff --git a/test/unitTests/library/config.tests.ts b/test/unitTests/library/config.tests.ts
index 137be6c..fd44625 100644
--- a/test/unitTests/library/config.tests.ts
+++ b/test/unitTests/library/config.tests.ts
@@ -94,16 +94,7 @@ describe("Library/Config", () => {
                     "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/"
                 );
                 assert.equal(config.endpointUrl, "testEndpointUrl/v2.1/track");
-                assert.equal(config.maxBatchSize, 150);
-                assert.equal(config.maxBatchIntervalMs, 12000);
-                assert.equal(config.disableAppInsights, false);
                 assert.equal(config.samplingPercentage, 30);
-                assert.equal(config.correlationIdRetryIntervalMs, 15000);
-                assert.equal(config.correlationHeaderExcludedDomains[0], "domain1");
-                assert.equal(config.correlationHeaderExcludedDomains[1], "domain2");
-                assert.equal(config.proxyHttpUrl, "testProxyHttpUrl");
-                assert.equal(config.proxyHttpsUrl, "testProxyHttpsUrl");
-                assert.equal(config.ignoreLegacyHeaders, false);
                 assert.equal(config.enableAutoCollectExternalLoggers, false);
                 assert.equal(config.enableAutoCollectConsole, false);
                 assert.equal(config.enableAutoCollectExceptions, false);
@@ -112,13 +103,8 @@ describe("Library/Config", () => {
                 assert.equal(config.enableAutoCollectHeartbeat, false);
                 assert.equal(config.enableAutoCollectRequests, false);
                 assert.equal(config.enableAutoCollectDependencies, false);
-                assert.equal(config.enableAutoDependencyCorrelation, false);
-                assert.equal(config.enableUseAsyncHooks, false);
                 assert.equal(config.disableStatsbeat, false);
                 assert.equal(config.enableAutoCollectExtendedMetrics, false);
-                assert.equal(config.enableUseDiskRetryCaching, false);
-                assert.equal(config.enableResendInterval, 123);
-                assert.equal(config.enableMaxBytesOnDisk, 456);
                 assert.equal(config.disableStatsbeat, false);
                 assert.equal(config.enableSendLiveMetrics, false);
                 assert.equal(config.extendedMetricDisablers, "gc,heap");
@@ -158,47 +144,17 @@ describe("Library/Config", () => {
                 var config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
                 assert(typeof config.instrumentationKey === "string");
                 assert(typeof config.endpointUrl === "string");
-                assert(typeof config.maxBatchSize === "number");
-                assert(typeof config.maxBatchIntervalMs === "number");
-                assert(typeof config.disableAppInsights === "boolean");
                 assert(typeof config.samplingPercentage === "number");
-                assert(typeof config.correlationIdRetryIntervalMs === "number");
-                assert(typeof config.correlationHeaderExcludedDomains === "object");
                 assert(typeof config.quickPulseHost === "string");
             });
 
             it("should initialize values that we claim in README", () => {
                 var config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-                assert(config.maxBatchSize === 250);
-                assert(config.maxBatchIntervalMs === 15000);
-                assert(config.disableAppInsights === false);
                 assert(config.samplingPercentage === 100);
-                assert(config.correlationIdRetryIntervalMs === 30000);
-                assert(config.proxyHttpUrl === undefined);
-                assert(config.proxyHttpsUrl === undefined);
 
                 assert.equal(config.quickPulseHost, Constants.DEFAULT_LIVEMETRICS_HOST);
             });
 
-            it("should initialize values that we claim in README (2)", () => {
-                process.env.http_proxy = "test";
-                process.env.https_proxy = "test2";
-                JsonConfig["_instance"] = undefined;
-                var config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-                assert(config.proxyHttpUrl === "test");
-                assert(config.proxyHttpsUrl === "test2");
-                delete process.env.http_proxy;
-                delete process.env.https_proxy;
-            });
-
-            it("should add azure domain to excluded list", () => {
-                var config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-                assert.equal(
-                    config.correlationHeaderExcludedDomains[0].toString(),
-                    "*.core.windows.net"
-                );
-            });
-
             it("instrumentation key validation-valid key passed", () => {
                 var warnStub = sandbox.stub(console, "warn");
                 var config = new Config("1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
diff --git a/test/unitTests/library/jsonConfig.tests.ts b/test/unitTests/library/jsonConfig.tests.ts
index 736eeb3..42972da 100644
--- a/test/unitTests/library/jsonConfig.tests.ts
+++ b/test/unitTests/library/jsonConfig.tests.ts
@@ -2,7 +2,6 @@ import * as assert from "assert";
 import * as sinon from "sinon";
 import * as fs from "fs";
 import * as path from "path";
-import { Logger } from "../../../src/library/logging";
 import { JsonConfig } from "../../../src/library/configuration";
 
 describe("Json Config", () => {
@@ -27,13 +26,11 @@ describe("Json Config", () => {
     describe("config path", () => {
         it("Default file path", () => {
             let fileSpy = sandbox.spy(fs, "readFileSync");
-            let loggerSpy = sandbox.spy(Logger.getInstance(), "info");
             const config = JsonConfig.getInstance();
-            assert.equal(loggerSpy.callCount, 0);
-            assert.equal(fileSpy.called, 1);
+            config["_loadJsonFile"]();
+            assert.ok(fileSpy.called);
             let defaultPath = path.resolve(process.cwd(), "applicationinsights.json");
             assert.equal(fileSpy.args[0][0], defaultPath);
-            assert.equal(config.proxyHttpUrl, undefined);
         });
 
         it("Absolute file path", () => {
@@ -79,16 +76,7 @@ describe("Json Config", () => {
                 "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/"
             );
             assert.equal(config.endpointUrl, "testEndpointUrl");
-            assert.equal(config.maxBatchSize, 150);
-            assert.equal(config.maxBatchIntervalMs, 12000);
-            assert.equal(config.disableAppInsights, false);
             assert.equal(config.samplingPercentage, 30);
-            assert.equal(config.correlationIdRetryIntervalMs, 15000);
-            assert.equal(config.correlationHeaderExcludedDomains[0], "domain1");
-            assert.equal(config.correlationHeaderExcludedDomains[1], "domain2");
-            assert.equal(config.proxyHttpUrl, "testProxyHttpUrl");
-            assert.equal(config.proxyHttpsUrl, "testProxyHttpsUrl");
-            assert.equal(config.ignoreLegacyHeaders, false);
             assert.equal(config.enableAutoCollectExternalLoggers, false);
             assert.equal(config.enableAutoCollectConsole, false);
             assert.equal(config.enableAutoCollectExceptions, false);
@@ -97,19 +85,11 @@ describe("Json Config", () => {
             assert.equal(config.enableAutoCollectHeartbeat, false);
             assert.equal(config.enableAutoCollectRequests, false);
             assert.equal(config.enableAutoCollectDependencies, false);
-            assert.equal(config.enableAutoDependencyCorrelation, false);
-            assert.equal(config.enableUseAsyncHooks, false);
             assert.equal(config.disableStatsbeat, false);
             assert.equal(config.enableAutoCollectExtendedMetrics, false);
-            assert.equal(config.noHttpAgentKeepAlive, false);
-            assert.equal(config.enableUseDiskRetryCaching, false);
-            assert.equal(config.enableResendInterval, 123);
-            assert.equal(config.enableMaxBytesOnDisk, 456);
             assert.equal(config.disableStatsbeat, false);
             assert.equal(config.enableSendLiveMetrics, false);
             assert.equal(config.extendedMetricDisablers, "gc,heap");
-            assert.equal(config.noDiagnosticChannel, false);
-            assert.equal(config.noPatchModules, "console,redis");
             assert.equal(config.quickPulseHost, "testquickpulsehost.com");
         });
 
@@ -127,13 +107,8 @@ describe("Json Config", () => {
             process.env = env;
             const config = JsonConfig.getInstance();
             assert.equal(config.connectionString, "TestConnectionString");
-            assert.equal(config.proxyHttpUrl, "testProxyHttpUrl2");
-            assert.equal(config.proxyHttpsUrl, "testProxyHttpsUrl2");
             assert.equal(config.extendedMetricDisablers, "gc");
             assert.equal(config.disableAllExtendedMetrics, true);
-            assert.equal(config.noDiagnosticChannel, true);
-            assert.equal(config.noHttpAgentKeepAlive, true);
-            assert.equal(config.noPatchModules, "azuresdk");
             assert.equal(config.disableStatsbeat, true);
         });
 
@@ -159,13 +134,8 @@ describe("Json Config", () => {
                 config.connectionString,
                 "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/"
             );
-            assert.equal(config.proxyHttpUrl, "testProxyHttpUrl");
-            assert.equal(config.proxyHttpsUrl, "testProxyHttpsUrl");
             assert.equal(config.extendedMetricDisablers, "gc,heap");
             assert.equal(config.disableAllExtendedMetrics, false);
-            assert.equal(config.noDiagnosticChannel, false);
-            assert.equal(config.noHttpAgentKeepAlive, false);
-            assert.equal(config.noPatchModules, "console,redis");
             assert.equal(config.disableStatsbeat, false);
         });
     });
diff --git a/test/unitTests/library/metricHandler.tests.ts b/test/unitTests/library/metricHandler.tests.ts
index aeb9d5e..15dc08a 100644
--- a/test/unitTests/library/metricHandler.tests.ts
+++ b/test/unitTests/library/metricHandler.tests.ts
@@ -46,119 +46,4 @@ describe("Library/MetricHandler", () => {
             assert.ok(stub.calledOnce, "start called");
         });
     });
-
-
-    describe("#manual track APIs", () => {
-        it("trackMetric", (done) => {
-            let handler = new MetricHandler(_config)
-            let stub = sinon.stub(handler["_batchProcessor"]["_exporter"], "export").callsFake((envelopes: any, resultCallback: any) => {
-                return new Promise((resolve, reject) => {
-                    resultCallback({
-                        code: ExportResultCode.SUCCESS
-                    });
-                    resolve();
-                });
-            });
-            let metrics: MetricPointTelemetry[] = [
-                {
-                    name: "testName",
-                    value: 0,
-                    namespace: "testNamespace",
-                    kind: "Measurement",
-                    count: 1,
-                    min: 2,
-                    max: 3,
-                    stdDev: 4,
-                }
-            ];
-            let properties: { [key: string]: number } = {};
-            properties["test"] = 123;
-            let telemetry: MetricTelemetry = {
-                metrics: metrics,
-                properties: properties,
-            };
-            handler.trackMetric(telemetry);
-            handler.flush().then(() => {
-                assert.ok(stub.calledOnce, "Export called");
-                let envelopes = stub.args[0][0] as any;
-                assert.equal(envelopes.length, 1);
-                assert.equal(envelopes[0].name, "Microsoft.ApplicationInsights.1aa11111bbbb1ccc8dddeeeeffff3333.Metric");
-                assert.equal(envelopes[0].version, "1");
-                assert.equal(envelopes[0].instrumentationKey, "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-                assert.equal(envelopes[0].sampleRate, "100");
-                assert.ok(envelopes[0].time);
-                assert.equal(envelopes[0].data.baseType, "MetricData");
-                assert.equal(envelopes[0].data.baseData["metrics"].length, 1);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["name"], "testName");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["namespace"], "testNamespace");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["dataPointType"], "Measurement");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["value"], 0);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["count"], 1);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["min"], 2);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["max"], 3);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["stdDev"], 4);
-                assert.equal(envelopes[0].data.baseData["properties"]["test"], "123");
-                assert.equal(envelopes[0].data.baseData["version"], "2");
-                done();
-            }).catch((error) => {
-                done(error);
-            });;
-        });
-
-        it("trackStatsbeatMetric", (done) => {
-            let handler = new MetricHandler(_config)
-            let stub = sinon.stub(handler["_batchProcessor"]["_exporter"], "export").callsFake((envelopes: any, resultCallback: any) => {
-                return new Promise((resolve, reject) => {
-                    resultCallback({
-                        code: ExportResultCode.SUCCESS
-                    });
-                    resolve();
-                });
-            });
-            let metrics: MetricPointTelemetry[] = [
-                {
-                    name: "testName",
-                    value: 0,
-                    namespace: "testNamespace",
-                    kind: "Measurement",
-                    count: 1,
-                    min: 2,
-                    max: 3,
-                    stdDev: 4,
-                }
-            ];
-            let properties: { [key: string]: number } = {};
-            properties["test"] = 123;
-            let telemetry: MetricTelemetry = {
-                metrics: metrics,
-                properties: properties,
-            };
-            handler.trackStatsbeatMetric(telemetry);
-            handler.flush().then(() => {
-                assert.ok(stub.calledOnce, "Export called");
-                let envelopes = stub.args[0][0] as any;
-                assert.equal(envelopes.length, 1);
-                assert.equal(envelopes[0].name, "Statsbeat");
-                assert.equal(envelopes[0].version, "1");
-                assert.equal(envelopes[0].instrumentationKey, "1aa11111-bbbb-1ccc-8ddd-eeeeffff3333");
-                assert.equal(envelopes[0].sampleRate, "100");
-                assert.ok(envelopes[0].time);
-                assert.equal(envelopes[0].data.baseType, "MetricData");
-                assert.equal(envelopes[0].data.baseData["metrics"].length, 1);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["name"], "testName");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["namespace"], "testNamespace");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["dataPointType"], "Measurement");
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["value"], 0);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["count"], 1);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["min"], 2);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["max"], 3);
-                assert.equal(envelopes[0].data.baseData["metrics"][0]["stdDev"], 4);
-                assert.equal(envelopes[0].data.baseData["properties"]["test"], "123");
-                assert.equal(envelopes[0].data.baseData["version"], "2");
-                done();
-            }).catch((error) => {
-                done(error);
-            });;
-        });
-    });
 });