Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with setAutoCollectRequests(). Requests are not being sent to application insights #1349

Open
nandeeswar-elanco opened this issue Jun 18, 2024 · 1 comment

Comments

@nandeeswar-elanco
Copy link

nandeeswar-elanco commented Jun 18, 2024

Requests are not being automatically logged in application insights, only custom telemetry is being logged
applicationinsights version 3.1.0

I see a few warnings in the terminal on application start

@azure/opentelemetry-instrumentation-azure-sdk [
'Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'
]
@opentelemetry/instrumentation-winston [
'Module winston has been loaded before @opentelemetry/instrumentation-winston so it might not work, please initialize it before requiring winston'
]
@opentelemetry/instrumentation-winston [
'Module winston has been loaded before @opentelemetry/instrumentation-winston so it might not work, please initialize it before requiring winston'
]
Accessing resource attributes before async attributes settled []

I am not sure if these warnings are an issue

code setup:
app.ts

import express = require('express');
import { useExpressServer } from 'routing-controllers';
import { HealthCheckMiddleware } from './middlewares/health-check-middleware';
import { appInsightsLoader } from './applicationInsights/app-insights-loader';
import { UserController } from './controllers/user-controller';

/**

  • Application Insights
    */
    appInsightsLoader();

/**

  • Application Setup
    */
    const expressInstance = express();
    const app = useExpressServer(expressInstance, {
    cors: true,
    middlewares: [HealthCheckMiddleware],
    controllers: [UserController],
    });

export { app };

app-insights-loader.ts

import appInsights = require('applicationinsights');
import { env } from '../env';

const appInsightsLoader = (): void => {
if (env.APPLICATIONINSIGHTS_ENABLED) {
appInsights
.setup(env.APPLICATIONINSIGHTS_CONNECTION_STRING)
.setAutoCollectRequests(true)
.setAutoCollectExceptions(true)
.setAutoCollectDependencies(false)
.setAutoCollectConsole(true)
.setSendLiveMetrics(false)
.start();
}
};

export { appInsightsLoader };

@JacksonWeber
Copy link
Contributor

@nandeeswar-elanco The winston-instrumentation warnings are not expected. Please make sure to initialize the Application Insights SDK before importing the winston module.

Regarding requests specifically, do you have an example of a code snippet you're expecting to generate request telemetry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants