Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@ private TelemetryConfiguration SetupTelemetryConfiguration()

if (!instrumentationKeyProvided && !connectionStringProvided)
{
this.endToEndTraceHelper.ExtensionWarningEvent(
this.endToEndTraceHelper.ExtensionInformationalEvent(
hubName: this.options.HubName,
functionName: string.Empty,
instanceId: string.Empty,
message: "'APPINSIGHTS_INSTRUMENTATIONKEY' or 'APPLICATIONINSIGHTS_CONNECTION_STRING' were not defined in the current environment variables, but distributed tracing is enabled. Please specify one. We recommend specifying 'APPLICATIONINSIGHTS_CONNECTION_STRING'.");
message: "'APPINSIGHTS_INSTRUMENTATIONKEY' or 'APPLICATIONINSIGHTS_CONNECTION_STRING' were not defined in the current environment variables, but distributed tracing is enabled. Please specify one. We recommend specifying 'APPLICATIONINSIGHTS_CONNECTION_STRING'.",
writeToUserLogs: true);
}

if (instrumentationKeyProvided)
Expand Down
18 changes: 9 additions & 9 deletions test/FunctionsV2/CorrelationEndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ public void TelemetryActivator_DTV2_Announcement(bool enabled, DurableDistribute
}

/*
* End to end test that checks if a warning is logged when distributed tracing is
* End to end test that checks if an information message is logged when distributed tracing is
* enabled, but APPINSIGHTS_INSTRUMENTATIONKEY isn't set. The test also checks
* that the warning isn't logged when the environment variable is set.
* that the information message isn't logged when the environment variable is set.
*/
[Theory]
[Trait("Category", PlatformSpecificHelpers.TestCategory)]
Expand All @@ -274,7 +274,7 @@ public void TelemetryActivator_DTV2_Announcement(bool enabled, DurableDistribute
[InlineData(false, true, true)]
[InlineData(true, true, false)]
[InlineData(true, true, true)]
public void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
public void TelemetryClientSetup_AppInsights_Messages(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
{
TraceOptions traceOptions = new TraceOptions()
{
Expand Down Expand Up @@ -315,8 +315,8 @@ public void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsS
string bothSettingsSetWarningMessage = "Both 'APPINSIGHTS_INSTRUMENTATIONKEY' and 'APPLICATIONINSIGHTS_CONNECTION_STRING' are defined in the current environment variables. Please specify one. We recommend specifying 'APPLICATIONINSIGHTS_CONNECTION_STRING'.";
var bothSettingsSetWarningLogMessage = this.loggerProvider.GetAllLogMessages().Where(l => l.FormattedMessage.StartsWith(bothSettingsSetWarningMessage));

string neitherSettingsSetWarningMessage = "'APPINSIGHTS_INSTRUMENTATIONKEY' or 'APPLICATIONINSIGHTS_CONNECTION_STRING' were not defined in the current environment variables, but distributed tracing is enabled. Please specify one. We recommend specifying 'APPLICATIONINSIGHTS_CONNECTION_STRING'.";
var neitherSettingsSetWarningLogMessage = this.loggerProvider.GetAllLogMessages().Where(l => l.FormattedMessage.StartsWith(neitherSettingsSetWarningMessage));
string neitherSettingsSetMessage = "'APPINSIGHTS_INSTRUMENTATIONKEY' or 'APPLICATIONINSIGHTS_CONNECTION_STRING' were not defined in the current environment variables, but distributed tracing is enabled. Please specify one. We recommend specifying 'APPLICATIONINSIGHTS_CONNECTION_STRING'.";
var neitherSettingsSetLogMessage = this.loggerProvider.GetAllLogMessages().Where(l => l.FormattedMessage.StartsWith(neitherSettingsSetMessage));

string settingUpTelemetryClientMessage = "Setting up the telemetry client...";
var settingUpTelemetryClientLogMessage = this.loggerProvider.GetAllLogMessages().Where(l => l.FormattedMessage.StartsWith(settingUpTelemetryClientMessage));
Expand All @@ -330,31 +330,31 @@ public void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsS
if (instrumentationKeyIsSet && connStringIsSet)
{
Assert.Single(bothSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetLogMessage);
Assert.Single(settingUpTelemetryClientLogMessage);
Assert.Single(readingInstrumentationKeyLogMessage);
Assert.Single(readingConnStringLogMessage);
}
else if (instrumentationKeyIsSet && !connStringIsSet)
{
Assert.Empty(bothSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetLogMessage);
Assert.Single(settingUpTelemetryClientLogMessage);
Assert.Single(readingInstrumentationKeyLogMessage);
Assert.Empty(readingConnStringLogMessage);
}
else if (!instrumentationKeyIsSet && connStringIsSet)
{
Assert.Empty(bothSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetWarningLogMessage);
Assert.Empty(neitherSettingsSetLogMessage);
Assert.Single(settingUpTelemetryClientLogMessage);
Assert.Empty(readingInstrumentationKeyLogMessage);
Assert.Single(readingConnStringLogMessage);
}
else
{
Assert.Empty(bothSettingsSetWarningLogMessage);
Assert.Single(neitherSettingsSetWarningLogMessage);
Assert.Single(neitherSettingsSetLogMessage);
Assert.Single(settingUpTelemetryClientLogMessage);
Assert.Empty(readingInstrumentationKeyLogMessage);
Assert.Empty(readingConnStringLogMessage);
Expand Down