-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into yunl/IResourceDetector
- Loading branch information
Showing
5 changed files
with
233 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// <copyright file="DummyProcessor.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 OpenTelemetry; | ||
using OpenTelemetry.Logs; | ||
|
||
namespace OpenTelemetry.Tests.Stress; | ||
|
||
internal class DummyProcessor : BaseProcessor<LogRecord> | ||
{ | ||
public override void OnEnd(LogRecord record) | ||
{ | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net462</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests.Stress\Skeleton.cs" /> | ||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="[6.0.0,)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\Utils.cs" Link="Includes\Utils.cs" /> | ||
</ItemGroup> | ||
|
||
</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,120 @@ | ||
// <copyright file="Payload.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> | ||
|
||
namespace OpenTelemetry.Tests.Stress; | ||
|
||
internal class Payload | ||
{ | ||
public int Field001 = 0; | ||
public float Field002 = 2.718281828f; | ||
public double Field003 = 3.141592653589793d; | ||
public string Field004 = "Hello, World!"; | ||
public bool Field005 = true; | ||
public int Field006 = 6; | ||
public int Field007 = 7; | ||
public int Field008 = 8; | ||
public int Field009 = 9; | ||
public int Field010 = 10; | ||
public int Field011 = 11; | ||
public int Field012 = 12; | ||
public int Field013 = 13; | ||
public int Field014 = 14; | ||
public int Field015 = 15; | ||
public int Field016 = 16; | ||
public int Field017 = 17; | ||
public int Field018 = 18; | ||
public int Field019 = 19; | ||
public int Field020 = 20; | ||
public int Field021 = 21; | ||
public int Field022 = 22; | ||
public int Field023 = 23; | ||
public int Field024 = 24; | ||
public int Field025 = 25; | ||
public int Field026 = 26; | ||
public int Field027 = 27; | ||
public int Field028 = 28; | ||
public int Field029 = 29; | ||
public int Field030 = 30; | ||
public int Field031 = 31; | ||
public int Field032 = 32; | ||
public int Field033 = 33; | ||
public int Field034 = 34; | ||
public int Field035 = 35; | ||
public int Field036 = 36; | ||
public int Field037 = 37; | ||
public int Field038 = 38; | ||
public int Field039 = 39; | ||
public int Field040 = 40; | ||
public int Field041 = 41; | ||
public int Field042 = 42; | ||
public int Field043 = 43; | ||
public int Field044 = 44; | ||
public int Field045 = 45; | ||
public int Field046 = 46; | ||
public int Field047 = 47; | ||
public int Field048 = 48; | ||
public int Field049 = 49; | ||
public int Field050 = 50; | ||
public int Field051 = 51; | ||
public int Field052 = 52; | ||
public int Field053 = 53; | ||
public int Field054 = 54; | ||
public int Field055 = 55; | ||
public int Field056 = 56; | ||
public int Field057 = 57; | ||
public int Field058 = 58; | ||
public int Field059 = 59; | ||
public int Field060 = 60; | ||
public int Field061 = 61; | ||
public int Field062 = 62; | ||
public int Field063 = 63; | ||
public int Field064 = 64; | ||
public int Field065 = 65; | ||
public int Field066 = 66; | ||
public int Field067 = 67; | ||
public int Field068 = 68; | ||
public int Field069 = 69; | ||
public int Field070 = 70; | ||
public int Field071 = 71; | ||
public int Field072 = 72; | ||
public int Field073 = 73; | ||
public int Field074 = 74; | ||
public int Field075 = 75; | ||
public int Field076 = 76; | ||
public int Field077 = 77; | ||
public int Field078 = 78; | ||
public int Field079 = 79; | ||
public int Field080 = 80; | ||
public int Field081 = 81; | ||
public int Field082 = 82; | ||
public int Field083 = 83; | ||
public int Field084 = 84; | ||
public int Field085 = 85; | ||
public int Field086 = 86; | ||
public int Field087 = 87; | ||
public int Field088 = 88; | ||
public int Field089 = 89; | ||
public int Field090 = 90; | ||
public int Field091 = 91; | ||
public int Field092 = 92; | ||
public int Field093 = 93; | ||
public int Field094 = 94; | ||
public int Field095 = 95; | ||
public int Field096 = 96; | ||
public int Field097 = 97; | ||
public int Field098 = 98; | ||
public int Field099 = 99; | ||
} |
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,53 @@ | ||
// <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.Runtime.CompilerServices; | ||
using Microsoft.Extensions.Logging; | ||
using OpenTelemetry.Logs; | ||
|
||
namespace OpenTelemetry.Tests.Stress; | ||
|
||
public partial class Program | ||
{ | ||
private static ILogger logger; | ||
private static Payload payload = new Payload(); | ||
|
||
public static void Main() | ||
{ | ||
using var loggerFactory = LoggerFactory.Create(builder => | ||
{ | ||
builder.AddOpenTelemetry(options => | ||
{ | ||
options.AddProcessor(new DummyProcessor()); | ||
}); | ||
}); | ||
|
||
logger = loggerFactory.CreateLogger<Program>(); | ||
|
||
Stress(prometheusPort: 9184); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
protected static void Run() | ||
{ | ||
logger.Log( | ||
logLevel: LogLevel.Information, | ||
eventId: 2, | ||
state: payload, | ||
exception: null, | ||
formatter: (state, ex) => string.Empty); | ||
} | ||
} |
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 @@ | ||
# OpenTelemetry Stress Tests for Logs | ||
|
||
This is Stress Test specifically for logging, and is | ||
based on the [OpenTelemetry.Tests.Stress](../OpenTelemetry.Tests.Stress/README.md). | ||
|
||
* [Running the stress test](#running-the-stress-test) | ||
|
||
## Running the stress test | ||
|
||
Open a console, run the following command from the current folder: | ||
|
||
```sh | ||
dotnet run --framework net6.0 --configuration Release | ||
``` |