-
Couldn't load subscription status.
- Fork 942
Open
Labels
Description
What happened?
Steps to Reproduce
In a nextjs application, when we install @azure/monitor-opentelemetry and use the useAzureMonitor. Every telemetry is tracked twice
Expected Result
Single request and list of unique telemetry Events
Actual Result
- Request get tracked twice, (even in azure webapp)
- Each event inside the request telemetry is tracked twice (even in azure webapp)
OpenTelemetry Setup Code
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
console.log("Initializing Azure Application Insights for server-side telemetry...");
const connectionString = "<con string"
if (!connectionString) {
if (process.env.NODE_ENV === 'development') {
console.warn('⚠ Azure Monitor connection string not configured');
}
return;
}
const { useAzureMonitor } = await import('@azure/monitor-opentelemetry');
// eslint-disable-next-line react-hooks/rules-of-hooks
useAzureMonitor({
azureMonitorExporterOptions: {
connectionString,
}
});
}
}package.json
"dependencies": {
"@azure/monitor-opentelemetry": "^1.14.0",
"next": "^15.5.6",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^18.3.26",
"@types/react-dom": "^18.3.7",
"eslint": "^9",
"eslint-config-next": "16.0.0",
"tailwindcss": "^4",
"typescript": "^5"
}