Skip to content

Commit f370915

Browse files
committed
feat: use dimensions on metrics that use a postfix in their name
1 parent 08748db commit f370915

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

application/src/main/java/org/togetherjava/tjbot/features/code/CodeMessageHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void onButtonClick(ButtonInteractionEvent event, List<String> args) {
188188
CodeFence code = extractCodeOrFallback(originalMessage.get().getContentRaw());
189189

190190
// Apply the selected action
191-
metrics.count("code_action-" + codeAction.getLabel());
191+
metrics.count("code_action", Map.of("name", codeAction.getLabel()));
192192
return event.getHook()
193193
.editOriginalEmbeds(codeAction.apply(code))
194194
.setActionRow(createButtons(originalMessageId, codeAction));

application/src/main/java/org/togetherjava/tjbot/features/help/AutoPruneHelperRoutine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private void pruneRoleIfFull(List<Member> members, Role targetRole,
112112

113113
if (isRoleFull(withRole)) {
114114
logger.debug("Helper role {} is full, starting to prune.", targetRole.getName());
115-
metrics.count("autoprune_helper-" + targetRole.getName());
115+
metrics.count("autoprune_helper", Map.of("role", targetRole.getName()));
116116
pruneRole(targetRole, withRole, selectRoleChannel, when);
117117
}
118118
}

application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private void changeCategory(SlashCommandInteractionEvent event, ThreadChannel he
162162
event.deferReply().queue();
163163
refreshCooldownFor(Subcommand.CHANGE_CATEGORY, helpThread);
164164

165-
metrics.count("help-category-" + category);
165+
metrics.count("help-category", Map.of("category", category));
166166
helper.changeChannelCategory(helpThread, category)
167167
.flatMap(_ -> sendCategoryChangedMessage(helpThread.getGuild(), event.getHook(),
168168
helpThread, category))

application/src/main/java/org/togetherjava/tjbot/features/tags/TagCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.ArrayList;
2929
import java.util.Collection;
3030
import java.util.List;
31+
import java.util.Map;
3132
import java.util.Objects;
3233
import java.util.Optional;
3334
import java.util.Set;
@@ -91,7 +92,7 @@ public void onSlashCommand(SlashCommandInteractionEvent event) {
9192
if (tagSystem.handleIsUnknownTag(id, event)) {
9293
return;
9394
}
94-
metrics.count("tag-" + id);
95+
metrics.count("tag", Map.of("id", id));
9596

9697
String tagContent = tagSystem.getTag(id).orElseThrow();
9798
MessageEmbed contentEmbed = new EmbedBuilder().setDescription(tagContent)

application/src/main/java/org/togetherjava/tjbot/features/tophelper/TopHelpersAssignmentRoutine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private void manageTopHelperRole(Collection<? extends Member> currentTopHelpers,
260260
}
261261

262262
for (long topHelperUserId : selectedTopHelperIds) {
263-
metrics.count("top_helper-" + topHelperUserId);
263+
metrics.count("top_helper", Map.of("userId", topHelperUserId));
264264
}
265265
reportRoleManageSuccess(event);
266266
}

0 commit comments

Comments
 (0)