-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31db4d6
commit 6a3f07d
Showing
3 changed files
with
35 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
33 changes: 33 additions & 0 deletions
33
src/NScenario/StepExecutors/InstrumentationScenarioStepExecutor.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,33 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Threading.Tasks; | ||
|
||
namespace NScenario.StepExecutors; | ||
|
||
public static class NScenarioInstrumentation | ||
{ | ||
public static ActivitySource DiagnosticSource = new ActivitySource("NScenario"); | ||
} | ||
|
||
public class InstrumentationScenarioStepExecutor : IScenarioStepExecutor | ||
{ | ||
private readonly IScenarioStepExecutor _scenarioStepExecutorImplementation; | ||
|
||
|
||
public InstrumentationScenarioStepExecutor(IScenarioStepExecutor scenarioStepExecutorImplementation) | ||
{ | ||
_scenarioStepExecutorImplementation = scenarioStepExecutorImplementation; | ||
} | ||
|
||
public async Task Step(string scenarioName, string stepDescription, Func<Task> action, StepContext stepContext) | ||
{ | ||
using var activity = NScenarioInstrumentation.DiagnosticSource.StartActivity(name: stepDescription); | ||
await _scenarioStepExecutorImplementation.Step(scenarioName, stepDescription, action, stepContext); | ||
} | ||
|
||
public async Task Step(string scenarioName, string stepDescription, Action action, StepContext stepContext) | ||
{ | ||
using var activity = NScenarioInstrumentation.DiagnosticSource.StartActivity(name: stepDescription); | ||
await _scenarioStepExecutorImplementation.Step(scenarioName, stepDescription, action, stepContext); | ||
} | ||
} |
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