Skip to content

Commit

Permalink
refactor(hostd): remove unused logs API
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Dec 17, 2024
1 parent c78b0e9 commit 2fe6eb7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 172 deletions.
7 changes: 7 additions & 0 deletions .changeset/nice-walls-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/hostd-js': minor
'@siafoundation/hostd-react': minor
'@siafoundation/hostd-types': minor
---

Remove logs search API.
122 changes: 0 additions & 122 deletions apps/hostd/components/Node/Logs.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions libs/hostd-js/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import {
IndexTipParams,
IndexTipPayload,
IndexTipResponse,
LogsSearchParams,
LogsSearchPayload,
LogsSearchResponse,
MetricsParams,
MetricsPayload,
MetricsPeriodParams,
Expand Down Expand Up @@ -99,7 +96,6 @@ import {
contractsIdIntegrityRoute,
contractsRoute,
indexTipRoute,
logEntriesRoute,
metricsIntervalRoute,
metricsRoute,
settingsAnnounceRoute,
Expand Down Expand Up @@ -264,11 +260,6 @@ export function Hostd({ api, password }: { api: string; password?: string }) {
SystemDirectoryCreatePayload,
SystemDirectoryCreateResponse
>(axios, 'put', systemDirRoute),
logsSearch: buildRequestHandler<
LogsSearchParams,
LogsSearchPayload,
LogsSearchResponse
>(axios, 'post', logEntriesRoute),
alerts: buildRequestHandler<AlertsParams, AlertsPayload, AlertsResponse>(
axios,
'get',
Expand Down
16 changes: 0 additions & 16 deletions libs/hostd-react/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import {
SettingsPinnedUpdateParams,
SettingsPinnedUpdatePayload,
SettingsPinnedUpdateResponse,
LogsSearchParams,
LogsSearchPayload,
LogsSearchResponse,
MetricsParams,
MetricsPeriodParams,
MetricsPeriodResponse,
Expand Down Expand Up @@ -90,7 +87,6 @@ import {
alertsRoute,
contractsIdIntegrityRoute,
contractsRoute,
logEntriesRoute,
metricsIntervalRoute,
metricsRoute,
settingsAnnounceRoute,
Expand Down Expand Up @@ -500,18 +496,6 @@ export function useSystemDirectoryCreate(
return usePutFunc({ ...args, route: systemDirRoute })
}

// logs

export function useLogsSearch(
args: HookArgsWithPayloadSwr<
LogsSearchParams,
LogsSearchPayload,
LogsSearchResponse
>
) {
return usePostSwr({ ...args, route: logEntriesRoute })
}

// alerts

export function useAlerts(args?: HookArgsSwr<AlertsParams, AlertsResponse>) {
Expand Down
25 changes: 0 additions & 25 deletions libs/hostd-types/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const volumesIdRoute = '/volumes/:id'
export const volumesIdResizeRoute = '/volumes/:id/resize'
export const volumesIdCancelRoute = '/volumes/:id/cancel'
export const systemDirRoute = '/system/dir'
export const logEntriesRoute = '/log/entries'
export const alertsRoute = '/alerts'
export const alertsDismissRoute = '/alerts/dismiss'

Expand Down Expand Up @@ -522,34 +521,10 @@ export type SystemDirectoryResponse = {
freeBytes: number
directories: string[]
}

export type SystemDirectoryCreateParams = void
export type SystemDirectoryCreatePayload = { path: string }
export type SystemDirectoryCreateResponse = void

// logs

type LogEntry = {
timestamp: string
level: string
name: string
caller: string
message: string
fields: Record<string, unknown>
}

export type LogsSearchParams = void
export type LogsSearchPayload = {
names?: string[]
callers?: string[]
levels?: string[]
before?: string
after?: string
limit?: number
offset?: number
}
export type LogsSearchResponse = { count: number; entries: LogEntry[] }

// alerts

export type AlertSeverity = 'info' | 'warning' | 'error' | 'critical'
Expand Down

0 comments on commit 2fe6eb7

Please sign in to comment.