diff --git a/bun.lock b/bun.lock index 6df237a9c..8d88d61d2 100644 --- a/bun.lock +++ b/bun.lock @@ -11,8 +11,10 @@ "@opentelemetry/api": "^1.9.0", "@opentelemetry/auto-instrumentations-node": "^0.62.1", "@opentelemetry/exporter-logs-otlp-http": "^0.203.0", - "@opentelemetry/exporter-metrics-otlp-http": "^0.203.0", - "@opentelemetry/exporter-trace-otlp-http": "^0.203.0", + "@opentelemetry/instrumentation-http": "^0.203.0", + "@opentelemetry/otlp-exporter-base": "^0.203.0", + "@opentelemetry/otlp-proto-exporter-base": "^0.51.1", + "@opentelemetry/otlp-transformer": "^0.203.0", "@opentelemetry/resources": "^2.0.1", "@opentelemetry/sdk-logs": "^0.203.0", "@opentelemetry/sdk-metrics": "^2.0.1", @@ -468,7 +470,7 @@ "@opentelemetry/context-async-hooks": ["@opentelemetry/context-async-hooks@2.0.1", "", { "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-XuY23lSI3d4PEqKA+7SLtAgwqIfc6E/E9eAQWLN1vlpC53ybO3o6jW4BsXo1xvz9lYyyWItfQDDLzezER01mCw=="], - "@opentelemetry/core": ["@opentelemetry/core@1.30.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "1.28.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ=="], + "@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], "@opentelemetry/exporter-logs-otlp-grpc": ["@opentelemetry/exporter-logs-otlp-grpc@0.203.0", "", { "dependencies": { "@grpc/grpc-js": "^1.7.1", "@opentelemetry/core": "2.0.1", "@opentelemetry/otlp-exporter-base": "0.203.0", "@opentelemetry/otlp-grpc-exporter-base": "0.203.0", "@opentelemetry/otlp-transformer": "0.203.0", "@opentelemetry/sdk-logs": "0.203.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-g/2Y2noc/l96zmM+g0LdeuyYKINyBwN6FJySoU15LHPLcMN/1a0wNk2SegwKcxrRdE7Xsm7fkIR5n6XFe3QpPw=="], @@ -578,6 +580,8 @@ "@opentelemetry/otlp-grpc-exporter-base": ["@opentelemetry/otlp-grpc-exporter-base@0.203.0", "", { "dependencies": { "@grpc/grpc-js": "^1.7.1", "@opentelemetry/core": "2.0.1", "@opentelemetry/otlp-exporter-base": "0.203.0", "@opentelemetry/otlp-transformer": "0.203.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-te0Ze1ueJF+N/UOFl5jElJW4U0pZXQ8QklgSfJ2linHN0JJsuaHG8IabEUi2iqxY8ZBDlSiz1Trfv5JcjWWWwQ=="], + "@opentelemetry/otlp-proto-exporter-base": ["@opentelemetry/otlp-proto-exporter-base@0.51.1", "", { "dependencies": { "@opentelemetry/core": "1.24.1", "@opentelemetry/otlp-exporter-base": "0.51.1", "protobufjs": "^7.2.3" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" } }, "sha512-gxxxwfk0inDMb5DLeuxQ3L8TtptxSiTNHE4nnAJH34IQXAVRhXSXW1rK8PmDKDngRPIZ6J7ncUCjjIn8b+AgqQ=="], + "@opentelemetry/otlp-transformer": ["@opentelemetry/otlp-transformer@0.203.0", "", { "dependencies": { "@opentelemetry/api-logs": "0.203.0", "@opentelemetry/core": "2.0.1", "@opentelemetry/resources": "2.0.1", "@opentelemetry/sdk-logs": "0.203.0", "@opentelemetry/sdk-metrics": "2.0.1", "@opentelemetry/sdk-trace-base": "2.0.1", "protobufjs": "^7.3.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-Y8I6GgoCna0qDQ2W6GCRtaF24SnvqvA8OfeTi7fqigD23u8Jpb4R5KFv/pRvrlGagcCLICMIyh9wiejp4TXu/A=="], "@opentelemetry/propagation-utils": ["@opentelemetry/propagation-utils@0.31.3", "", { "peerDependencies": { "@opentelemetry/api": "^1.0.0" } }, "sha512-ZI6LKjyo+QYYZY5SO8vfoCQ9A69r1/g+pyjvtu5RSK38npINN1evEmwqbqhbg2CdcIK3a4PN6pDAJz/yC5/gAA=="], @@ -3002,93 +3006,11 @@ "@iconify/utils/globals": ["globals@15.15.0", "", {}, "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg=="], - "@opentelemetry/core/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.28.0", "", {}, "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA=="], - - "@opentelemetry/exporter-logs-otlp-grpc/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-logs-otlp-http/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-logs-otlp-proto/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-metrics-otlp-grpc/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-metrics-otlp-http/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-metrics-otlp-proto/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-prometheus/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-trace-otlp-grpc/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-trace-otlp-http/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-trace-otlp-proto/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/exporter-zipkin/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-amqplib/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-aws-sdk/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-connect/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-express/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-fastify/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-fs/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-hapi/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-http/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-koa/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-mongoose/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-pg/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - "@opentelemetry/instrumentation-pg/@types/pg": ["@types/pg@8.15.4", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^2.2.0" } }, "sha512-I6UNVBAoYbvuWkkU3oosC8yxqH21f4/Jc4DK71JLG3dT2mdlGe1z+ep/LQGXaKaOgcvUrsQoPRqfgtMcvZiJhg=="], - "@opentelemetry/instrumentation-pino/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-restify/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/instrumentation-undici/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/otlp-exporter-base/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/otlp-grpc-exporter-base/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/otlp-transformer/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/propagator-b3/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/propagator-jaeger/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/resource-detector-alibaba-cloud/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/resource-detector-aws/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/resource-detector-azure/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], + "@opentelemetry/otlp-proto-exporter-base/@opentelemetry/core": ["@opentelemetry/core@1.24.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "1.24.1" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.9.0" } }, "sha512-wMSGfsdmibI88K9wB498zXY04yThPexo8jvwNNlm542HZB7XrrMRBbAyKJqG8qDRJwIBdBrPMi4V9ZPW/sqrcg=="], - "@opentelemetry/resource-detector-container/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/resource-detector-gcp/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/resources/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sdk-logs/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sdk-metrics/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sdk-node/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sdk-trace-base/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sdk-trace-node/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], - - "@opentelemetry/sql-common/@opentelemetry/core": ["@opentelemetry/core@2.0.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-MaZk9SJIDgo1peKevlbhP6+IwIiNPNmswNL4AF0WaQJLbHXjr9SrZMgS12+iqr9ToV4ZVosCcc0f8Rg67LXjxw=="], + "@opentelemetry/otlp-proto-exporter-base/@opentelemetry/otlp-exporter-base": ["@opentelemetry/otlp-exporter-base@0.51.1", "", { "dependencies": { "@opentelemetry/core": "1.24.1" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" } }, "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg=="], "@redocly/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], @@ -3128,8 +3050,6 @@ "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], - "@vercel/otel/@opentelemetry/api-logs": ["@opentelemetry/api-logs@0.46.0", "", { "dependencies": { "@opentelemetry/api": "^1.0.0" } }, "sha512-+9BcqfiEDGPXEIo+o3tso/aqGM5dGbGwAkGVp3FPpZ8GlkK1YlaKRd9gMVyPaeRATwvO5wYGGnCsAc/sMMM9Qw=="], - "@vercel/otel/@opentelemetry/instrumentation": ["@opentelemetry/instrumentation@0.46.0", "", { "dependencies": { "@types/shimmer": "^1.0.2", "import-in-the-middle": "1.7.1", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2", "shimmer": "^1.2.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-a9TijXZZbk0vI5TGLZl+0kxyFfrXHhX6Svtz7Pp2/VBlCSKrazuULEyoJQrOknJyFWNMEmbbJgOciHCCpQcisw=="], "@vercel/otel/@opentelemetry/sdk-trace-base": ["@opentelemetry/sdk-trace-base@1.30.1", "", { "dependencies": { "@opentelemetry/core": "1.30.1", "@opentelemetry/resources": "1.30.1", "@opentelemetry/semantic-conventions": "1.28.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg=="], @@ -3356,6 +3276,8 @@ "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], + "@opentelemetry/otlp-proto-exporter-base/@opentelemetry/core/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.24.1", "", {}, "sha512-VkliWlS4/+GHLLW7J/rVBA00uXus1SWvwFvcUDxDwmFxYfg/2VI6ekwdXS28cjI8Qz2ky2BzG8OUHo+WeYIWqw=="], + "@redocly/openapi-core/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime/@tybys/wasm-util": ["@tybys/wasm-util@0.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-VyyPYFlOMNylG45GoAe0xDoLwWuowvf92F9kySqzYh8vmYm7D2u4iUJKa1tOUpS70Ku13ASrOkS4ScXFsTaCNQ=="], @@ -3368,6 +3290,8 @@ "@vercel/otel/@opentelemetry/instrumentation/import-in-the-middle": ["import-in-the-middle@1.7.1", "", { "dependencies": { "acorn": "^8.8.2", "acorn-import-assertions": "^1.9.0", "cjs-module-lexer": "^1.2.2", "module-details-from-path": "^1.0.3" } }, "sha512-1LrZPDtW+atAxH42S6288qyDFNQ2YCty+2mxEPRtfazH6Z5QwkaBSTS2ods7hnVJioF6rkRfNoA6A/MstpFXLg=="], + "@vercel/otel/@opentelemetry/sdk-trace-base/@opentelemetry/core": ["@opentelemetry/core@1.30.1", "", { "dependencies": { "@opentelemetry/semantic-conventions": "1.28.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ=="], + "@vercel/otel/@opentelemetry/sdk-trace-base/@opentelemetry/resources": ["@opentelemetry/resources@1.30.1", "", { "dependencies": { "@opentelemetry/core": "1.30.1", "@opentelemetry/semantic-conventions": "1.28.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA=="], "@vercel/otel/@opentelemetry/sdk-trace-base/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.28.0", "", {}, "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA=="], diff --git a/next.config.mjs b/next.config.mjs index 550617903..c7e836809 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -11,6 +11,7 @@ const config = { dynamic: 180, static: 180, }, + nodeMiddleware: true, serverActions: { bodySizeLimit: '5mb', }, @@ -20,7 +21,6 @@ const config = { fullUrl: true, }, }, - serverExternalPackages: ['pino', 'pino-loki'], trailingSlash: false, webpack: (config) => { config.module.rules.push({ diff --git a/package.json b/package.json index 288722b6c..4da3e4d79 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,10 @@ "@opentelemetry/api": "^1.9.0", "@opentelemetry/auto-instrumentations-node": "^0.62.1", "@opentelemetry/exporter-logs-otlp-http": "^0.203.0", - "@opentelemetry/exporter-metrics-otlp-http": "^0.203.0", - "@opentelemetry/exporter-trace-otlp-http": "^0.203.0", + "@opentelemetry/instrumentation-http": "^0.203.0", + "@opentelemetry/otlp-exporter-base": "^0.203.0", + "@opentelemetry/otlp-proto-exporter-base": "^0.51.1", + "@opentelemetry/otlp-transformer": "^0.203.0", "@opentelemetry/resources": "^2.0.1", "@opentelemetry/sdk-logs": "^0.203.0", "@opentelemetry/sdk-metrics": "^2.0.1", diff --git a/src/__test__/development/metrics.test.ts b/src/__test__/development/metrics.test.ts index 800a48ae2..d38926afc 100644 --- a/src/__test__/development/metrics.test.ts +++ b/src/__test__/development/metrics.test.ts @@ -1,4 +1,4 @@ -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { Sandbox } from 'e2b' import { describe, expect, it } from 'vitest' diff --git a/src/app/(auth)/auth/cli/page.tsx b/src/app/(auth)/auth/cli/page.tsx index 7196798be..e283f5ceb 100644 --- a/src/app/(auth)/auth/cli/page.tsx +++ b/src/app/(auth)/auth/cli/page.tsx @@ -1,5 +1,5 @@ import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { createClient } from '@/lib/clients/supabase/server' import { encodedRedirect } from '@/lib/utils/auth' import { bailOutFromPPR, generateE2BUserAccessToken } from '@/lib/utils/server' diff --git a/src/app/(rewrites)/[[...slug]]/route.ts b/src/app/(rewrites)/[[...slug]]/route.ts index 22fda5a12..5ada8af39 100644 --- a/src/app/(rewrites)/[[...slug]]/route.ts +++ b/src/app/(rewrites)/[[...slug]]/route.ts @@ -2,7 +2,7 @@ import sitemap from '@/app/sitemap' import { ALLOW_SEO_INDEXING } from '@/configs/flags' import { ROUTE_REWRITE_CONFIG } from '@/configs/rewrites' import { BASE_URL } from '@/configs/urls' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { getRewriteForPath, rewriteContentPagesHtml, diff --git a/src/app/api/auth/callback/route.ts b/src/app/api/auth/callback/route.ts index 859454e20..4b2dc3e93 100644 --- a/src/app/api/auth/callback/route.ts +++ b/src/app/api/auth/callback/route.ts @@ -1,5 +1,5 @@ import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { createClient } from '@/lib/clients/supabase/server' import { encodedRedirect } from '@/lib/utils/auth' import { redirect } from 'next/navigation' diff --git a/src/app/api/auth/confirm/route.ts b/src/app/api/auth/confirm/route.ts index 91a95a26d..bd92ff780 100644 --- a/src/app/api/auth/confirm/route.ts +++ b/src/app/api/auth/confirm/route.ts @@ -1,5 +1,5 @@ import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { createClient } from '@/lib/clients/supabase/server' import { encodedRedirect } from '@/lib/utils/auth' import { redirect } from 'next/navigation' diff --git a/src/app/api/teams/[teamId]/sandboxes/metrics/route.ts b/src/app/api/teams/[teamId]/sandboxes/metrics/route.ts index 0a33ef5e8..d845a5379 100644 --- a/src/app/api/teams/[teamId]/sandboxes/metrics/route.ts +++ b/src/app/api/teams/[teamId]/sandboxes/metrics/route.ts @@ -5,7 +5,7 @@ import { infra } from '@/lib/clients/api' import { createClient } from '@/lib/clients/supabase/server' import { transformMetricsToClientMetrics } from '@/lib/utils/sandboxes' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError } from '@/lib/utils/action' import { MetricsRequestSchema, MetricsResponse } from './types' diff --git a/src/app/dashboard/route.ts b/src/app/dashboard/route.ts index c63abcc5b..92735cb54 100644 --- a/src/app/dashboard/route.ts +++ b/src/app/dashboard/route.ts @@ -2,6 +2,7 @@ import { COOKIE_KEYS } from '@/configs/keys' import { PROTECTED_URLS } from '@/configs/urls' import { supabaseAdmin } from '@/lib/clients/supabase/admin' import { createClient } from '@/lib/clients/supabase/server' +import { checkAuthenticated } from '@/lib/utils/server' import { cookies } from 'next/headers' import { NextRequest, NextResponse } from 'next/server' @@ -30,9 +31,9 @@ export async function GET(request: NextRequest) { // 2. Create Supabase client and get user const supabase = await createClient() - const { data, error } = await supabase.auth.getUser() + const { user } = await checkAuthenticated() - if (error || !data.user) { + if (!user) { // Redirect to sign-in if not authenticated return NextResponse.redirect(new URL('/sign-in', request.url)) } @@ -53,7 +54,7 @@ export async function GET(request: NextRequest) { team:teams(*) ` ) - .eq('user_id', data.user.id) + .eq('user_id', user.id) if (!teamsData?.length) { // No teams, redirect to new team creation diff --git a/src/features/dashboard/sandbox/header/refresh.tsx b/src/features/dashboard/sandbox/header/refresh.tsx index 8fe479e8e..26abf07d2 100644 --- a/src/features/dashboard/sandbox/header/refresh.tsx +++ b/src/features/dashboard/sandbox/header/refresh.tsx @@ -1,6 +1,6 @@ 'use client' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { PollingButton } from '@/ui/polling-button' import { useCallback, useState } from 'react' import { serializeError } from 'serialize-error' diff --git a/src/features/dashboard/sandbox/inspect/not-found.tsx b/src/features/dashboard/sandbox/inspect/not-found.tsx index 632c4df4e..6f66748be 100644 --- a/src/features/dashboard/sandbox/inspect/not-found.tsx +++ b/src/features/dashboard/sandbox/inspect/not-found.tsx @@ -1,7 +1,7 @@ 'use client' import { PROTECTED_URLS } from '@/configs/urls' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { useSandboxInspectAnalytics } from '@/lib/hooks/use-analytics' import { cn } from '@/lib/utils' import { AsciiBackgroundPattern } from '@/ui/patterns' diff --git a/src/features/dashboard/sandbox/inspect/root-path-input.tsx b/src/features/dashboard/sandbox/inspect/root-path-input.tsx index ec2e2131e..7d65f6d99 100644 --- a/src/features/dashboard/sandbox/inspect/root-path-input.tsx +++ b/src/features/dashboard/sandbox/inspect/root-path-input.tsx @@ -1,6 +1,6 @@ 'use client' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { useSandboxInspectAnalytics } from '@/lib/hooks/use-analytics' import { cn } from '@/lib/utils' import { Button } from '@/ui/primitives/button' diff --git a/src/features/dashboard/sandboxes/table-config.tsx b/src/features/dashboard/sandboxes/table-config.tsx index 1cb702053..78442bb76 100644 --- a/src/features/dashboard/sandboxes/table-config.tsx +++ b/src/features/dashboard/sandboxes/table-config.tsx @@ -6,7 +6,7 @@ import { ColumnDef, FilterFn, useReactTable } from '@tanstack/react-table' import { isWithinInterval } from 'date-fns' import { DateRange } from 'react-day-picker' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { ClientSandboxMetric } from '@/types/sandboxes.types' import posthog from 'posthog-js' import { serializeError } from 'serialize-error' diff --git a/src/features/dashboard/usage/cost-card.tsx b/src/features/dashboard/usage/cost-card.tsx index faacf8965..dd90fe84d 100644 --- a/src/features/dashboard/usage/cost-card.tsx +++ b/src/features/dashboard/usage/cost-card.tsx @@ -1,4 +1,4 @@ -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { getUsageThroughReactCache } from '@/server/usage/get-usage' import { ChartPlaceholder } from '@/ui/chart-placeholder' import { diff --git a/src/features/dashboard/usage/ram-card.tsx b/src/features/dashboard/usage/ram-card.tsx index 8d73e7e62..953d9635b 100644 --- a/src/features/dashboard/usage/ram-card.tsx +++ b/src/features/dashboard/usage/ram-card.tsx @@ -1,4 +1,4 @@ -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { getUsageThroughReactCache } from '@/server/usage/get-usage' import { ChartPlaceholder } from '@/ui/chart-placeholder' import { diff --git a/src/features/dashboard/usage/vcpu-card.tsx b/src/features/dashboard/usage/vcpu-card.tsx index 9105648d2..19b3a4ea1 100644 --- a/src/features/dashboard/usage/vcpu-card.tsx +++ b/src/features/dashboard/usage/vcpu-card.tsx @@ -1,4 +1,4 @@ -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { getUsageThroughReactCache } from '@/server/usage/get-usage' import { ChartPlaceholder } from '@/ui/chart-placeholder' import { diff --git a/src/instrumentation.ts b/src/instrumentation.ts index f938f356b..f5a8b8163 100644 --- a/src/instrumentation.ts +++ b/src/instrumentation.ts @@ -4,7 +4,7 @@ export async function register() { if (!process.env.OTEL_EXPORTER_OTLP_ENDPOINT) return if (process.env.NEXT_RUNTIME === 'nodejs') { - await import('./instrumentation.node') + await import('./instrumentation/instrumentation.node') } if (process.env.NEXT_RUNTIME === 'edge') { @@ -16,11 +16,6 @@ export async function register() { VERCEL_REGION, VERCEL_DEPLOYMENT_ID, VERCEL_GIT_COMMIT_SHA, - VERCEL_GIT_COMMIT_MESSAGE, - VERCEL_GIT_COMMIT_AUTHOR_NAME, - VERCEL_GIT_REPO_SLUG, - VERCEL_GIT_REPO_OWNER, - VERCEL_GIT_PROVIDER, } = process.env registerOTel({ @@ -40,21 +35,6 @@ export async function register() { ...(VERCEL_GIT_COMMIT_SHA && { 'vercel.git.commit_sha': VERCEL_GIT_COMMIT_SHA, }), - ...(VERCEL_GIT_COMMIT_MESSAGE && { - 'vercel.git.commit_message': VERCEL_GIT_COMMIT_MESSAGE, - }), - ...(VERCEL_GIT_COMMIT_AUTHOR_NAME && { - 'vercel.git.commit_author': VERCEL_GIT_COMMIT_AUTHOR_NAME, - }), - ...(VERCEL_GIT_REPO_SLUG && { - 'vercel.git.repo_slug': VERCEL_GIT_REPO_SLUG, - }), - ...(VERCEL_GIT_REPO_OWNER && { - 'vercel.git.repo_owner': VERCEL_GIT_REPO_OWNER, - }), - ...(VERCEL_GIT_PROVIDER && { - 'vercel.git.provider': VERCEL_GIT_PROVIDER, - }), }, }) } diff --git a/src/instrumentation.node.ts b/src/instrumentation/instrumentation.node.ts similarity index 78% rename from src/instrumentation.node.ts rename to src/instrumentation/instrumentation.node.ts index 169ee8aab..247fa2cce 100644 --- a/src/instrumentation.node.ts +++ b/src/instrumentation/instrumentation.node.ts @@ -7,14 +7,17 @@ import { hostDetector, resourceFromAttributes, } from '@opentelemetry/resources' -import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs' +import { SimpleLogRecordProcessor } from '@opentelemetry/sdk-logs' import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics' import { NodeSDK } from '@opentelemetry/sdk-node' +import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base' import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, } from '@opentelemetry/semantic-conventions' import { FetchInstrumentation } from '@vercel/otel' +import { CompositeSpanProcessor } from './span-processor' +import { VercelRuntimeSpanExporter } from './vercel/exporter' function parseResourceAttributes( resourceAttrs?: string @@ -44,13 +47,12 @@ const { VERCEL_REGION, VERCEL_DEPLOYMENT_ID, VERCEL_GIT_COMMIT_SHA, - VERCEL_GIT_COMMIT_MESSAGE, - VERCEL_GIT_COMMIT_AUTHOR_NAME, - VERCEL_GIT_REPO_SLUG, - VERCEL_GIT_REPO_OWNER, - VERCEL_GIT_PROVIDER, } = process.env +const traceExporter = new OTLPTraceExporter({ + url: `${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`, +}) + const sdk = new NodeSDK({ resource: resourceFromAttributes({ [ATTR_SERVICE_NAME]: OTEL_SERVICE_NAME || 'e2b-dashboard', @@ -58,6 +60,7 @@ const sdk = new NodeSDK({ // Parse additional resource attributes from environment ...parseResourceAttributes(OTEL_RESOURCE_ATTRIBUTES), // Vercel context + 'vercel.runtime': process.env.NEXT_RUNTIME || 'nodejs', ...(VERCEL_ENV && { 'vercel.env': VERCEL_ENV }), ...(VERCEL_URL && { 'vercel.url': VERCEL_URL }), ...(VERCEL_PROJECT_PRODUCTION_URL && { @@ -71,30 +74,23 @@ const sdk = new NodeSDK({ ...(VERCEL_GIT_COMMIT_SHA && { 'vercel.git.commit_sha': VERCEL_GIT_COMMIT_SHA, }), - ...(VERCEL_GIT_COMMIT_MESSAGE && { - 'vercel.git.commit_message': VERCEL_GIT_COMMIT_MESSAGE, - }), - ...(VERCEL_GIT_COMMIT_AUTHOR_NAME && { - 'vercel.git.commit_author': VERCEL_GIT_COMMIT_AUTHOR_NAME, - }), - ...(VERCEL_GIT_REPO_SLUG && { - 'vercel.git.repo_slug': VERCEL_GIT_REPO_SLUG, - }), - ...(VERCEL_GIT_REPO_OWNER && { - 'vercel.git.repo_owner': VERCEL_GIT_REPO_OWNER, - }), - ...(VERCEL_GIT_PROVIDER && { 'vercel.git.provider': VERCEL_GIT_PROVIDER }), - }), - traceExporter: new OTLPTraceExporter({ - url: `${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`, }), + spanProcessors: [ + new CompositeSpanProcessor( + [ + new BatchSpanProcessor(new VercelRuntimeSpanExporter()), + new BatchSpanProcessor(traceExporter), + ], + undefined + ), + ], metricReader: new PeriodicExportingMetricReader({ exporter: new OTLPMetricExporter({ url: `${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/metrics`, }), }), logRecordProcessors: [ - new BatchLogRecordProcessor( + new SimpleLogRecordProcessor( new OTLPLogExporter({ url: `${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs`, }) @@ -106,6 +102,9 @@ const sdk = new NodeSDK({ '@opentelemetry/instrumentation-fs': { enabled: false, }, + '@opentelemetry/instrumentation-http': { + enabled: false, + }, }), new FetchInstrumentation(), ], diff --git a/src/instrumentation/span-processor.ts b/src/instrumentation/span-processor.ts new file mode 100644 index 000000000..5f0fbf858 --- /dev/null +++ b/src/instrumentation/span-processor.ts @@ -0,0 +1,211 @@ +import type { Attributes, Context } from '@opentelemetry/api' +import { diag, SpanKind, TraceFlags } from '@opentelemetry/api' +import type { + ReadableSpan, + Span, + SpanProcessor, +} from '@opentelemetry/sdk-trace-base' +import type { AttributesFromHeaders } from '@vercel/otel' +import { getVercelRequestContext } from './vercel/api' +import { getVercelRequestContextAttributes } from './vercel/attributes' + +export function isSampled(traceFlags: number): boolean { + // eslint-disable-next-line no-bitwise + return (traceFlags & TraceFlags.SAMPLED) !== 0 +} + +/** @internal */ +export class CompositeSpanProcessor implements SpanProcessor { + private readonly rootSpanIds = new Map< + string, + { rootSpanId: string; open: Span[] } + >() + private readonly waitSpanEnd = new Map void>() + + constructor( + private processors: SpanProcessor[], + private attributesFromHeaders: AttributesFromHeaders | undefined + ) {} + + forceFlush(): Promise { + return Promise.all( + this.processors.map((p) => + p.forceFlush().catch((e) => { + diag.error('@vercel/otel: forceFlush failed:', e) + }) + ) + ).then(() => undefined) + } + + shutdown(): Promise { + return Promise.all( + this.processors.map((p) => p.shutdown().catch(() => undefined)) + ).then(() => undefined) + } + + onStart(span: Span, parentContext: Context): void { + const { traceId, spanId, traceFlags } = span.spanContext() + const isRoot = !this.rootSpanIds.has(traceId) + if (isRoot) { + this.rootSpanIds.set(traceId, { rootSpanId: spanId, open: [] }) + } else { + this.rootSpanIds.get(traceId)?.open.push(span) + } + if (isRoot && isSampled(traceFlags)) { + const vrc = getVercelRequestContext() + const vercelRequestContextAttrs = getVercelRequestContextAttributes( + vrc, + this.attributesFromHeaders + ) + if (vercelRequestContextAttrs) { + span.setAttributes(vercelRequestContextAttrs) + } + + // Flush the streams to avoid data loss. + if (vrc) { + vrc.waitUntil(async () => { + if (this.rootSpanIds.has(traceId)) { + // Not root has not completed yet, so no point in flushing. + // Need to wait for onEnd. + const promise = new Promise((resolve) => { + this.waitSpanEnd.set(traceId, resolve) + }) + let timer: NodeJS.Timeout | undefined + await Promise.race([ + promise, + new Promise((resolve) => { + timer = setTimeout(() => { + this.waitSpanEnd.delete(traceId) + resolve(undefined) + }, 50) + }), + ]) + if (timer) { + clearTimeout(timer) + } + } + return this.forceFlush() + }) + } + } + + for (const spanProcessor of this.processors) { + spanProcessor.onStart(span, parentContext) + } + } + + onEnd(span: ReadableSpan): void { + const { traceId, spanId, traceFlags } = span.spanContext() + const sampled = isSampled(traceFlags) + const rootObj = this.rootSpanIds.get(traceId) + const isRoot = rootObj?.rootSpanId === spanId + + if (sampled) { + const resourceAttributes = getResourceAttributes(span) + if (resourceAttributes) { + Object.assign(span.attributes, resourceAttributes) + } + } + + if (isRoot) { + this.rootSpanIds.delete(traceId) + if (rootObj.open.length > 0) { + for (const openSpan of rootObj.open) { + if (!openSpan.ended && openSpan.spanContext().spanId !== spanId) { + try { + openSpan.end() + } catch (e) { + diag.error('@vercel/otel: onEnd failed:', e) + } + } + } + } + } else if (rootObj) { + for (let i = 0; i < rootObj.open.length; i++) { + if (rootObj.open[i]?.spanContext().spanId === spanId) { + rootObj.open.splice(i, 1) + } + } + } + + for (const spanProcessor of this.processors) { + spanProcessor.onEnd(span) + } + + if (isRoot) { + const pending = this.waitSpanEnd.get(traceId) + if (pending) { + this.waitSpanEnd.delete(traceId) + pending() + } + } + } +} + +const SPAN_KIND_NAME: { [key in SpanKind]: string } = { + [SpanKind.INTERNAL]: 'internal', + [SpanKind.SERVER]: 'server', + [SpanKind.CLIENT]: 'client', + [SpanKind.PRODUCER]: 'producer', + [SpanKind.CONSUMER]: 'consumer', +} + +function getResourceAttributes(span: ReadableSpan): Attributes | undefined { + const { kind, attributes } = span + const { + 'operation.name': operationName, + 'resource.name': resourceName, + 'span.type': spanTypeAttr, + 'next.span_type': nextSpanType, + 'http.method': httpMethod, + 'http.route': httpRoute, + } = attributes + if (operationName) { + return undefined + } + + const resourceNameResolved = + resourceName ?? + (httpMethod && + typeof httpMethod === 'string' && + httpRoute && + typeof httpRoute === 'string' + ? `${httpMethod} ${httpRoute}` + : httpRoute) + + if ( + span.kind === SpanKind.SERVER && + httpMethod && + httpRoute && + typeof httpMethod === 'string' && + typeof httpRoute === 'string' + ) { + return { + 'operation.name': 'web.request', + 'resource.name': resourceNameResolved, + } + } + + const spanType = nextSpanType ?? spanTypeAttr + if (spanType && typeof spanType === 'string') { + return httpRoute + ? { 'operation.name': spanType, 'resource.name': resourceName } + : { 'operation.name': spanType } + } + + return { + 'operation.name': + kind === SpanKind.INTERNAL ? 'internal' : SPAN_KIND_NAME[kind], + } +} + +function toOperationName(libraryName: string, name: string): string { + if (!libraryName) { + return name + } + let cleanLibraryName = libraryName.replace(/[ @./]/g, '_') + if (cleanLibraryName.startsWith('_')) { + cleanLibraryName = cleanLibraryName.slice(1) + } + return name ? `${cleanLibraryName}.${name}` : cleanLibraryName +} diff --git a/src/instrumentation/vercel/api.ts b/src/instrumentation/vercel/api.ts new file mode 100644 index 000000000..3f59374bb --- /dev/null +++ b/src/instrumentation/vercel/api.ts @@ -0,0 +1,36 @@ +/** + * TODO: Placeholder for the `@vercel/request-context-storage` package. + * Replace with the real package once it's published. + */ + +import type { SpanContext } from '@opentelemetry/api' + +/** @internal */ +export interface VercelRequestContext { + waitUntil: ( + promiseOrFunc: Promise | (() => Promise) + ) => void + headers: Record + url: string + telemetry?: { + reportSpans: (data: unknown) => void + rootSpanContext?: SpanContext + } + [key: symbol]: unknown +} + +interface Reader { + get: () => VercelRequestContext | undefined +} + +const symbol = Symbol.for('@vercel/request-context') + +interface GlobalWithReader { + [symbol]?: Reader +} + +/** @internal */ +export function getVercelRequestContext(): VercelRequestContext | undefined { + const reader = (globalThis as GlobalWithReader)[symbol] + return reader?.get() +} diff --git a/src/instrumentation/vercel/attributes.ts b/src/instrumentation/vercel/attributes.ts new file mode 100644 index 000000000..278346d9f --- /dev/null +++ b/src/instrumentation/vercel/attributes.ts @@ -0,0 +1,81 @@ +import type { Attributes, TextMapGetter } from '@opentelemetry/api' +import type { AttributesFromHeaders } from '@vercel/otel' +import type { VercelRequestContext } from './api' +import { getVercelRequestContext } from './api' +import * as SemanticAttributes from './semantic-attributes' + +/** @internal */ +export function parseRequestId(header: string | undefined): string | undefined { + if (!header) { + return undefined + } + const parts = header.split('::') + return parts.at(-1) +} + +/** @internal */ +export function omitUndefinedAttributes( + obj: T +): T { + return Object.fromEntries( + Object.entries(obj).filter(([_, value]) => value !== undefined) + ) as T +} + +/** @internal */ +export function getVercelRequestContextAttributes( + context: VercelRequestContext | undefined = getVercelRequestContext(), + attributesFromHeaders?: AttributesFromHeaders +): Attributes | undefined { + if (!context) { + return undefined + } + + const rootAttrs = attributesFromHeaders + ? resolveAttributesFromHeaders(attributesFromHeaders, context.headers) + : undefined + + return omitUndefinedAttributes({ + [SemanticAttributes.HTTP_HOST]: context.headers.host, + [SemanticAttributes.HTTP_USER_AGENT]: context.headers['user-agent'], + 'http.referer': context.headers.referer, + + 'vercel.request_id': parseRequestId(context.headers['x-vercel-id']), + 'vercel.matched_path': context.headers['x-matched-path'], + 'vercel.edge_region': process.env.VERCEL_REGION, + + ...rootAttrs, + }) +} + +type VercelRequestContextHeaders = VercelRequestContext['headers'] + +const getter: TextMapGetter = { + keys(_carrier: VercelRequestContextHeaders): string[] { + return [] + }, + get( + carrier: VercelRequestContextHeaders, + key: string + ): string | string[] | undefined { + return carrier[key.toLocaleLowerCase()] + }, +} + +function resolveAttributesFromHeaders( + attributesFromHeaders: AttributesFromHeaders, + headers: VercelRequestContextHeaders +): Attributes | undefined { + if (typeof attributesFromHeaders === 'function') { + return attributesFromHeaders(headers, getter) + } + + const attrs: Attributes = {} + for (const [attrName, headerName] of Object.entries(attributesFromHeaders)) { + const headerValue = headers[headerName.toLocaleLowerCase()] + if (headerValue !== undefined) { + attrs[attrName] = headerValue + } + } + return attrs +} diff --git a/src/instrumentation/vercel/exporter.ts b/src/instrumentation/vercel/exporter.ts new file mode 100644 index 000000000..9f2108530 --- /dev/null +++ b/src/instrumentation/vercel/exporter.ts @@ -0,0 +1,49 @@ +import { diag } from '@opentelemetry/api' +import { ExportResultCode, type ExportResult } from '@opentelemetry/core' +import { JsonTraceSerializer } from '@opentelemetry/otlp-transformer' +import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base' +import { getVercelRequestContext } from './api' + +export class VercelRuntimeSpanExporter implements SpanExporter { + export( + spans: ReadableSpan[], + resultCallback: (result: ExportResult) => void + ): void { + const context = getVercelRequestContext() + if (!context?.telemetry) { + diag.warn('@vercel/otel: no telemetry context found') + resultCallback({ code: ExportResultCode.SUCCESS, error: undefined }) + return + } + + try { + // Converts a Span to IResourceSpans > IScopeSpans > ISpan structure, which + // is OTLP format. It's can be directly serialized to JSON or converted + // to Protobuf. + // { + // // Uses hex-encoding trace and span IDs. Otherwise, base64 is used. + // useHex: true, + // // Uses `{high, low}` format for timestamps. Otherwise, `unixNanon` is used. + // // TODO Fix this + // useLongBits: false, + // } + const data = JsonTraceSerializer.serializeRequest(spans) + + context.telemetry.reportSpans(data) + resultCallback({ code: ExportResultCode.SUCCESS, error: undefined }) + } catch (e) { + resultCallback({ + code: ExportResultCode.FAILED, + error: e instanceof Error ? e : new Error(String(e)), + }) + } + } + + shutdown(): Promise { + return Promise.resolve() + } + + forceFlush?(): Promise { + return Promise.resolve() + } +} diff --git a/src/instrumentation/vercel/semantic-attributes.ts b/src/instrumentation/vercel/semantic-attributes.ts new file mode 100644 index 000000000..1f8970fd9 --- /dev/null +++ b/src/instrumentation/vercel/semantic-attributes.ts @@ -0,0 +1,19 @@ +export const HTTP_METHOD = 'http.method' +export const HTTP_URL = 'http.url' +export const HTTP_HOST = 'http.host' +export const HTTP_SCHEME = 'http.scheme' +export const HTTP_STATUS_CODE = 'http.status_code' +export const HTTP_USER_AGENT = 'http.user_agent' +export const HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = + 'http.response_content_length_uncompressed' +export const NET_PEER_PORT = 'net.peer.port' +export const NET_PEER_NAME = 'net.peer.name' +export const CLOUD_REGION = 'cloud.region' +export const DEPLOYMENT_ENVIRONMENT = 'deployment.environment' +export const CLOUD_PROVIDER = 'cloud.provider' +export const PROCESS_RUNTIME_NAME = 'process.runtime.name' +export const VCS_REPOSITORY_REF_VERSION = 'vcs.repository.ref.revision' +export const FAAS_INVOKED_REGION = 'faas.invoked_region' +export const FAAS_INVOCATION_ID = 'faas.invocation_id' +export const SERVICE_NAME = 'service.name' +export const SERVICE_VERSION = 'service.version' diff --git a/src/lib/clients/action.ts b/src/lib/clients/action.ts index 1636ab7dc..998efd9d9 100644 --- a/src/lib/clients/action.ts +++ b/src/lib/clients/action.ts @@ -5,7 +5,7 @@ import { serializeError } from 'serialize-error' import { z } from 'zod' import { ActionError, flattenClientInputValue } from '../utils/action' import { checkAuthenticated } from '../utils/server' -import { l } from './logger/logger' +import { l } from './logger' import { getTracer } from './tracer' export const actionClient = createSafeActionClient({ diff --git a/src/lib/clients/logger/logger.ts b/src/lib/clients/logger.ts similarity index 83% rename from src/lib/clients/logger/logger.ts rename to src/lib/clients/logger.ts index c37195fa7..652806de0 100644 --- a/src/lib/clients/logger/logger.ts +++ b/src/lib/clients/logger.ts @@ -1,12 +1,4 @@ -/** - * Universal logger that picks the correct implementation for the current runtime - * (Node, Edge, Browser) and exposes an API compatible with `pino`. - * - * In Node & Browser we return the real pino instance. - * In Edge we fall back to the minimal JSON logger implemented in `logger.edge.ts`. - */ - -import pino, { Logger } from 'pino' +import pino, { Logger, LoggerOptions } from 'pino' import { ErrorObject } from 'serialize-error' /** @@ -33,7 +25,7 @@ interface ILoggerContext extends Record, PlatformContextKeys { /** Key to help identify log entry in-code */ key: string - /** Should contain Error */ + /** Should contain serialized Error */ error?: ErrorObject | unknown /** Should contain context around the log */ @@ -76,7 +68,8 @@ const REDACTION_PATHS = [ ] const createLogger = () => { - const baseConfig = { + const baseConfig: LoggerOptions = { + level: 'debug', redact: { paths: REDACTION_PATHS, censor: '[Redacted]', diff --git a/src/lib/clients/logger/logger.node.ts b/src/lib/clients/logger/logger.node.ts deleted file mode 100644 index d9f45b863..000000000 --- a/src/lib/clients/logger/logger.node.ts +++ /dev/null @@ -1,40 +0,0 @@ -import pino from 'pino' - -const REDACTION_PATHS = [ - 'password', - 'confirmPassword', - 'accessToken', - 'secret', - 'token', - 'apiKey', - '*.password', - '*.confirmPassword', - '*.accessToken', - '*.secret', - '*.token', - '*.apiKey', - '*.key', - '*.sandboxIds', - '*.*.password', - '*.*.confirmPassword', - '*.*.accessToken', - '*.*.secret', - '*.*.token', - '*.*.apiKey', - '*.*.key', -] - -const createLogger = () => { - const baseConfig = { - redact: { - paths: REDACTION_PATHS, - censor: '[Redacted]', - }, - } - - return pino(baseConfig) -} - -const logger = createLogger() - -export { logger } diff --git a/src/lib/utils/rewrites.ts b/src/lib/utils/rewrites.ts index 6781c2ee6..e8ff82858 100644 --- a/src/lib/utils/rewrites.ts +++ b/src/lib/utils/rewrites.ts @@ -6,7 +6,7 @@ import { import { RewriteConfig } from '@/types/rewrites.types' import * as cheerio from 'cheerio' import { serializeError } from 'serialize-error' -import { l } from '../clients/logger/logger' +import { l } from '../clients/logger' function getRewriteForPath( path: string, diff --git a/src/lib/utils/server.ts b/src/lib/utils/server.ts index 2db81d9a3..a1333baaa 100644 --- a/src/lib/utils/server.ts +++ b/src/lib/utils/server.ts @@ -11,7 +11,7 @@ import { cookies } from 'next/headers' import { serializeError } from 'serialize-error' import { z } from 'zod' import { infra } from '../clients/api' -import { l } from '../clients/logger/logger' +import { l } from '../clients/logger' import { returnServerError } from './action' /* @@ -21,6 +21,8 @@ import { returnServerError } from './action' * @params request - an optional NextRequest object to create a supabase client for route handlers */ export async function checkAuthenticated() { + l.debug({ key: 'check_authenticated:called' }, 'Checking authentication') + const supabase = await createClient() // retrieve session from storage medium (cookies) @@ -33,16 +35,27 @@ export async function checkAuthenticated() { throw UnauthenticatedError() } - // now retrieve user from supabase to use further - const { - data: { user }, - } = await supabase.auth.getUser() + const { data } = await getUserMemo(supabase) - if (!user) { + if (!data.user) { throw UnauthenticatedError() } - return { user, session, supabase } + return { user: data.user, session, supabase } +} + +export const getUserMemo = async ( + supabase: Awaited> +) => { + if (process.env.NODE_ENV === 'test') { + return await supabase.auth.getUser() + } + + const cache = async (supabase: Awaited>) => { + return await supabase.auth.getUser() + } + + return cache(supabase) } /* diff --git a/src/lib/utils/ui.ts b/src/lib/utils/ui.ts index 3a9f9f7a5..922a26c61 100644 --- a/src/lib/utils/ui.ts +++ b/src/lib/utils/ui.ts @@ -1,8 +1,8 @@ -import { clsx, type ClassValue } from "clsx"; -import { twMerge } from "tailwind-merge"; +import { clsx, type ClassValue } from 'clsx' +import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); + return twMerge(clsx(inputs)) } /** @@ -21,8 +21,8 @@ export function cn(...inputs: ClassValue[]) { export function exponentialSmoothing(speed: number = 6) { return (t: number) => { // Clamp t to [0, 1] range - t = Math.max(0, Math.min(1, t)); + t = Math.max(0, Math.min(1, t)) // Apply the exponential smoothing formula - return 1 - Math.exp(-speed * t); - }; + return 1 - Math.exp(-speed * t) + } } diff --git a/src/middleware.ts b/src/middleware.ts index 169b7bd48..a77b89f33 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -2,7 +2,7 @@ import { createServerClient } from '@supabase/ssr' import { NextResponse, type NextRequest } from 'next/server' import { serializeError } from 'serialize-error' import { ALLOW_SEO_INDEXING } from './configs/flags' -import { l } from './lib/clients/logger/logger' +import { l } from './lib/clients/logger' import { getRewriteForPath } from './lib/utils/rewrites' import { getAuthRedirect, diff --git a/src/server/auth/auth-actions.ts b/src/server/auth/auth-actions.ts index c5d1b0725..be627d6d0 100644 --- a/src/server/auth/auth-actions.ts +++ b/src/server/auth/auth-actions.ts @@ -3,7 +3,7 @@ import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls' import { USER_MESSAGES } from '@/configs/user-messages' import { actionClient } from '@/lib/clients/action' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { createClient } from '@/lib/clients/supabase/server' import { relativeUrlSchema } from '@/lib/schemas/url' import { returnServerError } from '@/lib/utils/action' diff --git a/src/server/auth/get-default-team.ts b/src/server/auth/get-default-team.ts index b7bf51b9b..ffa28bec2 100644 --- a/src/server/auth/get-default-team.ts +++ b/src/server/auth/get-default-team.ts @@ -1,6 +1,6 @@ import 'server-cli-only' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { supabaseAdmin } from '@/lib/clients/supabase/admin' import { serializeError } from 'serialize-error' diff --git a/src/server/auth/validate-email.ts b/src/server/auth/validate-email.ts index 637a6d169..402c6d8e6 100644 --- a/src/server/auth/validate-email.ts +++ b/src/server/auth/validate-email.ts @@ -1,5 +1,5 @@ import { KV_KEYS } from '@/configs/keys' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { kv } from '@vercel/kv' import { serializeError } from 'serialize-error' diff --git a/src/server/keys/get-api-keys.ts b/src/server/keys/get-api-keys.ts index 76e6e5729..c93a203a1 100644 --- a/src/server/keys/get-api-keys.ts +++ b/src/server/keys/get-api-keys.ts @@ -3,7 +3,7 @@ import 'server-only' import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError } from '@/lib/utils/action' import { z } from 'zod' diff --git a/src/server/keys/key-actions.ts b/src/server/keys/key-actions.ts index 41f36e2f5..6c1251b47 100644 --- a/src/server/keys/key-actions.ts +++ b/src/server/keys/key-actions.ts @@ -3,7 +3,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { returnServerError } from '@/lib/utils/action' import { revalidatePath } from 'next/cache' import { z } from 'zod' diff --git a/src/server/middleware.ts b/src/server/middleware.ts index b8a17543f..3a0072753 100644 --- a/src/server/middleware.ts +++ b/src/server/middleware.ts @@ -2,7 +2,11 @@ import { COOKIE_KEYS, KV_KEYS } from '@/configs/keys' import { AUTH_URLS, PROTECTED_URLS } from '@/configs/urls' import { kv } from '@/lib/clients/kv' import { supabaseAdmin } from '@/lib/clients/supabase/admin' -import { checkUserTeamAuthorization, resolveTeamId } from '@/lib/utils/server' +import { + checkUserTeamAuthorization, + getUserMemo, + resolveTeamId, +} from '@/lib/utils/server' import { createServerClient } from '@supabase/ssr' import { NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -172,7 +176,7 @@ export function buildRedirectUrl(path: string, request: NextRequest): URL { export async function getUserSession( supabase: ReturnType ) { - return await supabase.auth.getUser() + return await getUserMemo(supabase) } export function getAuthRedirect( diff --git a/src/server/sandboxes/get-sandbox-details.ts b/src/server/sandboxes/get-sandbox-details.ts index 4699116c0..4ae79d70c 100644 --- a/src/server/sandboxes/get-sandbox-details.ts +++ b/src/server/sandboxes/get-sandbox-details.ts @@ -1,7 +1,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError, returnServerError } from '@/lib/utils/action' import { z } from 'zod' diff --git a/src/server/sandboxes/get-sandbox-root.ts b/src/server/sandboxes/get-sandbox-root.ts index 601532ee1..de9983a6b 100644 --- a/src/server/sandboxes/get-sandbox-root.ts +++ b/src/server/sandboxes/get-sandbox-root.ts @@ -1,6 +1,6 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { returnServerError } from '@/lib/utils/action' import Sandbox, { NotFoundError } from 'e2b' import { z } from 'zod' diff --git a/src/server/sandboxes/get-team-sandboxes-metrics.ts b/src/server/sandboxes/get-team-sandboxes-metrics.ts index 3905ccacd..55560f808 100644 --- a/src/server/sandboxes/get-team-sandboxes-metrics.ts +++ b/src/server/sandboxes/get-team-sandboxes-metrics.ts @@ -1,7 +1,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError } from '@/lib/utils/action' import { transformMetricsToClientMetrics } from '@/lib/utils/sandboxes' import { ClientSandboxesMetrics } from '@/types/sandboxes.types' diff --git a/src/server/sandboxes/get-team-sandboxes.ts b/src/server/sandboxes/get-team-sandboxes.ts index 811ed7274..cb6bf8ffe 100644 --- a/src/server/sandboxes/get-team-sandboxes.ts +++ b/src/server/sandboxes/get-team-sandboxes.ts @@ -4,7 +4,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { MOCK_SANDBOXES_DATA } from '@/configs/mock-data' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError } from '@/lib/utils/action' import { Sandbox } from '@/types/api' import { z } from 'zod' diff --git a/src/server/team/get-team.ts b/src/server/team/get-team.ts index e36bd12df..5f49b60b4 100644 --- a/src/server/team/get-team.ts +++ b/src/server/team/get-team.ts @@ -1,7 +1,7 @@ import 'server-only' import { authActionClient } from '@/lib/clients/action' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { supabaseAdmin } from '@/lib/clients/supabase/admin' import { returnServerError } from '@/lib/utils/action' import { ClientTeam } from '@/types/dashboard.types' diff --git a/src/server/team/team-actions.ts b/src/server/team/team-actions.ts index 3459c9687..ab11727c5 100644 --- a/src/server/team/team-actions.ts +++ b/src/server/team/team-actions.ts @@ -3,7 +3,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { KV_KEYS } from '@/configs/keys' import { authActionClient } from '@/lib/clients/action' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { deleteFile, getFiles, uploadFile } from '@/lib/clients/storage' import { supabaseAdmin } from '@/lib/clients/supabase/admin' import { returnServerError } from '@/lib/utils/action' diff --git a/src/server/templates/get-team-templates.ts b/src/server/templates/get-team-templates.ts index 06692ebb4..e4c3ddb53 100644 --- a/src/server/templates/get-team-templates.ts +++ b/src/server/templates/get-team-templates.ts @@ -7,7 +7,7 @@ import { } from '@/configs/mock-data' import { actionClient, authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { supabaseAdmin } from '@/lib/clients/supabase/admin' import { handleDefaultInfraError } from '@/lib/utils/action' import { DefaultTemplate } from '@/types/api' diff --git a/src/server/templates/templates-actions.ts b/src/server/templates/templates-actions.ts index 29d312c78..7a8ffa2d2 100644 --- a/src/server/templates/templates-actions.ts +++ b/src/server/templates/templates-actions.ts @@ -3,7 +3,7 @@ import { SUPABASE_AUTH_HEADERS } from '@/configs/api' import { authActionClient } from '@/lib/clients/action' import { infra } from '@/lib/clients/api' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { handleDefaultInfraError, returnServerError } from '@/lib/utils/action' import { revalidatePath } from 'next/cache' import { z } from 'zod' diff --git a/src/ui/error.tsx b/src/ui/error.tsx index 029e7ebf1..f5cb01429 100644 --- a/src/ui/error.tsx +++ b/src/ui/error.tsx @@ -1,6 +1,6 @@ 'use client' -import { l } from '@/lib/clients/logger/logger' +import { l } from '@/lib/clients/logger' import { cn } from '@/lib/utils' import { useEffect } from 'react' import { ErrorBoundary as ReactErrorBoundary } from 'react-error-boundary'