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(), Current = newScreen?.GetType().ReadableName(),
Previous = current?.GetType().ReadableName(), Previous = current?.GetType().ReadableName(),
}; };
scope.SetTag(@"screen", newScreen?.GetType().ReadableName() ?? @"none");
}); });
switch (newScreen) switch (newScreen)

View File

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