Skip to content

Commit 7b4299a

Browse files
committed
restore metrics with Sentry Metrics v2
1 parent fd8eae5 commit 7b4299a

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

src/components/quickplay/ServerFinder.tsx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from "@ssg/quickplayStaticData";
99
import { useEffect, useMemo, useRef, useState } from "react";
1010
import { OverlayTrigger, Popover, Tooltip } from "react-bootstrap";
11+
import * as Sentry from "@sentry/browser";
1112

1213
import fastClone from "@utils/fastClone";
1314
import { filterString } from "@utils/filter";
@@ -596,8 +597,8 @@ export default function ServerFinder({ hash }: { hash: string }) {
596597
}
597598

598599
function markSatisfaction() {
599-
/* Sentry.metrics.increment("custom.servers.satisfaction_found", 1, {
600-
tags: {
600+
Sentry.metrics.count("custom.servers.satisfaction_found", 1, {
601+
attributes: {
601602
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
602603
matchGroup: quickplayStore.matchGroup,
603604
respawntimes: quickplayStore.respawntimes,
@@ -611,7 +612,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
611612
"custom.servers.satisfaction_find_count",
612613
quickplayStore.findCount,
613614
{
614-
tags: {
615+
attributes: {
615616
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
616617
matchGroup: quickplayStore.matchGroup,
617618
respawntimes: quickplayStore.respawntimes,
@@ -629,7 +630,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
629630
{
630631
unit: "second",
631632
},
632-
); */
633+
);
633634
quickplayStore.setFindCount(0);
634635
}
635636

@@ -862,15 +863,15 @@ export default function ServerFinder({ hash }: { hash: string }) {
862863
// revisiting site
863864
markSatisfaction();
864865
} else {
865-
/* Sentry.metrics.distribution(
866+
Sentry.metrics.distribution(
866867
"custom.servers.server_refind_time_sec",
867868
(now - quickplayStore.foundTime) / 1000,
868869
{
869870
unit: "second",
870871
},
871872
);
872-
Sentry.metrics.increment("custom.servers.server_refind", 1, {
873-
tags: {
873+
Sentry.metrics.count("custom.servers.server_refind", 1, {
874+
attributes: {
874875
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
875876
matchGroup: quickplayStore.matchGroup,
876877
respawntimes: quickplayStore.respawntimes,
@@ -879,13 +880,13 @@ export default function ServerFinder({ hash }: { hash: string }) {
879880
partysize: quickplayStore.partysize,
880881
pingmode: quickplayStore.pingmode,
881882
},
882-
}); */
883+
});
883884
}
884885
}
885886
}
886887

887-
/* Sentry.metrics.increment("custom.servers.found", 1, {
888-
tags: {
888+
Sentry.metrics.count("custom.servers.found", 1, {
889+
attributes: {
889890
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
890891
matchGroup: quickplayStore.matchGroup,
891892
respawntimes: quickplayStore.respawntimes,
@@ -897,7 +898,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
897898
},
898899
});
899900
Sentry.metrics.distribution("custom.servers.ping", server.ping, {
900-
tags: {
901+
attributes: {
901902
pingmode: quickplayStore.pingmode,
902903
pinglimit: quickplayStore.pinglimit,
903904
searchmode: imFeelingLucky ? 1 : 2,
@@ -908,7 +909,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
908909
"custom.user.pinglimit",
909910
quickplayStore.pinglimit,
910911
{
911-
tags: {
912+
attributes: {
912913
pingmode: quickplayStore.pingmode,
913914
ping: server.ping,
914915
searchmode: imFeelingLucky ? 1 : 2,
@@ -917,21 +918,21 @@ export default function ServerFinder({ hash }: { hash: string }) {
917918
},
918919
);
919920
Sentry.metrics.distribution("custom.servers.players", server.players, {
920-
tags: {
921+
attributes: {
921922
searchmode: imFeelingLucky ? 1 : 2,
922923
},
923-
}); */
924+
});
924925

925926
quickplayStore.setSessionCount(quickplayStore.sessionCount + 1);
926927

927928
if (imFeelingLucky) {
928929
quickplayStore.setFindCount(quickplayStore.findCount + 1);
929930
quickplayStore.setFoundTime(now);
930-
/* Sentry.metrics.distribution(
931+
Sentry.metrics.distribution(
931932
"custom.servers.total_eligible",
932933
filteredServers.length,
933934
{
934-
tags: {
935+
attributes: {
935936
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
936937
matchGroup: quickplayStore.matchGroup,
937938
respawntimes: quickplayStore.respawntimes,
@@ -949,7 +950,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
949950
"custom.servers.total_good",
950951
goodServers.length,
951952
{
952-
tags: {
953+
attributes: {
953954
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
954955
matchGroup: quickplayStore.matchGroup,
955956
respawntimes: quickplayStore.respawntimes,
@@ -964,7 +965,7 @@ export default function ServerFinder({ hash }: { hash: string }) {
964965
Sentry.metrics.distribution(
965966
"custom.user.server_blocks_count",
966967
quickplayStore.blocklist.size,
967-
); */
968+
);
968969
}
969970

970971
finishSearch(imFeelingLucky);
@@ -989,16 +990,16 @@ export default function ServerFinder({ hash }: { hash: string }) {
989990
if (filteredServers.length < 1) {
990991
quickplayStore.setFound(-1);
991992
finishSearch(quickplayStore.searching === 1);
992-
/* Sentry.metrics.increment("no_servers_found", 1, {
993-
tags: {
993+
Sentry.metrics.count("no_servers_found", 1, {
994+
attributes: {
994995
maxPlayerCap: getMaxPlayerIndex(quickplayStore.maxPlayerCap),
995996
matchGroup: quickplayStore.matchGroup,
996997
respawntimes: quickplayStore.respawntimes,
997998
crits: quickplayStore.crits,
998999
rtd: quickplayStore.rtd,
9991000
partysize: quickplayStore.partysize,
10001001
},
1001-
}); */
1002+
});
10021003
return;
10031004
}
10041005

@@ -2013,14 +2014,14 @@ export default function ServerFinder({ hash }: { hash: string }) {
20132014
quickplayStore.addBlocklist(quickplayStore.lastServer.steamid);
20142015
quickplayStore.setFound(0);
20152016
quickplayStore.setPlayNowText("PLAY NOW!");
2016-
/* Sentry.metrics.increment("custom.servers.server_block", 1);
2017+
Sentry.metrics.count("custom.servers.server_block", 1);
20172018
Sentry.metrics.distribution(
20182019
"custom.servers.server_block_time_sec",
20192020
(new Date().getTime() - quickplayStore.foundTime) / 1000,
20202021
{
20212022
unit: "second",
20222023
},
2023-
); */
2024+
);
20242025
if (satisfactionTimer) {
20252026
clearTimeout(satisfactionTimer);
20262027
}
@@ -2043,14 +2044,14 @@ export default function ServerFinder({ hash }: { hash: string }) {
20432044
quickplayStore.addFavorite(quickplayStore.lastServer.steamid);
20442045
quickplayStore.setFound(0);
20452046
quickplayStore.setPlayNowText("PLAY NOW!");
2046-
/* Sentry.metrics.increment("custom.servers.server_fav", 1);
2047+
Sentry.metrics.count("custom.servers.server_fav", 1);
20472048
Sentry.metrics.distribution(
20482049
"custom.servers.server_fav_time",
20492050
(new Date().getTime() - quickplayStore.foundTime) / 1000,
20502051
{
20512052
unit: "second",
20522053
},
2053-
); */
2054+
);
20542055
if (satisfactionTimer) {
20552056
clearTimeout(satisfactionTimer);
20562057
}

0 commit comments

Comments
 (0)