PromucFlow_constructor/app/client/src/index.tsx
Vemparala Surya Vamsi 2f6f824efc
chore: frontend and backend telemetry updates for execute flow #28800 and #28805 (#28936)
## Description
1. Added frontend and backend custom OTLP telemetry to track execute
flow
2. Updated end vars in client side code to match with server sdk
intialisation code.

#### PR fixes following issue(s)
Fixes #28800 and #28805

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## 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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-11-24 13:09:02 +05:30

86 lines
2.4 KiB
TypeScript
Executable File

// This file must be executed as early as possible to ensure the preloads are triggered ASAP
import "./preload-route-chunks";
import React from "react";
import "./wdyr";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import "./index.css";
import { ThemeProvider } from "styled-components";
import { appInitializer } from "utils/AppUtils";
import store, { runSagaMiddleware } from "./store";
import { LayersContext, Layers } from "constants/Layers";
import AppRouter from "@appsmith/AppRouter";
import * as Sentry from "@sentry/react";
import { getCurrentThemeDetails } from "selectors/themeSelectors";
import { connect } from "react-redux";
import type { AppState } from "@appsmith/reducers";
import { Toast } from "design-system";
import "./assets/styles/index.css";
import "./polyfills";
import GlobalStyles from "globalStyles";
// enable autofreeze only in development
import { setAutoFreeze } from "immer";
import AppErrorBoundary from "./AppErrorBoundry";
import log from "loglevel";
import { getAppsmithConfigs } from "@appsmith/configs";
const shouldAutoFreeze = process.env.NODE_ENV === "development";
const { newRelic } = getAppsmithConfigs();
setAutoFreeze(shouldAutoFreeze);
runSagaMiddleware();
appInitializer();
const { enableNewRelic } = newRelic;
enableNewRelic &&
(async () => {
try {
await import(
/* webpackChunkName: "otlpTelemetry" */ "./UITelemetry/auto-otel-web.js"
);
} catch (e) {
log.error("Error loading telemetry script", e);
}
})();
function App() {
return (
<Sentry.ErrorBoundary fallback={"An error has occured"}>
<Provider store={store}>
<LayersContext.Provider value={Layers}>
<ThemedAppWithProps />
</LayersContext.Provider>
</Provider>
</Sentry.ErrorBoundary>
);
}
class ThemedApp extends React.Component<{
currentTheme: any;
}> {
render() {
return (
<ThemeProvider theme={this.props.currentTheme}>
<Toast />
<GlobalStyles />
<AppErrorBoundary>
<AppRouter />
</AppErrorBoundary>
</ThemeProvider>
);
}
}
const mapStateToProps = (state: AppState) => ({
currentTheme: getCurrentThemeDetails(state),
});
const ThemedAppWithProps = connect(mapStateToProps)(ThemedApp);
ReactDOM.render(<App />, document.getElementById("root"));
// expose store when run in Cypress
if ((window as any).Cypress) {
(window as any).store = store;
}