Skip to content

Commit

Permalink
Add tracking for selected routing option
Browse files Browse the repository at this point in the history
  • Loading branch information
grotlue committed Jan 13, 2025
1 parent 2b4b6ca commit b732556
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import { useEffect, useState, useMemo } from 'react';
import styled, { css } from 'styled-components';
import type { UseMutationResult } from '@tanstack/react-query';

import useSendTelemetry from 'logic/telemetry/useSendTelemetry';
import useLocation from 'routing/useLocation';
import { getPathnameWithoutId } from 'util/URLUtils';
import { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';
import useSetupInputMutations from 'components/inputs/InputSetupWizard/hooks/useSetupInputMutations';
import { InputStatesStore } from 'stores/inputs/InputStatesStore';
import { Button, Row, Col } from 'components/bootstrap';
Expand Down Expand Up @@ -55,6 +59,9 @@ const ButtonCol = styled(Col)(({ theme }) => css`
export type ProcessingSteps = 'createStream' | 'startStream' | 'createPipeline' | 'setupRouting' | 'deleteStream' | 'deletePipeline' | 'deleteRouting' | 'result';

const StartInputStep = () => {
const sendTelemetry = useSendTelemetry();
const { pathname } = useLocation();
const telemetryPathName = useMemo(() => getPathnameWithoutId(pathname), [pathname]);
const { goToPreviousStep, goToNextStep, orderedSteps, activeStep, wizardData, stepsConfig } = useInputSetupWizard();
const { stepsData } = useInputSetupWizardSteps();
const hasPreviousStep = checkHasPreviousStep(orderedSteps, activeStep);
Expand Down Expand Up @@ -139,6 +146,15 @@ const StartInputStep = () => {

const setupInput = async () => {
const routingStepData = getStepConfigOrData(stepsData, INPUT_WIZARD_STEPS.SETUP_ROUTING) as RoutingStepData;

sendTelemetry(
TELEMETRY_EVENT_TYPE.INPUT_SETUP_WIZARD.START_INPUT,
{
app_pathname: telemetryPathName,
app_action_value: 'click-input-setup-wizard-start-input',
chosen_routing_option: routingStepData?.streamType ?? 'UNKNOWN',
});

const { input } = wizardData;
const inputId = input?.id;

Expand Down
3 changes: 3 additions & 0 deletions graylog2-web-interface/src/logic/telemetry/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ export const TELEMETRY_EVENT_TYPE = {
INPUT_STOP_CLICKED: 'Inputs Input Stop Clicked',
INPUT_SETUP_CLICKED: 'Inputs Input Setup Clicked',
},
INPUT_SETUP_WIZARD: {
START_INPUT: 'Input Setup Wizard Start Inpput Clicked',
},
OUTPUTS: {
OUTPUT_CREATED: 'Outputs Output Created',
OUTPUT_ASSIGNED: 'Outputs Output Assigned',
Expand Down

0 comments on commit b732556

Please sign in to comment.