From 9403dfb544e54a8b6d556842029a2628f1dec507 Mon Sep 17 00:00:00 2001 From: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:10:39 +0530 Subject: [PATCH] chore: allow plugin name for action execute metrics (#39664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 0637c1dd369324a612975c40f7fe896c86bdcc32 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Tue, 11 Mar 2025 12:05:06 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Refactor** - Streamlined the processing of system metrics by refining tag management. This update ensures that only the pertinent monitoring information is retained, contributing to more consistent and reliable performance data. --- .../configurations/NoTagsMeterFilter.java | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/NoTagsMeterFilter.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/NoTagsMeterFilter.java index d2011eb319..93f032b5e1 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/NoTagsMeterFilter.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/NoTagsMeterFilter.java @@ -1,30 +1,39 @@ package com.appsmith.server.configurations; import io.micrometer.core.instrument.Meter; +import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.config.MeterFilter; import java.util.List; +import java.util.Map; public class NoTagsMeterFilter implements MeterFilter { - private static final List seriesExceptionList = List.of( - "appsmith.total.plugin.execution", "appsmith.total.server.execution", "appsmith.get.datasource.context"); + private static final Map> seriesExceptionMap = Map.of( + "appsmith.total.plugin.execution", List.of("plugin"), + "appsmith.total.server.execution", List.of("plugin"), + "appsmith.get.datasource.context", List.of("plugin")); @Override public Meter.Id map(Meter.Id id) { // Remove all tags from the metric - if (id.getName().startsWith("appsmith") && !startsWithPrefix(id.getName())) { - return id.replaceTags(Tags.empty()); - } - return id; - } + if (id.getName().startsWith("appsmith")) { + List allowedTags = seriesExceptionMap.get(id.getName()); - private boolean startsWithPrefix(String metricName) { - for (String prefix : seriesExceptionList) { - if (metricName.startsWith(prefix)) { - return true; + if (allowedTags != null) { + Tags filteredTags = Tags.empty(); + for (Tag tag : id.getTags()) { + if (allowedTags.contains(tag.getKey())) { + filteredTags = filteredTags.and(tag); + } + } + return id.replaceTags(filteredTags); + } else { + // Remove all tags for other metrics + return id.replaceTags(Tags.empty()); } + } else { + return id; } - return false; } }