Create Stress Test to test self diagnostics log file's file share status

(cherry picked from commit 9fe60757c4254b67c1d166fc5f42eb795d424bf9)
This commit is contained in:
xiang17 2021-01-12 15:11:48 -08:00
parent 95ec7d2399
commit 1007ffef42
3 changed files with 80 additions and 0 deletions

View File

@ -205,6 +205,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Shared", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.5.0", "test\TestApp.AspNetCore.5.0\TestApp.AspNetCore.5.0.csproj", "{972396A8-E35B-499C-9BA1-765E9B8822E1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StressTest", "test\StressTest\StressTest.csproj", "{BE8E7BA2-5149-49FB-BAC2-9B22B1164348}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -403,6 +405,10 @@ Global
{972396A8-E35B-499C-9BA1-765E9B8822E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{972396A8-E35B-499C-9BA1-765E9B8822E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{972396A8-E35B-499C-9BA1-765E9B8822E1}.Release|Any CPU.Build.0 = Release|Any CPU
{BE8E7BA2-5149-49FB-BAC2-9B22B1164348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE8E7BA2-5149-49FB-BAC2-9B22B1164348}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE8E7BA2-5149-49FB-BAC2-9B22B1164348}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE8E7BA2-5149-49FB-BAC2-9B22B1164348}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -433,6 +439,7 @@ Global
{B3F03725-23A0-4582-9526-F6A7E38F35CC} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{13C10C9A-07E8-43EB-91F5-C2B116FBE0FC} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{972396A8-E35B-499C-9BA1-765E9B8822E1} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
{BE8E7BA2-5149-49FB-BAC2-9B22B1164348} = {0169B149-FB8B-46F4-9EF7-8A0E69F8FAAF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}

View File

@ -0,0 +1,59 @@
// <copyright file="Program.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using OpenTelemetry;
using OpenTelemetry.Trace;
namespace OpenTelemetry.StressTest
{
internal class Program
{
private static ActivitySource source = new ActivitySource("OpenTelemetry.Exporter.Geneva.Stress");
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
InitTraces();
while (true)
{
RunTraces();
}
}
private static void InitTraces()
{
OpenTelemetry.Sdk.CreateTracerProviderBuilder()
.SetSampler(new AlwaysOnSampler())
.AddSource("OpenTelemetry.Exporter.Geneva.Stress")
.AddConsoleExporter()
.Build();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void RunTraces()
{
using (var activity = source.StartActivity("Stress"))
{
activity?.SetTag("http.method", "GET");
activity?.SetTag("http.url", "https://www.wikipedia.org/wiki/Rabbit");
activity?.SetTag("http.status_code", 200);
}
}
}
}

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net46;net461;net462;net47;net471;net472;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
</ItemGroup>
</Project>