Skip to content

Commit

Permalink
chore: move flagging location to lowest possible point - we safe now
Browse files Browse the repository at this point in the history
  • Loading branch information
hoorayimhelping committed Jun 18, 2020
1 parent f8d44d7 commit a834d18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ui/src/cloud/apis/reporting.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

export interface Point {
measurement: string
fields: PointFields
Expand All @@ -19,6 +21,9 @@ export interface Points {
}

export const reportPoints = (points: Points) => {
if (!isFlagEnabled('appMetrics')) {
return
}
try {
const url = '/api/v2/app-metrics'
return fetch(url, {
Expand Down
6 changes: 0 additions & 6 deletions ui/src/cloud/utils/reporting.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {useState, useEffect} from 'react'

import {isFlagEnabled} from 'src/shared/utils/featureFlag'

import {
reportPoints as reportPointsAPI,
Point,
Expand All @@ -25,10 +23,6 @@ export const updateReportingContext = (key: string, value: string) => {
}

export const reportEvent = ({timestamp, measurement, fields, tags}: Point) => {
if (!isFlagEnabled('appMetrics')) {
return
}

reportingPoints.push({
measurement,
tags: {...reportingTags, ...tags},
Expand Down

0 comments on commit a834d18

Please sign in to comment.