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: span push and sentry logs #36682

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion app/client/src/ce/sagas/userSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ import type {
} from "reducers/uiReducers/usersReducer";
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";

import * as Sentry from "@sentry/react";
import { Severity } from "@sentry/react";
export function* createUserSaga(
action: ReduxActionWithPromise<CreateUserRequest>,
) {
Expand Down Expand Up @@ -129,6 +130,12 @@ export function* createUserSaga(
error,
},
});
Sentry.captureException("Sign up failed", {
level: Severity.Error,
extra: {
error: error,
},
});
}
}

Expand Down
9 changes: 8 additions & 1 deletion app/client/src/pages/UserAuth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ import Helmet from "react-helmet";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHTMLPageTitle } from "ee/utils/BusinessFeatures/brandingPageHelpers";

import * as Sentry from "@sentry/react";
import { Severity } from "@sentry/react";
const validate = (values: LoginFormValues, props: ValidateProps) => {
const errors: LoginFormValues = {};
const email = values[LOGIN_FORM_EMAIL_FIELD_NAME] || "";
Expand Down Expand Up @@ -113,6 +114,12 @@ export function Login(props: LoginFormProps) {
if (queryParams.get("error")) {
errorMessage = queryParams.get("message") || queryParams.get("error") || "";
showError = true;
Sentry.captureException("Login failed", {
level: Severity.Error,
extra: {
error: new Error(errorMessage),
},
});
}

let loginURL = "/api/v1/" + LOGIN_SUBMIT_PATH;
Expand Down
8 changes: 8 additions & 0 deletions app/client/src/pages/UserAuth/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getHTMLPageTitle } from "ee/utils/BusinessFeatures/brandingPageHelpers";
import log from "loglevel";
import { SELF_HOSTING_DOC } from "constants/ThirdPartyConstants";
import * as Sentry from "@sentry/react";
import { Severity } from "@sentry/react";

declare global {
interface Window {
Expand Down Expand Up @@ -133,6 +135,12 @@ export function SignUp(props: SignUpFormProps) {
if (queryParams.get("error")) {
errorMessage = queryParams.get("error") || "";
showError = true;
Sentry.captureException("Sign up failed", {
level: Severity.Error,
extra: {
error: new Error(errorMessage),
},
});
}

const signupURL = new URL(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ public class BaseSpan {
public static final String GIT_SPAN_PREFIX = "git.";

public static final String APPLICATION_SPAN_PREFIX = "application.";

public static final String AUTHENTICATE = "authenticate";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use more specific strings here? Just to make sure we know exactly what we're tracking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have added general because i want to collect all authenticate related spans. tell me if all authenticate spans will be authenticate usernamepassword. this one we get with form login @nidhi-nair

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, may be we'll know more as we gather data. Let's go ahead with this for now.


public static final String AUTHORIZE = "authorize";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.springframework.http.server.reactive.observation.ServerRequestObservationContext;

import static com.appsmith.external.constants.spans.BaseSpan.APPSMITH_SPAN_PREFIX;
import static com.appsmith.external.constants.spans.BaseSpan.AUTHENTICATE;
import static com.appsmith.external.constants.spans.BaseSpan.AUTHORIZE;

/**
* This configuration file creates beans that are required to filter just Appsmith specific spans
Expand Down Expand Up @@ -45,8 +47,10 @@ ObservationPredicate noActuatorServerObservations() {
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
|| finishedSpan.getName().startsWith(APPSMITH_SPAN_PREFIX)
|| finishedSpan.getName().startsWith(AUTHENTICATE)
|| finishedSpan.getName().startsWith(AUTHORIZE)) {
// A span is either an http server request root or Appsmith specific or login related or signup related
return true;
} else {
return false;
Expand Down
Loading