Skip to content

Commit

Permalink
Fix HAS tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
sky1045 committed Aug 22, 2024
1 parent f70b063 commit 4f9c864
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Lib9c/Action/HackAndSlash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Nekoyume.Action
[ActionType("hack_and_slash22")]
public class HackAndSlash : GameAction, IHackAndSlashV10
{
private static readonly ActivitySource ActivitySource = new ActivitySource("Lib9c.Action.HackAndSlash");
public const int UsableApStoneCount = 10;

public List<Guid> Costumes;
Expand All @@ -42,7 +43,6 @@ public class HackAndSlash : GameAction, IHackAndSlashV10
public Address AvatarAddress;
public int TotalPlayCount = 1;
public int ApStoneCount = 0;
private readonly ActivitySource _activitySource = new ActivitySource("Lib9c.Action.HackAndSlash");

IEnumerable<Guid> IHackAndSlashV10.Costumes => Costumes;
IEnumerable<Guid> IHackAndSlashV10.Equipments => Equipments;
Expand Down Expand Up @@ -118,7 +118,7 @@ public IWorld Execute(
var addressesHex = $"[{signer.ToHex()}, {AvatarAddress.ToHex()}]";
var started = DateTimeOffset.UtcNow;
const string source = "HackAndSlash";
var activity = _activitySource.StartActivity("HackAndSlash");
using var activity = ActivitySource.StartActivity("HackAndSlash");
Log.Verbose("{AddressesHex} {Source} from #{BlockIndex} exec started",
addressesHex, source, blockIndex);

Expand Down Expand Up @@ -147,7 +147,7 @@ public IWorld Execute(

var sw = new Stopwatch();
sw.Start();
var avatarStateActivity = _activitySource.StartActivity(
var avatarStateActivity = ActivitySource.StartActivity(
"GetAvatarState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -163,7 +163,7 @@ public IWorld Execute(
addressesHex, source, "Get AvatarState", blockIndex, sw.Elapsed.TotalMilliseconds);

sw.Restart();
var sheetActivity = _activitySource.StartActivity(
var sheetActivity = ActivitySource.StartActivity(
"GetSheets",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -210,7 +210,7 @@ public IWorld Execute(

sw.Restart();

var checkStateActivity = _activitySource.StartActivity(
var checkStateActivity = ActivitySource.StartActivity(
"CheckState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -245,7 +245,7 @@ public IWorld Execute(
}

sw.Restart();
var stageSheetActivity = _activitySource.StartActivity(
var stageSheetActivity = ActivitySource.StartActivity(
"GetStageSheet",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -260,7 +260,7 @@ public IWorld Execute(
addressesHex, source, "Get StageSheet", blockIndex, sw.Elapsed.TotalMilliseconds);

sw.Restart();
var validateWorldActivity = _activitySource.StartActivity(
var validateWorldActivity = ActivitySource.StartActivity(
"ValidateWorld",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -306,7 +306,7 @@ public IWorld Execute(
addressesHex, source, "Validate World", blockIndex, sw.Elapsed.TotalMilliseconds);

sw.Restart();
var validateItemsActivity = _activitySource.StartActivity(
var validateItemsActivity = ActivitySource.StartActivity(
"ValidateItems",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -328,7 +328,7 @@ public IWorld Execute(
addressesHex, source, "Validate Items", blockIndex, sw.Elapsed.TotalMilliseconds);
sw.Restart();

var unequipItemsActivity = _activitySource.StartActivity(
var unequipItemsActivity = ActivitySource.StartActivity(
"UnequipItems",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -414,7 +414,7 @@ public IWorld Execute(
addressesHex, source, "Unequip items", blockIndex, sw.Elapsed.TotalMilliseconds);

sw.Restart();
var questSheetActivity = _activitySource.StartActivity(
var questSheetActivity = ActivitySource.StartActivity(
"GetQuestSheet",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -433,7 +433,7 @@ public IWorld Execute(
if (ids.Any())
{
sw.Restart();
var questListActivity = _activitySource.StartActivity(
var questListActivity = ActivitySource.StartActivity(
"UpdateQuestList",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -451,7 +451,7 @@ public IWorld Execute(

sw.Restart();

var skillStateActivity = _activitySource.StartActivity(
var skillStateActivity = ActivitySource.StartActivity(
"GetSkillState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -499,7 +499,7 @@ public IWorld Execute(
var crystalStageBuffSheet = sheets.GetSheet<CrystalStageBuffGachaSheet>();
sw.Restart();

var slotstateActivity = _activitySource.StartActivity(
var slotstateActivity = ActivitySource.StartActivity(
"UpdateSlotState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -536,7 +536,7 @@ public IWorld Execute(
Log.Verbose("{AddressesHex} {Source} HAS {Process} from #{BlockIndex}: {Elapsed}",
addressesHex, source, "Update slotState", blockIndex, sw.Elapsed.TotalMilliseconds);

var simulatorActivity = _activitySource.StartActivity(
var simulatorActivity = ActivitySource.StartActivity(
"Simulator",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -594,7 +594,7 @@ public IWorld Execute(
addressesHex, source, "Simulator.Simulate()", blockIndex, sw.Elapsed.TotalMilliseconds);

sw.Restart();
var clearStageActivity = _activitySource.StartActivity(
var clearStageActivity = ActivitySource.StartActivity(
"ClearStage",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down Expand Up @@ -666,7 +666,7 @@ public IWorld Execute(
skillState?.Update(starCount, crystalStageBuffSheet);
sw.Restart();

var updateAvatarActivity = _activitySource.StartActivity(
var updateAvatarActivity = ActivitySource.StartActivity(
"UpdateAvatarState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand All @@ -681,7 +681,7 @@ public IWorld Execute(

sw.Restart();

var setStateActivity = _activitySource.StartActivity(
var setStateActivity = ActivitySource.StartActivity(
"SetState",
ActivityKind.Internal,
activity?.Id ?? string.Empty);
Expand Down

0 comments on commit 4f9c864

Please sign in to comment.