github.com/grafana/pyroscope@v1.18.0/examples/language-sdk-instrumentation/dotnet/rideshare/example/ScooterService.cs (about) 1 using System.Diagnostics; 2 3 namespace Example; 4 5 internal class ScooterService 6 { 7 private static readonly ActivitySource CustomActivity = new(Program.CustomActivitySourceName); 8 9 private readonly OrderService _orderService; 10 11 public ScooterService(OrderService orderService) 12 { 13 _orderService = orderService; 14 } 15 16 public void Order(int searchRadius) 17 { 18 using var activity = CustomActivity.StartActivity("OrderScooter"); 19 activity?.SetTag("type", "scooter"); 20 for (long i = 0; i < 2000000000; i++) 21 { 22 } 23 OrderInternal(searchRadius); 24 DoSomeOtherWork(); 25 } 26 27 private void OrderInternal(int searchRadius) 28 { 29 using var activity = CustomActivity.StartActivity("OrderScooterInternal"); 30 _orderService.FindNearestVehicle(searchRadius, "scooter"); 31 } 32 33 private void DoSomeOtherWork() 34 { 35 for (long i = 0; i < 1000000000; i++) 36 { 37 } 38 } 39 }