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

refactor(hostd): remove unused logs API #857

Merged
merged 1 commit into from
Dec 17, 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
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
Loading