Skip to content

Commit

Permalink
add apm for production
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyManetov committed Sep 25, 2023
1 parent e628900 commit 41714e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"react-router": "6.14.0",
"react-router-dom": "6.14.0",
"remark-gfm": "3.0.1",
"slate": "0.82.0"
"@elastic/apm-rum": "5.14.0"
},
"browserslist": {
"production": [
Expand Down
16 changes: 12 additions & 4 deletions app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { render } from 'react-dom';
import { RouterProvider } from 'react-router';
import { createBrowserRouter } from 'react-router-dom';
import {
UuiContexts,
Router6AdaptedRouter,
useUuiServices,
DragGhost,
UuiContexts, Router6AdaptedRouter, useUuiServices, DragGhost,
UuiContext, GAListener, IProcessRequest,
} from '@epam/uui-core';
import { Snackbar, Modals, PortalRoot } from '@epam/uui-components';
Expand All @@ -18,6 +15,7 @@ import { getApi, TApi } from './data';
import '@epam/internal/styles.css';
import '@epam/assets/theme/theme_vanilla_thunder.scss';
import './index.module.scss';
import { init as initApm } from '@elastic/apm-rum';

const router6 = createBrowserRouter([
{ path: '*', element: <App /> },
Expand All @@ -35,6 +33,16 @@ function apiDefinition(processRequest: IProcessRequest) {
return getApi({ processRequest, fetchOptions: { credentials: undefined } });
}

const apm = initApm({
serviceName: 'uui-ui',
serverUrl: isProduction ? 'https://apm.app.epam.com' : 'https://apm-sandbox.cloudapp.epam.com/',
serviceVersion: __COMMIT_HASH__,
environment: isProduction ? 'prod' : 'qa',
breakdownMetrics: true,
transactionSampleRate: 0.2,
});
apm.addLabels({ project: 'epm-uui', service_type: 'ui' });

function UuiEnhancedApp() {
const [isLoaded, setIsLoaded] = React.useState(false);
const { services } = useUuiServices<TApi, UuiContexts>({ apiDefinition, router, skinContext });
Expand Down

0 comments on commit 41714e9

Please sign in to comment.