This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created Stats.CollectAzureCdnLogs job
- Loading branch information
1 parent
5e994a4
commit e93e095
Showing
28 changed files
with
1,277 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,4 +185,5 @@ UpgradeLog*.htm | |
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ | ||
FakesAssemblies/ | ||
*.webtestresult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings name="Local" id="04665429-a6c2-4cdf-b720-95461fe06f50" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<Description>These are default test settings for a local test run.</Description> | ||
<Deployment enabled="false" /> | ||
<Execution> | ||
<TestTypeSpecific /> | ||
<AgentRule name="Execution Agents"> | ||
</AgentRule> | ||
</Execution> | ||
<Properties> | ||
<Property name="TestSettingsUIType" value="LoadTest" /> | ||
</Properties> | ||
</TestSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) .NET Foundation. All rights reserved.
 | ||
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.</s:String></wpf:ResourceDictionary> | ||
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<WebTest Name="DownloadPackageApiV2" Id="f0c6d88d-bc9d-4256-b1f0-c70866d59e2e" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="WebTest1.7ffeba66-45d9-4625-9ca6-ca2b95c6c76a.rec.webtestresult" ResultsLocale=""> | ||
<Items> | ||
<Request Method="GET" Guid="ea523c76-15f8-4fae-96cd-ac46a2a3fe40" Version="1.1" Url="https://dev.nugettest.org/api/v2/package/Newtonsoft.Json/6.0.1-beta1" ThinkTime="25" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="https://f168.wpc.azureedge.net/80F168/nugetdevlegacy.blob.core.windows.net/packages/newtonsoft.json.6.0.1-beta1.nupkg" ReportingName="Download package through v2 API" IgnoreHttpStatusCode="False" /> | ||
</Items> | ||
<ValidationRules> | ||
<ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidateResponseUrl, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Response URL" Description="Validates that the response URL after redirects are followed is the same as the recorded response URL. QueryString parameters are ignored." Level="Low" ExectuionOrder="BeforeDependents" /> | ||
<ValidationRule Classname="Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleResponseTimeGoal, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" DisplayName="Response Time Goal" Description="Validates that the response time for the request is less than or equal to the response time goal as specified on the request. Response time goals of zero will be ignored." Level="Low" ExectuionOrder="AfterDependents"> | ||
<RuleParameters> | ||
<RuleParameter Name="Tolerance" Value="0" /> | ||
</RuleParameters> | ||
</ValidationRule> | ||
</ValidationRules> | ||
</WebTest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion> | ||
</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{FC4A7438-6EFD-437F-A077-8F5BF4654316}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>LoadTests</RootNamespace> | ||
<AssemblyName>LoadTests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<TestProjectType>WebTest</TestProjectType> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
</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> | ||
</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> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> | ||
<Visible>False</Visible> | ||
</CodeAnalysisDependentAssemblyPaths> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="DownloadPackageApiV2.webtest"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("LoadTests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("LoadTests")] | ||
[assembly: AssemblyCopyright("Copyright © .NET Foundation 2015")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
[assembly: ComVisible(false)] | ||
[assembly: Guid("a44bd48a-4ea1-43a0-b72a-d79cb002590d")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Stats.CollectAzureCdnLogs | ||
{ | ||
internal enum AzureCdnPlatform | ||
{ | ||
HttpLargeObject, | ||
HttpSmallObject, | ||
ApplicationDeliveryNetwork, | ||
FlashMediaStreaming | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/Stats.CollectAzureCdnLogs/Blob/CloudBlobRawLogClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Microsoft.WindowsAzure.Storage; | ||
using Microsoft.WindowsAzure.Storage.Blob; | ||
using Microsoft.WindowsAzure.Storage.RetryPolicies; | ||
|
||
namespace Stats.CollectAzureCdnLogs.Blob | ||
{ | ||
internal sealed class CloudBlobRawLogClient | ||
{ | ||
private readonly JobEventSource _jobEventSource; | ||
private readonly CloudStorageAccount _cloudStorageAccount; | ||
|
||
public CloudBlobRawLogClient(JobEventSource jobEventSource, CloudStorageAccount cloudStorageAccount) | ||
{ | ||
_jobEventSource = jobEventSource; | ||
_cloudStorageAccount = cloudStorageAccount; | ||
} | ||
|
||
public async Task<CloudBlobContainer> CreateContainerIfNotExistsAsync(string containerName) | ||
{ | ||
var cloudBlobClient = _cloudStorageAccount.CreateCloudBlobClient(); | ||
cloudBlobClient.DefaultRequestOptions.RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(10), 5); | ||
|
||
var cloudBlobContainer = cloudBlobClient.GetContainerReference(containerName); | ||
await cloudBlobContainer.CreateIfNotExistsAsync(); | ||
|
||
return cloudBlobContainer; | ||
} | ||
|
||
public async Task<bool> UploadBlobAsync(CloudBlobContainer targetContainer, RawLogFileInfo logFile, Stream rawLogStream) | ||
{ | ||
try | ||
{ | ||
var blobName = logFile.Uri.ToString(); | ||
_jobEventSource.BeginningBlobUpload(blobName); | ||
Trace.TraceInformation("Uploading file '{0}'.", logFile.FileName); | ||
|
||
var blob = targetContainer.GetBlockBlobReference(logFile.FileName); | ||
blob.Properties.ContentType = logFile.ContentType; | ||
|
||
// 3. Upload the file using the original file name. | ||
await blob.UploadFromStreamAsync(rawLogStream); | ||
|
||
Trace.TraceInformation("Finished uploading file '{0}' to '{1}'.", logFile.FileName, blob.Uri.AbsoluteUri); | ||
_jobEventSource.FinishingBlobUpload(blobName); | ||
return true; | ||
} | ||
catch (Exception exception) | ||
{ | ||
Trace.TraceError(exception.ToString()); | ||
} | ||
return false; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Stats.CollectAzureCdnLogs/Exceptions/InvalidRawLogFileNameException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Globalization; | ||
|
||
namespace Stats.CollectAzureCdnLogs | ||
{ | ||
[Serializable] | ||
internal sealed class InvalidRawLogFileNameException | ||
: Exception | ||
{ | ||
public InvalidRawLogFileNameException(string fileName) | ||
: base(string.Format(CultureInfo.InvariantCulture, "The file '{0}' is not recognized to comply with the Azure Premium CDN raw log file naming conventions.", fileName)) | ||
{ | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Stats.CollectAzureCdnLogs/Exceptions/UnknownAzureCdnPlatformException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Globalization; | ||
|
||
namespace Stats.CollectAzureCdnLogs | ||
{ | ||
[Serializable] | ||
internal sealed class UnknownAzureCdnPlatformException | ||
: Exception | ||
{ | ||
public UnknownAzureCdnPlatformException(string prefix) | ||
: base(string.Format(CultureInfo.InvariantCulture, "The file prefix '{0}' is not recognized as a valid Azure Premium CDN platform.", prefix)) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.