:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { HealthCheckResult, HealthCheckResultError, HealthCheckResultOk, PluginServerService } from '../../../types'
import { HogInvocationResultsService } from '../monitoring/hog-invocation-results.service'
import { CyclotronV2Janitor } from './janitor'
import { CyclotronV2JanitorConfig } from './types'
export class CyclotronV2JanitorService {
private janitor: CyclotronV2Janitor
constructor(config: CyclotronV2JanitorConfig, invocationResults?: HogInvocationResultsService) {
this.janitor = new CyclotronV2Janitor(config, invocationResults)
}
async start(): Promise<void> {
// Validates the DB connection and starts the cleanup interval
await this.janitor.start()
}
async stop(): Promise<void> {
await this.janitor.stop()
}
isHealthy(): HealthCheckResult {
if (!this.janitor.isRunning()) {
return new HealthCheckResultError('CyclotronV2Janitor interval is not running', {})
}
return new HealthCheckResultOk()
}
get service(): PluginServerService {
return {
id: 'cdp-cyclotron-v2-janitor',
onShutdown: async () => await this.stop(),
healthcheck: () => this.isHealthy(),
}
}
}