experimental metrics

This commit is contained in:
Leath Cooper 2024-10-30 20:14:43 -04:00
parent 6e49f60fbc
commit 2acfc1d82d
3 changed files with 19 additions and 10 deletions

View file

@ -2429,8 +2429,6 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
DropHolding();
Region.OnRegionChange(this, m_Region, null);
if (Alive) {
mobilesDeletedCounter.Add(1, new KeyValuePair<string, object?>[]
{
@ -2439,6 +2437,8 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
});
}
Region.OnRegionChange(this, m_Region, null);
m_Region = null;
// Is the above line REALLY needed? The old Region system did NOT have said line
// and worked fine, because of this a LOT of extra checks have to be done everywhere...

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using ModernUO.CodeGeneratedEvents;
using Server.Accounting;
using Server.Collections;
@ -99,6 +100,7 @@ namespace Server.Mobiles
public partial class PlayerMobile : Mobile, IHonorTarget, IHasSteps
{
public static readonly Counter<long> playerDeathCounter = Telemetry.MobilesMeter.CreateCounter<long>("player_death_count");
private static bool m_NoRecursion;
private static readonly Point3D[] m_TrammelDeathDestinations =
@ -2542,6 +2544,12 @@ namespace Server.Mobiles
base.OnDeath(c);
playerDeathCounter.Add(1, new KeyValuePair<string, object>[]
{
new("Map", Map?.Name),
new("Region", Region?.Name),
});
EquipSnapshot = null;
HueMod = -1;

View file

@ -944,6 +944,15 @@ namespace Server.Spells
if (_spell.State == SpellState.Casting && caster.Spell == _spell)
{
_spell.State = SpellState.Sequencing;
spellCastCount.Add(1, new KeyValuePair<string, object>[]
{
new("SpellName", _spell.Name),
new("Skill", $"{_spell.CastSkill}"),
new("Map", caster.Map?.Name),
new("Region", caster.Region?.Name),
});
_spell._castTimer = null;
caster.OnSpellCast(_spell);
caster.Region?.OnSpellCast(caster, _spell);
@ -961,14 +970,6 @@ namespace Server.Spells
caster.Target?.BeginTimeout(caster, 30000); // 30 seconds
}
spellCastCount.Add(1, new KeyValuePair<string, object>[]
{
new("SpellName", _spell.Name),
new("Skill", $"{_spell.CastSkill}"),
new("Map", $"{caster.Map.Name}"),
new("Region", $"{caster.Region?.Name}"),
});
_spell._castTimer = null;
}
}