Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Winston Diagnostic Channel #1327

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
862 changes: 484 additions & 378 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@
"@azure/core-client": "^1.0.0",
"@azure/core-rest-pipeline": "^1.9.2",
"@azure/identity": "^3.1.3",
"@azure/monitor-opentelemetry": "^1.4.0",
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.22",
"@azure/monitor-opentelemetry": "^1.5.0",
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.23",
"@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.5",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/api-logs": "^0.50.0",
"@opentelemetry/core": "^1.23.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.50.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.50.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
"@opentelemetry/otlp-exporter-base": "^0.50.0",
"@opentelemetry/resources": "^1.23.0",
"@opentelemetry/sdk-logs": "^0.50.0",
"@opentelemetry/sdk-metrics": "^1.23.0",
"@opentelemetry/sdk-trace-base": "^1.23.0",
"@opentelemetry/sdk-trace-node": "^1.23.0",
"@opentelemetry/semantic-conventions": "^1.23.0",
"@opentelemetry/api-logs": "^0.51.0",
"@opentelemetry/core": "^1.24.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.51.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.51.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
"@opentelemetry/otlp-exporter-base": "^0.51.0",
"@opentelemetry/resources": "^1.24.0",
"@opentelemetry/sdk-logs": "^0.51.0",
"@opentelemetry/sdk-metrics": "^1.24.0",
"@opentelemetry/sdk-trace-base": "^1.24.0",
"@opentelemetry/sdk-trace-node": "^1.24.0",
"@opentelemetry/semantic-conventions": "^1.24.0",
"diagnostic-channel": "1.1.1",
"diagnostic-channel-publishers": "1.0.8"
}
Expand Down
4 changes: 0 additions & 4 deletions src/logs/autoCollectLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ export class AutoCollectLogs {
public enable(options: InstrumentationOptions) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("./diagnostic-channel/console.sub").enable(options.console);
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("./diagnostic-channel/winston.sub").enable(options.winston);
}

public shutdown() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("./diagnostic-channel/console.sub").dispose();
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("./diagnostic-channel/winston.sub").dispose();
}
}
2 changes: 0 additions & 2 deletions src/logs/diagnostic-channel/initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export function enablePublishers() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
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) {
Expand Down
69 changes: 0 additions & 69 deletions src/logs/diagnostic-channel/winston.sub.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/shim/shim-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class Config implements IConfig {
redis4: { enabled: true },
postgreSql: { enabled: true },
bunyan: { enabled: true },
winston: { enabled: true },
},
otlpTraceExporterConfig: {},
otlpMetricExporterConfig: {},
Expand All @@ -149,7 +150,6 @@ class Config implements IConfig {
(options.instrumentationOptions as InstrumentationOptions) = {
...options.instrumentationOptions,
console: { enabled: false },
winston: { enabled: true },
};
if (this.samplingPercentage) {
options.samplingRatio = this.samplingPercentage / 100;
Expand Down
2 changes: 0 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export interface AzureMonitorOpenTelemetryOptions extends DistroOptions {
export interface InstrumentationOptions extends DistroInstrumentationOptions {
/** Console Instrumentation Config */
console?: InstrumentationConfig & { logSendingLevel?: SeverityNumber };
/** Winston Instrumentation Config */
winston?: InstrumentationConfig & { logSendingLevel?: SeverityNumber };
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/functionalTests/runner/testSequence.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
{"path": "/mongo", "steps": ["MongoInsert", "MongoInsertMany", "MongoUpdateOne", "MongoCreateIndex", "MongoFind"]},
{"path": "/mySql", "steps": ["MySQLQuery", "Timeout"]},
{"path": "/redis", "steps": ["RedisGet", "RedisSet", "RedisHset", "RedisHkeys", "RedisHincrby"]},
{"path": "/diagChannelConsole", "steps": ["ConsoleLog", "ConsoleWarn", "ConsoleError", "ConsoleInfo"]},
{"path": "/diagChannelWinston", "steps": ["WinstonError", "WinstonWarn", "WinstonInfo", "WinstonVerbose", "WinstonDebug", "WinstonSilly", "WinstonError2", "WinstonWarn2", "WinstonInfo2"]}
{"path": "/diagChannelConsole", "steps": ["ConsoleLog", "ConsoleWarn", "ConsoleError", "ConsoleInfo"]}
]
2 changes: 0 additions & 2 deletions test/unitTests/agent/agentLoader.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as sinon from "sinon";
import { AgentLoader } from "../../../src/agent/agentLoader";
import * as azureMonitor from "@azure/monitor-opentelemetry";
import { DiagnosticMessageId } from "../../../src/agent/types";
import { dispose } from "../../../src/logs/diagnostic-channel/winston.sub";

describe("agent/agentLoader", () => {
let originalEnv: NodeJS.ProcessEnv;
Expand Down Expand Up @@ -54,7 +53,6 @@ describe("agent/agentLoader", () => {
});

afterEach(() => {
dispose();
process.env = originalEnv;
sandbox.restore();
});
Expand Down
2 changes: 0 additions & 2 deletions test/unitTests/agent/aksLoader.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { AKSLoader } from "../../../src/agent/aksLoader";
import { DiagnosticLogger } from "../../../src/agent/diagnostics/diagnosticLogger";
import { FileWriter } from "../../../src/agent/diagnostics/writers/fileWriter";
import { dispose as disposeConsole } from "../../../src/logs/diagnostic-channel/console.sub";
import { dispose as disposeWinston } from "../../../src/logs/diagnostic-channel/winston.sub";

describe("agent/AKSLoader", () => {
let originalEnv: NodeJS.ProcessEnv;
Expand All @@ -23,7 +22,6 @@ describe("agent/AKSLoader", () => {

afterEach(() => {
disposeConsole();
disposeWinston();
process.env = originalEnv;
sandbox.restore();
});
Expand Down
88 changes: 0 additions & 88 deletions test/unitTests/logs/winston.tests.ts

This file was deleted.

8 changes: 4 additions & 4 deletions test/unitTests/shim/config.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ describe("shim/configuration/config", () => {
"redis4": { "enabled": true },
"postgreSql": { "enabled": true },
"bunyan": { "enabled": true },
"winston": { "enabled": true },
"console": { "enabled": true },
"winston": { "enabled": true }
}),
"wrong instrumentationOptions");
assert.equal(JSON.stringify(options.instrumentationOptions.bunyan), JSON.stringify({ enabled: true }), "wrong bunyan setting");
Expand Down Expand Up @@ -141,8 +141,8 @@ describe("shim/configuration/config", () => {
"redis4": { "enabled": false },
"postgreSql": { "enabled": false },
"bunyan": { "enabled": false },
"winston": { "enabled": false },
"console":{ "enabled": false },
"winston": { "enabled": false }
}));
});

Expand All @@ -159,8 +159,8 @@ describe("shim/configuration/config", () => {
redis4: { enabled: false },
postgreSql: { enabled: false },
bunyan: { enabled: true },
console: { enabled: false },
winston: { enabled: true },
console: { enabled: false },
}));
});

Expand Down Expand Up @@ -189,8 +189,8 @@ describe("shim/configuration/config", () => {
"redis4": { "enabled": true },
"postgreSql": { "enabled": true },
"bunyan": { "enabled": false },
"winston": { "enabled": false },
"console": { "enabled": false },
"winston": { "enabled": false }
}));
});

Expand Down