chore: allow plugin name for action execute metrics (#39664)
## 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" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13786257072> > Commit: 0637c1dd369324a612975c40f7fe896c86bdcc32 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13786257072&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Tue, 11 Mar 2025 12:05:06 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
c93a8d84cf
commit
9403dfb544
|
|
@ -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<String> seriesExceptionList = List.of(
|
||||
"appsmith.total.plugin.execution", "appsmith.total.server.execution", "appsmith.get.datasource.context");
|
||||
private static final Map<String, List<String>> 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<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user