Skip to content

Commit

Permalink
[Beta] Clean Up Shim Files & Fix Check for Extended Metrics Env Var (#…
Browse files Browse the repository at this point in the history
…1300)

* Clean up shim files and fix env var setting for extended metrics.

* Continue cleanup of extended metrics.

* Remove native metrics dead code and remove depdendency.
  • Loading branch information
JacksonWeber authored Mar 22, 2024
1 parent e0528d3 commit ac65ee3
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 349 deletions.
9 changes: 0 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@types/sinon": "^10.0.12",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"applicationinsights-native-metrics": "0.0.8",
"eslint": "^8.0.0",
"eslint-plugin-node": "^11.1.0",
"mocha": "^10.0.0",
Expand Down Expand Up @@ -87,13 +86,5 @@
"@opentelemetry/semantic-conventions": "^1.20.0",
"diagnostic-channel": "1.1.1",
"diagnostic-channel-publishers": "1.0.7"
},
"peerDependencies": {
"applicationinsights-native-metrics": "*"
},
"peerDependenciesMeta": {
"applicationinsights-native-metrics": {
"optional": true
}
}
}
174 changes: 0 additions & 174 deletions src/metrics/nativeMetrics.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/metrics/performanceCounters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export class PerformanceCounterMetrics {
}[];

/**
* Initializes a new instance of the NativeMetrics class.
* Creates performance counter instruments.
* @param options - Distro configuration.
* @param config - Native Metrics extra configuration.
* @param config - Application Insights configuration.
*/
constructor(config: ApplicationInsightsConfig, options?: { collectionInterval: number }) {
this._internalConfig = config;
Expand Down
12 changes: 1 addition & 11 deletions src/shared/configuration/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import {
envDetectorSync,
} from "@opentelemetry/resources";
import { JsonConfig } from "./jsonConfig";
import { AzureMonitorOpenTelemetryOptions, ExtendedMetricType, OTLPExporterConfig, InstrumentationOptions } from "../../types";
import { AzureMonitorOpenTelemetryOptions, OTLPExporterConfig, InstrumentationOptions } from "../../types";


export class ApplicationInsightsConfig {
public enableAutoCollectExceptions: boolean;
public extendedMetrics: { [type: string]: boolean };
/** OTLP Trace Exporter Configuration */
public otlpTraceExporterConfig: OTLPExporterConfig;
/** OTLP Metric Exporter Configuration */
Expand Down Expand Up @@ -57,10 +56,6 @@ export class ApplicationInsightsConfig {
this.otlpMetricExporterConfig = {};
this.otlpTraceExporterConfig = {};
this.enableAutoCollectPerformance = true;
this.extendedMetrics = {};
this.extendedMetrics[ExtendedMetricType.gc] = false;
this.extendedMetrics[ExtendedMetricType.heap] = false;
this.extendedMetrics[ExtendedMetricType.loop] = false;
this.enableAutoCollectExceptions = true;
this.enableAutoCollectPerformance = true;

Expand Down Expand Up @@ -142,11 +137,6 @@ export class ApplicationInsightsConfig {
jsonConfig.otlpLogExporterConfig
);

this.extendedMetrics = Object.assign(
this.extendedMetrics,
jsonConfig.extendedMetrics
);

this.samplingRatio =
jsonConfig.samplingRatio !== undefined ? jsonConfig.samplingRatio : this.samplingRatio;

Expand Down
2 changes: 0 additions & 2 deletions src/shared/configuration/jsonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const ENV_CONTENT = "APPLICATIONINSIGHTS_CONFIGURATION_CONTENT";
export class JsonConfig {
private static _instance: JsonConfig;
public enableAutoCollectExceptions: boolean;
public extendedMetrics: { [type: string]: boolean };
/** OTLP Trace Exporter Configuration */
public otlpTraceExporterConfig?: OTLPExporterConfig;
/** OTLP Metric Exporter Configuration */
Expand Down Expand Up @@ -75,7 +74,6 @@ export class JsonConfig {
try {
const jsonConfig: AzureMonitorOpenTelemetryOptions = JSON.parse(jsonString);
this.enableAutoCollectExceptions = jsonConfig.enableAutoCollectExceptions;
this.extendedMetrics = jsonConfig.extendedMetrics;
this.otlpLogExporterConfig = jsonConfig.otlpLogExporterConfig;
this.otlpMetricExporterConfig = jsonConfig.otlpMetricExporterConfig;
this.otlpTraceExporterConfig = jsonConfig.otlpTraceExporterConfig;
Expand Down
116 changes: 0 additions & 116 deletions src/shared/util/configHelper.ts

This file was deleted.

Loading

0 comments on commit ac65ee3

Please sign in to comment.