[AppInsights] Moving to separate package

This commit is contained in:
Brett Samblanet 2017-05-02 12:29:07 -07:00
Родитель af4a7cfede
Коммит 2550ad67c5
35 изменённых файлов: 512 добавлений и 91 удалений

Просмотреть файл

@ -36,6 +36,10 @@
<PublishType>Assembly</PublishType>
<PublishPath>$(PublishPath)\Binaries</PublishPath>
</Build>
<Build Include="src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj">
<PublishType>Assembly</PublishType>
<PublishPath>$(PublishPath)\Binaries</PublishPath>
</Build>
<Build Include="src\Dashboard\Dashboard.csproj">
<PublishType>Assembly</PublishType>
<PublishPath>$(PublishPath)\Binaries</PublishPath>
@ -65,6 +69,10 @@
<PublishType>File</PublishType>
<PublishPath>$(PublishPath)\Packages</PublishPath>
</Build>
<Build Include="src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.NuGet\WebJobs.Logging.ApplicationInsights.nuproj">
<PublishType>File</PublishType>
<PublishPath>$(PublishPath)\Packages</PublishPath>
</Build>
</ItemGroup>
<UsingTask TaskName="SkipStrongNames.CheckSkipStrongNamesStatus" AssemblyFile="$(SkipStrongNamesExe)" />

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{639967B0-0544-4C52-94AC-9A3D25E33256}"
EndProject
@ -56,6 +56,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{72A798
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleHost", "sample\SampleHost\SampleHost.csproj", "{93429246-CCE9-4EB0-B94D-68522862BA79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebJobs.Logging.ApplicationInsights", "src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj", "{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -130,6 +132,10 @@ Global
{93429246-CCE9-4EB0-B94D-68522862BA79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93429246-CCE9-4EB0-B94D-68522862BA79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93429246-CCE9-4EB0-B94D-68522862BA79}.Release|Any CPU.Build.0 = Release|Any CPU
{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -21,6 +21,10 @@
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -159,6 +159,10 @@
<Project>{0e095cb2-3030-49ff-966c-785f1a55f0c1}</Project>
<Name>WebJobs.Host</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj">
<Project>{d3ff0fde-ebdf-4751-8131-3375cf2a5c21}</Project>
<Name>WebJobs.Logging.ApplicationInsights</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Microsoft.Azure.WebJobs\WebJobs.csproj">
<Project>{e3f2b2c8-6b8d-4d6a-a3ae-98366c9f3b49}</Project>
<Name>WebJobs</Name>

Просмотреть файл

@ -69,13 +69,4 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.JobHostQueuesConfiguration.#MaxPollingIntervalInt")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.JobHostQueuesConfiguration.#MaxPollingIntervalInt")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "AddBindingRule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Config.ExtensionConfigContext.#AddBindingRule`1()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.AppInsightsLoggerExtensions.#AddAppInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.AppInsightsLoggerExtensions.#AddAppInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.AppInsightsLoggerExtensions.#AddAppInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.FunctionResultAggregatorFactory.#Create(System.Int32,System.TimeSpan,Microsoft.Extensions.Logging.ILoggerFactory)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,Microsoft.Azure.WebJobs.Host.Loggers.ITelemetryClientFactory,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#InitializeConfiguration()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_perfModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_quickPulseModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.FunctionResultAggregatorFactory.#Create(System.Int32,System.TimeSpan,Microsoft.Extensions.Logging.ILoggerFactory)")]

Просмотреть файл

@ -26,7 +26,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
[LoggingKeys.Name] = Name,
[LoggingKeys.Count] = Count,
[LoggingKeys.Timestamp] = Timestamp,
[LoggingKeys.AvgDuration] = AverageDuration,
[LoggingKeys.AverageDuration] = AverageDuration,
[LoggingKeys.MaxDuration] = MaxDuration,
[LoggingKeys.MinDuration] = MinDuration,
[LoggingKeys.Successes] = Successes,

Просмотреть файл

@ -1,32 +1,101 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
{
internal static class LoggingKeys
/// <summary>
/// Keys used by the <see cref="ILogger"/> infrastructure.
/// </summary>
public static class LoggingKeys
{
// These are publicly visible as property names or prefixes
/// <summary>
/// </summary>
public const string FullName = "FullName";
/// <summary>
/// </summary>
public const string Name = "Name";
/// <summary>
/// </summary>
public const string Count = "Count";
/// <summary>
/// </summary>
public const string Successes = "Successes";
/// <summary>
/// </summary>
public const string Failures = "Failures";
/// <summary>
/// </summary>
public const string SuccessRate = "SuccessRate";
public const string AvgDuration = "AvgDurationMs";
/// <summary>
/// </summary>
public const string AverageDuration = "AvgDurationMs";
/// <summary>
/// </summary>
public const string MaxDuration = "MaxDurationMs";
/// <summary>
/// </summary>
public const string MinDuration = "MinDurationMs";
/// <summary>
/// </summary>
public const string Timestamp = "Timestamp";
/// <summary>
/// </summary>
public const string InvocationId = "InvocationId";
/// <summary>
/// </summary>
public const string TriggerReason = "TriggerReason";
/// <summary>
/// </summary>
public const string StartTime = "StartTime";
/// <summary>
/// </summary>
public const string EndTime = "EndTime";
/// <summary>
/// </summary>
public const string Duration = "Duration";
/// <summary>
/// </summary>
public const string Succeeded = "Succeeded";
/// <summary>
/// </summary>
public const string FormattedMessage = "FormattedMessage";
/// <summary>
/// </summary>
public const string CategoryName = "Category";
/// <summary>
/// </summary>
public const string HttpMethod = "HttpMethod";
/// <summary>
/// </summary>
public const string CustomPropertyPrefix = "prop__";
/// <summary>
/// </summary>
public const string ParameterPrefix = "param__";
/// <summary>
/// </summary>
public const string OriginalFormat = "{OriginalFormat}";
}
}

Просмотреть файл

@ -3,19 +3,19 @@
namespace Microsoft.Azure.WebJobs.Host.Loggers
{
internal static class ScopeKeys
/// <summary>
/// A collection of constants used for logging scope keys.
/// </summary>
public static class ScopeKeys
{
// These are used internally for passing values via scopes
/// <summary>
/// A key identifying the function invocation id.
/// </summary>
public const string FunctionInvocationId = "MS_FunctionInvocationId";
/// <summary>
/// A key identifying the function name.
/// </summary>
public const string FunctionName = "MS_FunctionName";
public const string HttpRequest = "MS_HttpRequest";
// HTTP context is set automatically by ASP.NET, this isn't ours.
internal const string HttpContext = "MS_HttpContext";
// This is set by Functions
internal const string FunctionsHttpResponse = "MS_AzureFunctionsHttpResponse";
internal const string ForwardedForHeaderName = "X-Forwarded-For";
}
}

Просмотреть файл

@ -54,30 +54,6 @@
<AssemblyOriginatorKeyFile>..\Common\PublicKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AI.Agent.Intercept, Version=2.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.7\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AI.DependencyCollector, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.3.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AI.PerfCounterCollector, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.3.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AI.ServerTelemetryChannel, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.3.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AI.WindowsServer, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.WindowsServer.2.3.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.ApplicationInsights, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.2.3.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
<Private>True</Private>
@ -190,7 +166,6 @@
<HintPath>..\..\packages\Microsoft.Tpl.Dataflow.4.5.24\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
@ -517,7 +492,6 @@
<Compile Include="Executors\FunctionInstanceTraceWriter.cs" />
<Compile Include="Extensions\IJobHostMetadataProvider.cs" />
<Compile Include="Extensions\JobHostMetadataProvider.cs" />
<Compile Include="Extensions\DictionaryExtensions.cs" />
<Compile Include="FuncConverter.cs" />
<Compile Include="FunctionTimeoutException.cs" />
<Compile Include="Exceptions\RecoverableException.cs" />
@ -528,15 +502,7 @@
<Compile Include="Loggers\Logger\Aggregator\FunctionResultAggregator.cs" />
<Compile Include="Loggers\Logger\Aggregator\FunctionResultAggregatorFactory.cs" />
<Compile Include="Loggers\Logger\Aggregator\IFunctionResultAggregatorFactory.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\ApplicationInsightsLogger.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\ApplicationInsightsLoggerExtensions.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\ApplicationInsightsLoggerProvider.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\ApplicationInsightsScope.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\ITelemetryClientFactory.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\DefaultTelemetryClientFactory.cs" />
<Compile Include="Loggers\Logger\ApplicationInsights\WebJobsTelemetryInitializer.cs" />
<Compile Include="Loggers\Logger\Constants\LogCategories.cs" />
<Compile Include="Loggers\Logger\Constants\LoggingConstants.cs" />
<Compile Include="Loggers\Logger\Constants\LoggingKeys.cs" />
<Compile Include="Loggers\Logger\Constants\ScopeKeys.cs" />
<Compile Include="Loggers\Logger\LoggerExtensions.cs" />

Просмотреть файл

@ -6,7 +6,5 @@ namespace Microsoft.Azure.WebJobs.Host
internal static class WebSitesKnownKeyNames
{
public const string JobDataPath = "WEBJOBS_DATA_PATH";
public const string WebSiteInstanceIdKey = "WEBSITE_INSTANCE_ID";
}
}

Просмотреть файл

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.7" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net45" />
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net45" />

Просмотреть файл

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), WebJobs.sln))\tools\NuGetProj.settings.targets"/>
<PropertyGroup>
<NuSpecFile>$(MSBuildProjectName).nuspec</NuSpecFile>
<NuGetPackageId>Microsoft.Azure.WebJobs.Logging.ApplicationInsights</NuGetPackageId>
<NuGetPackageVersion>$(WebJobsPackageVersion)</NuGetPackageVersion>
<NuGetPackSymbols>false</NuGetPackSymbols>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj">
<Project>{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}</Project>
<Name>WebJobs.Logging.ApplicationInsights</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<NuGetContent Include="$(WebJobsRootPath)\src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\bin\$(Configuration)\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.dll">
<Destination>lib\net45\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.dll</Destination>
</NuGetContent>
<NuGetContent Include="$(WebJobsRootPath)\src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\bin\$(Configuration)\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.xml">
<Destination>lib\net45\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.xml</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(WebJobsToolsPath)NuGetProj.targets"/>
<Target Name="BeforeBuild">
<PropertyGroup>
<!-- Define properties you want to use inside your nuspec file. -->
<NuSpecProperties>NuGetPackageId=$(NuGetPackageId);NuGetPackageVersion=$(NuGetPackageVersion);PackageEULA=$(WebJobsPackageEULA);WebJobsPackageVersion=$(WebJobsPackageVersion)</NuSpecProperties>
</PropertyGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>$NuGetPackageId$</id>
<title>Microsoft.Azure.WebJobs.Logging.ApplicationInsights</title>
<version>$NuGetPackageVersion$</version>
<authors>Microsoft</authors>
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
<summary>Microsoft.Azure.WebJobs.Logging.ApplicationInsights is a library for writing WebJobs logs with ILogger and Application Insights.</summary>
<description>This package contains the runtime assemblies for Microsoft.Azure.WebJobs.Logging.ApplicationInsights. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=320971</description>
<language>en-US</language>
<projectUrl>http://go.microsoft.com/fwlink/?LinkID=320972</projectUrl>
<licenseUrl>$PackageEULA$</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Microsoft Azure WebJobs Jobs Logging Application Insights windowsazureofficial Web</tags>
<dependencies>
<dependency id="Microsoft.Azure.WebJobs" version="[$WebJobsPackageVersion$]" />
<dependency id="Microsoft.ApplicationInsights.WindowsServer" version="2.3.0" />
</dependencies>
</metadata>
</package>

Просмотреть файл

@ -201,7 +201,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
// Functions attaches the HttpRequest, which allows us to log richer request details.
object request;
if (scopeProps.TryGetValue(ScopeKeys.HttpRequest, out request))
if (scopeProps.TryGetValue(ApplicationInsightsScopeKeys.HttpRequest, out request))
{
ApplyHttpRequestProperties(requestTelemetry, request as HttpRequestMessage);
}
@ -310,7 +310,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
{
// first check for X-Forwarded-For; used by load balancers
IEnumerable<string> headers;
if (httpRequest.Headers.TryGetValues(ScopeKeys.ForwardedForHeaderName, out headers))
if (httpRequest.Headers.TryGetValues(ApplicationInsightsScopeKeys.ForwardedForHeaderName, out headers))
{
string ip = headers.FirstOrDefault();
if (!string.IsNullOrWhiteSpace(ip))
@ -319,7 +319,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
}
}
HttpContextBase context = httpRequest.Properties.GetValueOrDefault<HttpContextBase>(ScopeKeys.HttpContext);
HttpContextBase context = httpRequest.Properties.GetValueOrDefault<HttpContextBase>(ApplicationInsightsScopeKeys.HttpContext);
return context?.Request?.UserHostAddress ?? LoggingConstants.ZeroIpAddress;
}
@ -339,7 +339,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
internal static HttpResponseMessage GetResponse(HttpRequestMessage httpRequest)
{
// Grab the response stored by functions
return httpRequest.Properties.GetValueOrDefault<HttpResponseMessage>(ScopeKeys.FunctionsHttpResponse);
return httpRequest.Properties.GetValueOrDefault<HttpResponseMessage>(ApplicationInsightsScopeKeys.FunctionsHttpResponse);
}
}
}

Просмотреть файл

@ -11,7 +11,6 @@ namespace Microsoft.Extensions.Logging
/// <summary>
/// Extensions for adding the <see cref="ApplicationInsightsLoggerProvider"/> to an <see cref="ILoggerFactory"/>.
/// </summary>
[CLSCompliant(false)]
public static class ApplicationInsightsLoggerExtensions
{
/// <summary>

Просмотреть файл

@ -0,0 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.WebJobs.Host.Loggers
{
internal static class ApplicationInsightsScopeKeys
{
internal const string HttpRequest = "MS_HttpRequest";
// HTTP context is set automatically by ASP.NET, this isn't ours.
internal const string HttpContext = "MS_HttpContext";
// This is set by Functions
internal const string FunctionsHttpResponse = "MS_AzureFunctionsHttpResponse";
internal const string ForwardedForHeaderName = "X-Forwarded-For";
}
}

Просмотреть файл

@ -18,7 +18,6 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
/// <summary>
/// Creates a <see cref="TelemetryClient"/> for use by the <see cref="ApplicationInsightsLogger"/>.
/// </summary>
[CLSCompliant(false)]
public class DefaultTelemetryClientFactory : ITelemetryClientFactory
{
private readonly string _instrumentationKey;
@ -64,8 +63,10 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
internal TelemetryConfiguration InitializeConfiguration()
{
TelemetryConfiguration config = new TelemetryConfiguration();
config.InstrumentationKey = _instrumentationKey;
TelemetryConfiguration config = new TelemetryConfiguration()
{
InstrumentationKey = _instrumentationKey
};
AddInitializers(config);

Двоичный файл не отображается.

Просмотреть файл

@ -9,7 +9,6 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
/// <summary>
/// Interface for creating <see cref="TelemetryClient"/> instances.
/// </summary>
[CLSCompliant(false)]
public interface ITelemetryClientFactory : IDisposable
{
/// <summary>

Просмотреть файл

@ -0,0 +1,31 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d3ff0fde-ebdf-4751-8131-3375cf2a5c21")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: InternalsVisibleTo("Microsoft.Azure.WebJobs.Host.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]

Просмотреть файл

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3FF0FDE-EBDF-4751-8131-3375CF2A5C21}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.WebJobs.Logging.ApplicationInsights</RootNamespace>
<AssemblyName>Microsoft.Azure.WebJobs.Logging.ApplicationInsights</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\src.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Common\PublicKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DelaySign>true</DelaySign>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AI.Agent.Intercept, Version=2.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.7\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AI.DependencyCollector, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.3.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AI.PerfCounterCollector, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.3.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AI.ServerTelemetryChannel, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.3.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AI.WindowsServer, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.WindowsServer.2.3.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationInsights, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.2.3.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.1.1\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net46\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net46\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationInsightsLogger.cs" />
<Compile Include="ApplicationInsightsLoggerExtensions.cs" />
<Compile Include="ApplicationInsightsLoggerProvider.cs" />
<Compile Include="ApplicationInsightsScope.cs" />
<Compile Include="Constants\LoggingConstants.cs" />
<Compile Include="Constants\ApplicationInsightsScopeKeys.cs" />
<Compile Include="DefaultTelemetryClientFactory.cs" />
<Compile Include="Extensions\DictionaryExtensions.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="ITelemetryClientFactory.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebJobsTelemetryInitializer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\src\Common\PublicKey.snk">
<Link>Properties\PublicKey.snk</Link>
</None>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Azure.WebJobs.Host\WebJobs.Host.csproj">
<Project>{0e095cb2-3030-49ff-966c-785f1a55f0c1}</Project>
<Name>WebJobs.Host</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\StyleCop.MSBuild.4.7.55.0\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\packages\StyleCop.MSBuild.4.7.55.0\build\StyleCop.MSBuild.Targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\StyleCop.MSBuild.4.7.55.0\build\StyleCop.MSBuild.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\StyleCop.MSBuild.4.7.55.0\build\StyleCop.MSBuild.Targets'))" />
</Target>
</Project>

Просмотреть файл

@ -12,6 +12,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
internal class WebJobsTelemetryInitializer : ITelemetryInitializer
{
private const string ComputerNameKey = "COMPUTERNAME";
private const string WebSiteInstanceIdKey = "WEBSITE_INSTANCE_ID";
private static string _roleInstanceName = GetRoleInstanceName();
@ -44,7 +45,7 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
private static string GetRoleInstanceName()
{
string instanceName = Environment.GetEnvironmentVariable(WebSitesKnownKeyNames.WebSiteInstanceIdKey);
string instanceName = Environment.GetEnvironmentVariable(WebSiteInstanceIdKey);
if (string.IsNullOrEmpty(instanceName))
{
instanceName = Environment.GetEnvironmentVariable(ComputerNameKey);

Просмотреть файл

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.7" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.3.0" targetFramework="net46" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.1" targetFramework="net46" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net46" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net46" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net46" />
<package id="StyleCop.MSBuild" version="4.7.55.0" targetFramework="net46" developmentDependency="true" />
<package id="System.AppContext" version="4.3.0" targetFramework="net46" />
<package id="System.Collections" version="4.3.0" targetFramework="net46" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net46" />
<package id="System.Console" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net46" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net46" />
<package id="System.Globalization" version="4.3.0" targetFramework="net46" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net46" />
<package id="System.IO" version="4.3.0" targetFramework="net46" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net46" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net46" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net46" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Linq" version="4.3.0" targetFramework="net46" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net46" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net46" />
<package id="System.Reflection" version="4.3.0" targetFramework="net46" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net46" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net46" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net46" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net46" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net46" />
<package id="System.Threading" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net46" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net46" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net46" />
</packages>

Просмотреть файл

@ -18,7 +18,6 @@
<dependency id="Newtonsoft.Json" version="9.0.1"/>
<dependency id="WindowsAzure.Storage" version="7.2.1"/>
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="1.1.1" />
<dependency id="Microsoft.ApplicationInsights.WindowsServer" version="2.3.0" />
</dependencies>
</metadata>
</package>

Просмотреть файл

@ -35,18 +35,24 @@
<None Include="..\..\tools\NuGetProj.settings.targets">
<Link>NuGetProj.settings.targets</Link>
</None>
<None Include="..\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.NuGet\WebJobs.Logging.ApplicationInsights.nuproj">
<Link>WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.nuproj</Link>
</None>
<None Include="..\Microsoft.Azure.WebJobs.Logging.ApplicationInsights.NuGet\WebJobs.Logging.ApplicationInsights.nuspec">
<Link>WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.nuspec</Link>
</None>
<NuGetProject Include="..\Microsoft.Azure.WebJobs.ServiceBus.NuGet\WebJobs.ServiceBus.nuproj">
<Link>WebJobs.ServiceBus\WebJobs.ServiceBus.nuproj</Link>
</NuGetProject>
<NuGetSpec Include="..\Microsoft.Azure.WebJobs.ServiceBus.NuGet\WebJobs.ServiceBus.nuspec">
<Link>WebJobs.ServiceBus\WebJobs.ServiceBus.nuspec</Link>
</NuGetSpec>
</NuGetSpec>
<NuGetProject Include="..\Microsoft.Azure.WebJobs.Logging.NuGet\WebJobs.Logging.nuproj">
<Link>WebJobs.Logging\WebJobs.Logging.nuproj</Link>
</NuGetProject>
<NuGetSpec Include="..\Microsoft.Azure.WebJobs.Logging.NuGet\WebJobs.Logging.nuspec">
<Link>WebJobs.Logging\WebJobs.Logging.nuspec</Link>
</NuGetSpec>
</NuGetSpec>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="Build">

Просмотреть файл

@ -134,7 +134,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
Assert.Equal(116, metricDict[$"{_functionFullName} {LoggingKeys.Successes}"]);
Assert.Equal(200, metricDict[$"{_functionFullName} {LoggingKeys.MinDuration}"]);
Assert.Equal(2180, metricDict[$"{_functionFullName} {LoggingKeys.MaxDuration}"]);
Assert.Equal(340, metricDict[$"{_functionFullName} {LoggingKeys.AvgDuration}"]);
Assert.Equal(340, metricDict[$"{_functionFullName} {LoggingKeys.AverageDuration}"]);
Assert.Equal(96.67, metricDict[$"{_functionFullName} {LoggingKeys.SuccessRate}"]);
Assert.Equal(120, metricDict[$"{_functionFullName} {LoggingKeys.Count}"]);
}
@ -150,13 +150,13 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
var request = new HttpRequestMessage(HttpMethod.Post, "http://someuri/api/path");
request.Headers.Add("User-Agent", "my custom user agent");
var response = new HttpResponseMessage();
request.Properties[ScopeKeys.FunctionsHttpResponse] = response;
request.Properties[ApplicationInsightsScopeKeys.FunctionsHttpResponse] = response;
MockIpAddress(request, "1.2.3.4");
ILogger logger = CreateLogger(LogCategories.Results);
var scopeProps = CreateScopeDictionary(_invocationId, _functionShortName);
scopeProps[ScopeKeys.HttpRequest] = request;
scopeProps[ApplicationInsightsScopeKeys.HttpRequest] = request;
using (logger.BeginScope(scopeProps))
{
@ -194,7 +194,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
ILogger logger = CreateLogger(LogCategories.Results);
var scopeProps = CreateScopeDictionary(_invocationId, _functionShortName);
scopeProps[ScopeKeys.HttpRequest] = request;
scopeProps[ApplicationInsightsScopeKeys.HttpRequest] = request;
using (logger.BeginScope(scopeProps))
{
@ -308,7 +308,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
public void GetIpAddress_ChecksHeaderFirst(string headerIp)
{
HttpRequestMessage request = new HttpRequestMessage();
request.Headers.Add(ScopeKeys.ForwardedForHeaderName, headerIp);
request.Headers.Add(ApplicationInsightsScopeKeys.ForwardedForHeaderName, headerIp);
MockIpAddress(request, "5.6.7.8");
string ip = ApplicationInsightsLogger.GetIpAddress(request);
@ -419,7 +419,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
Mock<HttpRequestBase> mockRequest = new Mock<HttpRequestBase>(MockBehavior.Strict);
mockRequest.Setup(r => r.UserHostAddress).Returns(ipAddress);
mockContext.Setup(c => c.Request).Returns(mockRequest.Object);
request.Properties[ScopeKeys.HttpContext] = mockContext.Object;
request.Properties[ApplicationInsightsScopeKeys.HttpContext] = mockContext.Object;
}
private ILogger CreateLogger(string category)

Просмотреть файл

@ -106,7 +106,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
Assert.Equal(116, payload[LoggingKeys.Successes]);
Assert.Equal(TimeSpan.FromMilliseconds(200), (TimeSpan)payload[LoggingKeys.MinDuration]);
Assert.Equal(TimeSpan.FromMilliseconds(2180), (TimeSpan)payload[LoggingKeys.MaxDuration]);
Assert.Equal(TimeSpan.FromMilliseconds(340), (TimeSpan)payload[LoggingKeys.AvgDuration]);
Assert.Equal(TimeSpan.FromMilliseconds(340), (TimeSpan)payload[LoggingKeys.AverageDuration]);
Assert.Equal(now, payload[LoggingKeys.Timestamp]);
Assert.Equal(120, payload[LoggingKeys.Count]);
Assert.Equal(96.67, payload[LoggingKeys.SuccessRate]);

Просмотреть файл

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Xunit;
@ -228,11 +229,25 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests
"FunctionListenerException",
"ExceptionFormatter",
"FunctionResultAggregatorConfiguration",
"ApplicationInsightsLoggerExtensions",
"LogCategoryFilter",
"LogCategories",
"LoggingKeys",
"ScopeKeys"
};
AssertPublicTypes(expected, assembly);
}
[Fact]
public void ApplicationInsightsPublicSurface_LimitedToSpecificTypes()
{
var assembly = typeof(ApplicationInsightsLogger).Assembly;
var expected = new[]
{
"ITelemetryClientFactory",
"DefaultTelemetryClientFactory"
"DefaultTelemetryClientFactory",
"ApplicationInsightsLoggerExtensions"
};
AssertPublicTypes(expected, assembly);

Просмотреть файл

@ -378,6 +378,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj">
<Project>{d3ff0fde-ebdf-4751-8131-3375cf2a5c21}</Project>
<Name>WebJobs.Logging.ApplicationInsights</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Microsoft.Azure.WebJobs.Logging\WebJobs.Logging.csproj">
<Project>{b5a04006-ab0c-4800-ae4c-080d31867de3}</Project>
<Name>WebJobs.Logging</Name>

Просмотреть файл

@ -8,6 +8,7 @@
<assembly name="Microsoft.Azure.WebJobs.ServiceBus"/>
<assembly name="Microsoft.Azure.WebJobs.Storage"/>
<assembly name="Microsoft.Azure.WebJobs.Logging"/>
<assembly name="Microsoft.Azure.WebJobs.Logging.ApplicationInsights"/>
<!-- Unit test assemblies -->
<assembly name="Dashboard.UnitTests"/>