-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Removed spring security and redis traces (#24758)
## Description Adds a filter for http endpoints that are recorded in our traces. We have discarded the actuator endpoints since we don't care about their metrics. We have also filtered spans to only contain the ones that we have manually declared across the project. All spans need to use the `appsmith.` prefix to pass through this filter. This change discards spring security and redis spans as of today. Fixes #24757 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) > ## Testing > #### How Has This Been Tested? - [x] Manual > > ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag
- Loading branch information
1 parent
5e46a2f
commit 895ef52
Showing
7 changed files
with
91 additions
and
30 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...r/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ActionSpan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.appsmith.external.constants.spans; | ||
|
||
import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX; | ||
|
||
public final class ActionSpan { | ||
|
||
// Action execution spans | ||
public static final String ACTION_EXECUTION_REQUEST_PARSING = APPSMITH_SPAN_PREFIX + "request.parsing"; | ||
public static final String ACTION_EXECUTION_CACHED_DATASOURCE = APPSMITH_SPAN_PREFIX + "get.datasource.cached"; | ||
public static final String ACTION_EXECUTION_DATASOURCE_CONTEXT = APPSMITH_SPAN_PREFIX + "get.datasource.context"; | ||
public static final String ACTION_EXECUTION_EDITOR_CONFIG = APPSMITH_SPAN_PREFIX + "get.editorConfig.cached"; | ||
public static final String ACTION_EXECUTION_PLUGIN_EXECUTION = APPSMITH_SPAN_PREFIX + "total.plugin.execution"; | ||
public static final String ACTION_EXECUTION_SERVER_EXECUTION = APPSMITH_SPAN_PREFIX + "total.server.execution"; | ||
|
||
// Getter spans | ||
public static final String GET_UNPUBLISHED_ACTION = APPSMITH_SPAN_PREFIX + "get.action.unpublished"; | ||
public static final String GET_VIEW_MODE_ACTION = APPSMITH_SPAN_PREFIX + "get.action.viewmode"; | ||
public static final String GET_ACTION_REPOSITORY_CALL = APPSMITH_SPAN_PREFIX + "get.action.repository.call"; | ||
|
||
|
||
} |
21 changes: 0 additions & 21 deletions
21
.../appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/ActionSpans.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...ver/appsmith-interfaces/src/main/java/com/appsmith/external/constants/spans/BaseSpan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.appsmith.external.constants.spans; | ||
|
||
public class BaseSpan { | ||
public static final String APPSMITH_SPAN_PREFIX = "appsmith."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...erver/appsmith-server/src/main/java/com/appsmith/server/configurations/TracingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.appsmith.server.configurations; | ||
|
||
import io.micrometer.observation.Observation; | ||
import io.micrometer.observation.ObservationPredicate; | ||
import io.micrometer.observation.ObservationView; | ||
import io.micrometer.tracing.Span; | ||
import io.micrometer.tracing.exporter.SpanExportingPredicate; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.server.reactive.observation.ServerRequestObservationContext; | ||
|
||
import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX; | ||
|
||
/** | ||
* This configuration file creates beans that are required to filter just Appsmith specific spans | ||
*/ | ||
@Configuration | ||
public class TracingConfig { | ||
|
||
private Observation.Context getRoot(Observation.Context current) { | ||
ObservationView parent = current.getParentObservation(); | ||
if (parent == null) { | ||
return current; | ||
} else { | ||
return getRoot((Observation.Context) parent.getContextView()); | ||
} | ||
} | ||
|
||
@Bean | ||
ObservationPredicate noActuatorServerObservations() { | ||
return (name, context) -> { | ||
Observation.Context root = getRoot(context); | ||
if (root instanceof ServerRequestObservationContext serverContext) { | ||
// For endpoint spans, which would be the parent for the trace, | ||
// ignore actuator endpoints | ||
// This gets rid of the prometheus calls as well as the health check | ||
return !serverContext.getCarrier().getPath().value().startsWith("/actuator"); | ||
} else { | ||
return true; | ||
} | ||
}; | ||
} | ||
|
||
@Bean | ||
SpanExportingPredicate onlyAppsmithSpans() { | ||
return (finishedSpan) -> { | ||
if ((finishedSpan.getKind() != null && finishedSpan.getKind().equals(Span.Kind.SERVER)) | ||
|| finishedSpan.getName().startsWith(APPSMITH_SPAN_PREFIX)) { | ||
// A span is either an http server request root or Appsmith specific | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters