Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
NodeSDK,
ATTR_SERVICE_NAME,
resourceFromAttributes,
} from "@mastra/core/telemetry/otel-vendor";
//import {
// NodeSDK,
// ATTR_SERVICE_NAME,
// resourceFromAttributes,
//} from "@mastra/core/telemetry/otel-vendor";
Comment on lines +1 to +5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This import block is commented out. If it's no longer needed as part of the OpenTelemetry refactoring, it should be removed to keep the code clean and improve maintainability.

import type { Context, TextMapGetter} from "@opentelemetry/api";
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Context' is defined but never used.

Suggested change
import type { Context, TextMapGetter} from "@opentelemetry/api";
import type { TextMapGetter } from "@opentelemetry/api";

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'TextMapGetter' is defined but never used.

Suggested change
import type { Context, TextMapGetter} from "@opentelemetry/api";
import type { Context } from "@opentelemetry/api";

Copilot uses AI. Check for mistakes.
import { ROOT_CONTEXT, context } from "@opentelemetry/api";
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'ROOT_CONTEXT' is defined but never used.

Suggested change
import { ROOT_CONTEXT, context } from "@opentelemetry/api";
import { context } from "@opentelemetry/api";

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'context' is defined but never used.

Suggested change
import { ROOT_CONTEXT, context } from "@opentelemetry/api";
import { ROOT_CONTEXT } from "@opentelemetry/api";

Copilot uses AI. Check for mistakes.
import { LangfuseExporter } from "langfuse-vercel";
Expand All @@ -14,33 +14,33 @@ export function register() {
baseUrl: process.env.LANGFUSE_BASE_URL,
});

const sdk = new NodeSDK({
autoDetectResources: true,
resource: resourceFromAttributes({
[ATTR_SERVICE_NAME]: "ai",
}),
traceExporter: exporter,
//const sdk = new NodeSDK({
// autoDetectResources: true,
// resource: resourceFromAttributes({
// [ATTR_SERVICE_NAME]: "ai",
// }),
// traceExporter: exporter,
// instrumentations: [InstrumentClass],
metricReader: undefined,
contextManager: {
active: () => ROOT_CONTEXT,
disable() { return this; },
enable() { return this; },
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(_context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F> {
return fn.apply(thisArg, args);
},
bind<T>(_context: Context, target: T): T {
return target;
},
},
textMapPropagator: {
inject: () => {},
extract: (context: Context, _carrier: any, _getter: TextMapGetter<any>): Context => {
return context;
},
fields: () => [],
},
});
// metricReader: undefined,
// contextManager: {
// active: () => ROOT_CONTEXT,
// disable() { return this; },
//enable() { return this; },
// with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(_context: Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F> {
// return fn.apply(thisArg, args);
// },
// bind<T>(_context: Context, target: T): T {
// return target;
// },
//},
//textMapPropagator: {
// inject: () => {},
// extract: (context: Context, _carrier: any, _getter: TextMapGetter<any>): Context => {
// return context;
// },
// fields: () => [],
//},
//});
Comment on lines +17 to +43
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire OpenTelemetry SDK initialization has been commented out, which means tracing will not work at all. If this is intentional for debugging purposes, it should be controlled via an environment variable rather than being commented out in the code. If tracing is being replaced with a different solution, that should be documented in the PR description.

Copilot uses AI. Check for mistakes.

sdk.start();
// sdk.start();
Comment on lines +17 to +45
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This large block of code for NodeSDK initialization is commented out. Dead code like this should be removed to improve readability and maintainability, as it can be confusing for future developers.

}
12 changes: 6 additions & 6 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const nextConfig: NextConfig = {
// cssChunking: true,
// craCompat: true,
// validateRSCRequestHeaders: true,
webpackMemoryOptimizations: true,
webpackBuildWorker: true,
// webpackMemoryOptimizations: true,
//7 webpackBuildWorker: true,
Comment on lines +51 to +52
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These webpack configuration options are commented out. They should be removed if they are no longer necessary to avoid clutter in the configuration file.

Comment on lines +51 to +52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor typo in comment.

Line 52 has a malformed comment //7 instead of //.

  //   webpackMemoryOptimizations: true,
- //7   webpackBuildWorker: true,
+ //   webpackBuildWorker: true,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// webpackMemoryOptimizations: true,
//7 webpackBuildWorker: true,
// webpackMemoryOptimizations: true,
// webpackBuildWorker: true,
🤖 Prompt for AI Agents
In next.config.ts around lines 51 to 52, there's a malformed comment marker
"//7" on line 52; change "//7   webpackBuildWorker: true," to use a proper
comment marker "//   webpackBuildWorker: true," so the comment is well-formed
and consistent with the surrounding comments.

Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the comment: '//7' should be '//' without the '7'.

Suggested change
//7 webpackBuildWorker: true,
// webpackBuildWorker: true,

Copilot uses AI. Check for mistakes.
// turbopackTreeShaking: true,
// turbopackMinify: true,
// turbopackImportTypeBytes: true,
Expand All @@ -65,10 +65,10 @@ const nextConfig: NextConfig = {
ppr: false,
},
};
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
module.exports = withBundleAnalyzer({})
//const withBundleAnalyzer = require('@next/bundle-analyzer')({
// enabled: process.env.ANALYZE === 'true',
//})
//module.exports = withBundleAnalyzer({})
Comment on lines +68 to +71
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The withBundleAnalyzer configuration is commented out. This should be removed to avoid cluttering the configuration file with dead code.

Comment on lines +68 to +71
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out dead code.

Per coding guidelines, avoid commenting out dead code. Use version control to preserve history instead. If the bundle analyzer is no longer needed, remove these lines entirely.

-//const withBundleAnalyzer = require('@next/bundle-analyzer')({
-//  enabled: process.env.ANALYZE === 'true',
-//})
-//module.exports = withBundleAnalyzer({})
-
 const withMDX = createMDX({
🤖 Prompt for AI Agents
In next.config.ts around lines 68 to 71, remove the commented-out bundle
analyzer block (the three lines that require and invoke @next/bundle-analyzer)
because dead code should not be left commented; simply delete these commented
lines so the file contains only active code, relying on VCS history if the
analyzer is needed later.


const withMDX = createMDX({
extension: /\.mdx?$/,
Expand Down
Loading
Loading