Skip to content

Commit

Permalink
Remove fs instrumentation by default (#847)
Browse files Browse the repository at this point in the history
Remove the fs module instrumentation by default as it's causing some
issues with apps, making them unable to start.

Part of #845
  • Loading branch information
tombruijn authored Feb 1, 2023
1 parent 70fb916 commit e4ae654
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 65 deletions.
6 changes: 6 additions & 0 deletions .changesets/remove-fs-instrumentation.md
Original file line number Diff line number Diff line change
@@ -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).
31 changes: 2 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -322,11 +319,6 @@ export class Client {
},
"@prisma/instrumentation": {
middleware: true
},
"@opentelemetry/instrumentation-fs": {
createHook: () => {
return trace.getActiveSpan() !== undefined
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion test/express-redis/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions test/express-redis/app/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, () => {
Expand Down
13 changes: 0 additions & 13 deletions test/express-redis/tests/spec/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e4ae654

Please sign in to comment.