Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup unused methods and dependencies; change remove front-end env var #1

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions app/api/pelorus-api.jsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,9 @@
import { getDaysBetweenDates } from '@/lib/date-funcs';

// Get initial list of Apps that Pelorus has data for
export async function getApps() {
const response = await fetch(`${process.env.NEXT_PUBLIC_PELORUS_API_URL}/sdp/apps?range=1w`)
const response = await fetch(`${process.env.PELORUS_API_URL}/sdp/apps?range=1w`)
if (!response.ok) {
throw new Error('Failed to fetch list of Apps from Pelorus')
}
return response.json()
}

// Lead time for change
export async function fetchLeadTimeForChangeData(appName, dateRange) {
const req = `${process.env.PELORUS_API_URL}/sdp/lead_time_for_change/${appName}/data?range=${getDaysBetweenDates(dateRange)}d&start=${dateRange.to.getTime() / 1000}`;
console.log(req)
const response = await fetch(req);

if (!response.ok) {
throw new Error("Failed to fetch Lead Time for Change data");
}

const data = await response.json();
return data.sort((d1, d2) => (d1.timestamp > d2.timestamp) ? 1 : (d1.timestamp < d2.timestamp) ? -1 : 0);
}

// Change Failure Rate
export async function fetchChangeFailureRateData(appName, dateRange) {
const req = `${process.env.PELORUS_API_URL}/sdp/change_failure_rate/${appName}/data?range=${getDaysBetweenDates(dateRange)}d&start=${Math.floor(dateRange.to.getTime() / 1000)}`;
console.log(req)
const response = await fetch(req);

if (!response.ok) {
throw new Error("Failed to fetch Change Failure Rate data");
}

const data = await response.json();
return data.sort((d1, d2) => (d1.timestamp > d2.timestamp ? 1 : d1.timestamp < d2.timestamp ? -1 : 0));
}

export function getDORA(appName) {

const dora = {mttr: 0, cfr: 0, df: 0, ltfc: 0}
const cfr = getCFR(appName)
dora.cfr = cfr.cfr
const df = getDF(appName)
dora.df = df.df
const mttr = getMTTR(appName)
dora.mttr = mttr.mttr
const ltfc = getLTFC(appName)
dora.ltfc = ltfc.ltfc
return dora
}
1 change: 0 additions & 1 deletion app/dashboard/change-failure-rate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getDaysBetweenDates } from '@/lib/date-funcs';
import { TabsTrigger } from "@/components/ui/tabs";
import { ChangeFailureRateTabTrigger } from '@/components/change-failure-rate/tab-trigger';


Expand Down
1 change: 0 additions & 1 deletion app/dashboard/lead-time-for-change.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getDaysBetweenDates } from '@/lib/date-funcs';
import { TabsTrigger } from "@/components/ui/tabs";
import { LeadTimeForChangeTabTrigger } from '@/components/lead-time-for-change/tab-trigger';


Expand Down
1 change: 0 additions & 1 deletion app/dashboard/mean-time-to-restore.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getDaysBetweenDates } from '@/lib/date-funcs';
import { TabsTrigger } from "@/components/ui/tabs";
import { MeanTimeToRestoreTabTrigger } from '@/components/mean-time-to-restore/tab-trigger';


Expand Down
Loading