From e4ae654b2d4a37a1dbb8452b17731aa140421f50 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Wed, 1 Feb 2023 13:47:49 +0100 Subject: [PATCH] Remove fs instrumentation by default (#847) Remove the fs module instrumentation by default as it's causing some issues with apps, making them unable to start. Part of #845 --- .changesets/remove-fs-instrumentation.md | 6 +++++ package-lock.json | 31 ++--------------------- package.json | 1 - src/client.ts | 8 ------ test/express-redis/app/package-lock.json | 1 - test/express-redis/app/src/app.ts | 13 ---------- test/express-redis/tests/spec/app_spec.rb | 13 ---------- 7 files changed, 8 insertions(+), 65 deletions(-) create mode 100644 .changesets/remove-fs-instrumentation.md diff --git a/.changesets/remove-fs-instrumentation.md b/.changesets/remove-fs-instrumentation.md new file mode 100644 index 00000000..9b9c7785 --- /dev/null +++ b/.changesets/remove-fs-instrumentation.md @@ -0,0 +1,6 @@ +--- +bump: "patch" +type: "remove" +--- + +Remove fs instrumentation by default. It's causing issues on some installations. It can be manually added as [described in our fs module docs](https://docs.appsignal.com/nodejs/3.x/integrations/fsmodule.html). diff --git a/package-lock.json b/package-lock.json index 00cdb0ef..05383412 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,18 @@ { "name": "@appsignal/nodejs", - "version": "3.0.4", + "version": "3.0.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@appsignal/nodejs", - "version": "3.0.4", + "version": "3.0.6", "hasInstallScript": true, "license": "MIT", "dependencies": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/instrumentation-express": "^0.32.0", "@opentelemetry/instrumentation-fastify": "^0.31.0", - "@opentelemetry/instrumentation-fs": "^0.6.0", "@opentelemetry/instrumentation-graphql": "^0.33.0", "@opentelemetry/instrumentation-http": "^0.34.0", "@opentelemetry/instrumentation-ioredis": "^0.33.0", @@ -1421,22 +1420,6 @@ "@opentelemetry/api": "^1.3.0" } }, - "node_modules/@opentelemetry/instrumentation-fs": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-fs/-/instrumentation-fs-0.6.0.tgz", - "integrity": "sha512-TBnEW1wthnfcYA65VJqbFtDpKqDnwTqqJ9R1tQ4qU3qrxhRhN6mMOok6XaCbT+ddCerI7fvWHtm5jYBJ00XQmw==", - "dependencies": { - "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.34.0", - "@opentelemetry/semantic-conventions": "^1.0.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, "node_modules/@opentelemetry/instrumentation-graphql": { "version": "0.33.0", "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-graphql/-/instrumentation-graphql-0.33.0.tgz", @@ -12100,16 +12083,6 @@ "@opentelemetry/semantic-conventions": "^1.0.0" } }, - "@opentelemetry/instrumentation-fs": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-fs/-/instrumentation-fs-0.6.0.tgz", - "integrity": "sha512-TBnEW1wthnfcYA65VJqbFtDpKqDnwTqqJ9R1tQ4qU3qrxhRhN6mMOok6XaCbT+ddCerI7fvWHtm5jYBJ00XQmw==", - "requires": { - "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.34.0", - "@opentelemetry/semantic-conventions": "^1.0.0" - } - }, "@opentelemetry/instrumentation-graphql": { "version": "0.33.0", "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-graphql/-/instrumentation-graphql-0.33.0.tgz", diff --git a/package.json b/package.json index 6f17ee2d..b9498850 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "@opentelemetry/api": "^1.3.0", "@opentelemetry/instrumentation-express": "^0.32.0", "@opentelemetry/instrumentation-fastify": "^0.31.0", - "@opentelemetry/instrumentation-fs": "^0.6.0", "@opentelemetry/instrumentation-graphql": "^0.33.0", "@opentelemetry/instrumentation-http": "^0.34.0", "@opentelemetry/instrumentation-ioredis": "^0.33.0", diff --git a/src/client.ts b/src/client.ts index b9f09406..6d9af6bd 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,13 +11,11 @@ import { setParams, setSessionData } from "./helpers" import { BaseLogger, Logger, LoggerLevel } from "./logger" import { Instrumentation } from "@opentelemetry/instrumentation" -import { trace } from "@opentelemetry/api" import { ExpressInstrumentation, ExpressLayerType } from "@opentelemetry/instrumentation-express" import { FastifyInstrumentation } from "@opentelemetry/instrumentation-fastify" -import { FsInstrumentation } from "@opentelemetry/instrumentation-fs" import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql" import { HttpInstrumentation } from "@opentelemetry/instrumentation-http" import { IORedisInstrumentation } from "@opentelemetry/instrumentation-ioredis" @@ -46,7 +44,6 @@ import { SpanProcessor, TestModeSpanProcessor } from "./span_processor" const DefaultInstrumentations = { "@opentelemetry/instrumentation-express": ExpressInstrumentation, "@opentelemetry/instrumentation-fastify": FastifyInstrumentation, - "@opentelemetry/instrumentation-fs": FsInstrumentation, "@opentelemetry/instrumentation-graphql": GraphQLInstrumentation, "@opentelemetry/instrumentation-http": HttpInstrumentation, "@opentelemetry/instrumentation-ioredis": IORedisInstrumentation, @@ -322,11 +319,6 @@ export class Client { }, "@prisma/instrumentation": { middleware: true - }, - "@opentelemetry/instrumentation-fs": { - createHook: () => { - return trace.getActiveSpan() !== undefined - } } } } diff --git a/test/express-redis/app/package-lock.json b/test/express-redis/app/package-lock.json index e00bf595..c4951f58 100644 --- a/test/express-redis/app/package-lock.json +++ b/test/express-redis/app/package-lock.json @@ -35,7 +35,6 @@ "@opentelemetry/api": "^1.2.0", "@opentelemetry/instrumentation-express": "^0.31.2", "@opentelemetry/instrumentation-fastify": "^0.30.0", - "@opentelemetry/instrumentation-fs": "^0.5.0", "@opentelemetry/instrumentation-graphql": "^0.31.0", "@opentelemetry/instrumentation-http": "^0.32.0", "@opentelemetry/instrumentation-ioredis": "^0.32.1", diff --git a/test/express-redis/app/src/app.ts b/test/express-redis/app/src/app.ts index 2aeda7b9..168bc250 100644 --- a/test/express-redis/app/src/app.ts +++ b/test/express-redis/app/src/app.ts @@ -4,7 +4,6 @@ import ioredis from "ioredis" import { setTag, setCustomData, expressErrorHandler } from "@appsignal/nodejs" import { trace } from "@opentelemetry/api" import cookieParser from "cookie-parser" -import * as fs from "fs" const redisHost = "redis://redis:6379" const port = process.env.PORT @@ -66,18 +65,6 @@ app.get("/custom", (_req: any, res: any) => { res.send("200 OK") }) -app.get("/filesystem", (_req: any, res: any) => { - const filePath = "package.json" - - console.log(`Checking read and write permissions on ${filePath}`) - - fs.access(filePath, fs.constants.R_OK | fs.constants.W_OK, err => { - console.log(`${filePath} ${err ? "is not" : "is"} readable and writable`) - }) - - res.send("200 OK") -}) - app.use(expressErrorHandler()) app.listen(port, () => { diff --git a/test/express-redis/tests/spec/app_spec.rb b/test/express-redis/tests/spec/app_spec.rb index 159c5b1b..10725990 100644 --- a/test/express-redis/tests/spec/app_spec.rb +++ b/test/express-redis/tests/spec/app_spec.rb @@ -82,17 +82,4 @@ expect(custom_span.attributes["appsignal.tag.custom"]).to eql("tag") end end - - describe "GET /filesystem" do - it "creates an fs child span" do - response = HTTP.get("#{@test_app_url}/filesystem") - expect(response.status).to eq(200) - - expect(Span.root!).to be_http_span_with_route("GET /filesystem") - - fs_span = Span.find_by_name!("fs access") - expect(fs_span.parent.id).to eql(Span.root.id) - expect(fs_span.instrumentation_library_name).to eql("@opentelemetry/instrumentation-fs") - end - end end