1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

feat: add CR id to plausible events (#6035)

Added conflict count to CR metrics and CR id.

Something to think about:
There was idea that we can aggregate this data based on CR id, but CR id
is just a number from 0 to x. So it will not be unique across instances.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
This commit is contained in:
Jaanus Sellin 2024-01-30 10:38:39 +02:00 committed by GitHub
parent 46fb40ca08
commit 2643ac1356
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -34,7 +34,6 @@ import {
ChangeRequestRejectScheduledDialogue,
} from './ChangeRequestScheduledDialogs/changeRequestScheduledDialogs';
import { ScheduleChangeRequestDialog } from './ChangeRequestScheduledDialogs/ScheduleChangeRequestDialog';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { PlausibleChangeRequestState } from '../changeRequest.types';
const StyledAsideBox = styled(Box)(({ theme }) => ({
@ -105,7 +104,6 @@ export const ChangeRequestOverview: FC = () => {
const { isChangeRequestConfiguredForReview } =
useChangeRequestsEnabled(projectId);
const scheduleChangeRequests = useUiFlag('scheduledConfigurationChanges');
const { trackEvent } = usePlausibleTracker();
if (!changeRequest) {
return null;

View File

@ -1,6 +1,8 @@
import useAPI from '../useApi/useApi';
import { usePlausibleTracker } from '../../../usePlausibleTracker';
import { PlausibleChangeRequestState } from 'component/changeRequest/changeRequest.types';
import { getUniqueChangeRequestId } from 'utils/unique-change-request-id';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
export interface IChangeSchema {
feature: string | null;
@ -30,6 +32,7 @@ export const useChangeRequestApi = () => {
const { makeRequest, createRequest, errors, loading } = useAPI({
propagateErrors: true,
});
const { uiConfig } = useUiConfig();
const addChange = async (
project: string,
@ -72,6 +75,7 @@ export const useChangeRequestApi = () => {
props: {
eventType: payload.state,
previousState,
id: getUniqueChangeRequestId(uiConfig, changeRequestId),
},
});

View File

@ -0,0 +1,10 @@
import { IUiConfig } from 'interfaces/uiConfig';
export const getUniqueChangeRequestId = (
uiConfig: Pick<IUiConfig, 'baseUriPath' | 'versionInfo'>,
changeRequestId: number,
) => {
return `${
uiConfig.baseUriPath || uiConfig.versionInfo?.instanceId
}/change-requests/${changeRequestId}?version=${uiConfig.versionInfo}`;
};