Skip to content

setAutoCollectDependencies not working after upgrading from v2 to v3 #1422

@qb-raj-lvmh

Description

@qb-raj-lvmh

Hi,

I'm working on migrating existing functions from Azure Function v3 to v4 along with node,js version upgrade. As part of this process, I've upgraded the package applicationinsights library from version "2.9" to "3.5". But after the upgrade, it seems the existing setAutoCollectDependencies false property doesn't work and it is creating hude logs for dependency logs.

`
import * as appInsights from 'applicationinsights';

		export class AppInsights implements ILoggerService {
			private readonly client: appInsights.TelemetryClient;
			constructor() {
			this.client = appInsights.defaultClient;
					appInsights
						.setup()
						.setAutoCollectDependencies(false) // seems not working.
						.setAutoCollectPerformance(false, false)
						.start();
					this.client = appInsights.defaultClient;

}

// Track Events
/**
 *
 * @param trackEvent
 */
TrackEvent(trackEvent: IEventLog): void {
	this.client.trackEvent(trackEvent);
}

// Track Metric
/**
 *
 * @param trackMetric
 */

TrackMetric(trackMetric: IMetricLog): void {
	this.client.trackMetric(trackMetric);
}

// Track Trace
/**
 *
 * @param trackMessage
 */
TrackTrace(trackMessage: ITraceLog): void {
	this.client.trackTrace(trackMessage);
}

// Track Exception
/**
 *
 * @param trackException
 */
TrackException(trackException: IExceptionLog): void {
	this.client.trackException(trackException);
}

// Track Dependency
/**
 *
 * @param trackDependency
 */
TrackDependency(trackDependency: IDependencyLog): void {
	this.client.trackDependency(trackDependency);
}

// Track Request
/**
 *
 * @param trackRequest
 */
TrackRequest(trackRequest: appInsights.Contracts.RequestTelemetry): void {
	this.client.trackRequest(trackRequest);
}

}
`
My host.json is as follows

{ "version": "2.0", "logging": { "applicationInsights": { "samplingSettings": { "isEnabled": true, "excludedTypes": "Request;Dependency" // added Dependency here not working }, "enableDependencyTracking": false, "enablePerformanceCountersCollection": false }, // tried with adding below key and not working "logLevel": { "default": "Warning", "Function": "Warning", "Host.Aggregator": "Error", "Azure.Core": "None", "azure-data-tables": "None" } }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[4.*, 5.0.0)" }, "extensions": { "serviceBus": { "maxConcurrentCalls": 2, "maxAutoLockRenewalDuration": "00:10:00" } }, "functionTimeout": "00:10:00" }

Do I need to update this as a part of version upgrade to avoid the dependency logs?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions