-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tools] Stress test improvements (#5381)
- Loading branch information
1 parent
7e0213d
commit 73b6e30
Showing
16 changed files
with
508 additions
and
300 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
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,39 +1,55 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace OpenTelemetry.Tests.Stress; | ||
|
||
public partial class Program | ||
public static class Program | ||
{ | ||
private static ILogger logger; | ||
private static Payload payload = new Payload(); | ||
public static int Main(string[] args) | ||
{ | ||
return StressTestFactory.RunSynchronously<LogsStressTest>(args); | ||
} | ||
|
||
public static void Main() | ||
private sealed class LogsStressTest : StressTest<StressTestOptions> | ||
{ | ||
using var loggerFactory = LoggerFactory.Create(builder => | ||
private static readonly Payload Payload = new(); | ||
private readonly ILoggerFactory loggerFactory; | ||
private readonly ILogger logger; | ||
|
||
public LogsStressTest(StressTestOptions options) | ||
: base(options) | ||
{ | ||
builder.AddOpenTelemetry(options => | ||
this.loggerFactory = LoggerFactory.Create(builder => | ||
{ | ||
options.AddProcessor(new DummyProcessor()); | ||
builder.AddOpenTelemetry(options => | ||
{ | ||
options.AddProcessor(new DummyProcessor()); | ||
}); | ||
}); | ||
}); | ||
|
||
logger = loggerFactory.CreateLogger<Program>(); | ||
this.logger = this.loggerFactory.CreateLogger<LogsStressTest>(); | ||
} | ||
|
||
Stress(prometheusPort: 9464); | ||
} | ||
protected override void RunWorkItemInParallel() | ||
{ | ||
this.logger.Log( | ||
logLevel: LogLevel.Information, | ||
eventId: 2, | ||
state: Payload, | ||
exception: null, | ||
formatter: (state, ex) => string.Empty); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
protected static void Run() | ||
{ | ||
logger.Log( | ||
logLevel: LogLevel.Information, | ||
eventId: 2, | ||
state: payload, | ||
exception: null, | ||
formatter: (state, ex) => string.Empty); | ||
protected override void Dispose(bool isDisposing) | ||
{ | ||
if (isDisposing) | ||
{ | ||
this.loggerFactory.Dispose(); | ||
} | ||
|
||
base.Dispose(isDisposing); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.