Merge pull request #18300 from peppy/add-ruleset-context-tags

Add ruleset context to sentry error reports
This commit is contained in:
Dan Balasescu 2022-05-16 17:21:39 +09:00 committed by GitHub
commit ff85ce84ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -1207,6 +1207,8 @@ namespace osu.Game
Current = newScreen?.GetType().ReadableName(),
Previous = current?.GetType().ReadableName(),
};
scope.SetTag(@"screen", newScreen?.GetType().ReadableName() ?? @"none");
});
switch (newScreen)

View File

@ -18,6 +18,7 @@ using osu.Game.Database;
using osu.Game.Models;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Skinning;
using Sentry;
using Sentry.Protocol;
@ -109,6 +110,7 @@ namespace osu.Game.Utils
}, scope =>
{
var beatmap = game.Dependencies.Get<IBindable<WorkingBeatmap>>().Value.BeatmapInfo;
var ruleset = game.Dependencies.Get<IBindable<RulesetInfo>>().Value;
scope.Contexts[@"config"] = new
{
@ -125,6 +127,8 @@ namespace osu.Game.Utils
BeatmapSets = realm.All<BeatmapSetInfo>().Count(),
Beatmaps = realm.All<BeatmapInfo>().Count(),
Files = realm.All<RealmFile>().Count(),
Rulesets = realm.All<RulesetInfo>().Count(),
RulesetsAvailable = realm.All<RulesetInfo>().Count(r => r.Available),
Skins = realm.All<SkinInfo>().Count(),
}
};
@ -137,14 +141,25 @@ namespace osu.Game.Utils
scope.Contexts[@"beatmap"] = new
{
Name = beatmap.ToString(),
Ruleset = beatmap.Ruleset.InstantiationInfo,
beatmap.OnlineID,
};
scope.Contexts[@"ruleset"] = new
{
ruleset.ShortName,
ruleset.Name,
ruleset.InstantiationInfo,
ruleset.OnlineID
};
scope.Contexts[@"clocks"] = new
{
Audio = game.Dependencies.Get<MusicController>().CurrentTrack.CurrentTime,
Game = game.Clock.CurrentTime,
};
scope.SetTag(@"ruleset", ruleset.ShortName);
});
}
else