Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Removed spring security and redis traces #24758

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_;

public final class ActionSpan {

// Action execution spans
public static final String ACTION_EXECUTION_REQUEST_PARSING = APPSMITH_ + "request.parsing";
public static final String ACTION_EXECUTION_CACHED_DATASOURCE = APPSMITH_ + "get.datasource.cached";
public static final String ACTION_EXECUTION_DATASOURCE_CONTEXT = APPSMITH_ + "get.datasource.context";
public static final String ACTION_EXECUTION_EDITOR_CONFIG = APPSMITH_ + "get.editorConfig.cached";
public static final String ACTION_EXECUTION_PLUGIN_EXECUTION = APPSMITH_ + "total.plugin.execution";
public static final String ACTION_EXECUTION_SERVER_EXECUTION = APPSMITH_ + "total.server.execution";

// Getter spans
public static final String GET_UNPUBLISHED_ACTION = APPSMITH_ + "get.action.unpublished";
public static final String GET_VIEW_MODE_ACTION = APPSMITH_ + "get.action.viewmode";
public static final String GET_ACTION_REPOSITORY_CALL = APPSMITH_ + "get.action.repository.call";


}

This file was deleted.

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_ = "appsmith.";
nidhi-nair marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_PLUGIN_EXECUTION;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_PLUGIN_EXECUTION;
import static com.appsmith.external.helpers.PluginUtils.getHintMessageForLocalhostUrl;
import static org.springframework.util.CollectionUtils.isEmpty;

Expand Down
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_;

/**
* 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_)) {
// A span is either an http server request root or Appsmith specific
return true;
} else {
return false;
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.appsmith.external.constants.spans.ActionSpans.GET_ACTION_REPOSITORY_CALL;
import static com.appsmith.external.constants.spans.ActionSpans.GET_UNPUBLISHED_ACTION;
import static com.appsmith.external.constants.spans.ActionSpans.GET_VIEW_MODE_ACTION;
import static com.appsmith.external.constants.spans.ActionSpan.GET_ACTION_REPOSITORY_CALL;
import static com.appsmith.external.constants.spans.ActionSpan.GET_UNPUBLISHED_ACTION;
import static com.appsmith.external.constants.spans.ActionSpan.GET_VIEW_MODE_ACTION;
import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNewFieldValuesIntoOldObject;
import static com.appsmith.external.helpers.PluginUtils.setValueSafelyInFormData;
import static com.appsmith.server.acl.AclPermission.EXECUTE_DATASOURCES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
import java.util.stream.Collectors;

import static com.appsmith.external.constants.CommonFieldName.REDACTED_DATA;
import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_CACHED_DATASOURCE;
import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_DATASOURCE_CONTEXT;
import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_EDITOR_CONFIG;
import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_REQUEST_PARSING;
import static com.appsmith.external.constants.spans.ActionSpans.ACTION_EXECUTION_SERVER_EXECUTION;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_CACHED_DATASOURCE;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_DATASOURCE_CONTEXT;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_EDITOR_CONFIG;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_REQUEST_PARSING;
import static com.appsmith.external.constants.spans.ActionSpan.ACTION_EXECUTION_SERVER_EXECUTION;
import static com.appsmith.external.helpers.DataTypeStringUtils.getDisplayDataTypes;
import static com.appsmith.server.helpers.WidgetSuggestionHelper.getSuggestedWidgets;
import static java.lang.Boolean.FALSE;
Expand Down