mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-10-30 18:26:45 +00:00
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package clickhousetooler
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/hanzoai/o11y-foundry/internal/errors"
|
|
root "github.com/hanzoai/o11y-foundry/internal/tooler"
|
|
)
|
|
|
|
var _ root.Tooler = (*clickhouseTooler)(nil)
|
|
|
|
type clickhouseTooler struct{}
|
|
|
|
func New() *clickhouseTooler {
|
|
return &clickhouseTooler{}
|
|
}
|
|
|
|
func (tooler *clickhouseTooler) Name() string {
|
|
return "clickhouse"
|
|
}
|
|
|
|
func (tooler *clickhouseTooler) Gauge(ctx context.Context) error {
|
|
// Check if clickhouse-server command is available
|
|
if err := root.ExecChecker(ctx, "clickhouse-server"); err == nil {
|
|
return nil
|
|
}
|
|
|
|
// Fallback: check if the binary exists at the standard location
|
|
binaryPath := "/usr/bin/clickhouse-server"
|
|
if _, err := os.Stat(binaryPath); err == nil {
|
|
return nil
|
|
}
|
|
|
|
return errors.Newf(errors.TypeNotFound, "clickhouse-server not found: neither command nor binary at %s", binaryPath)
|
|
}
|
|
|
|
func (tooler *clickhouseTooler) Install(ctx context.Context) error {
|
|
// ClickHouse is typically installed via package manager
|
|
// Installation instructions would depend on the OS distribution
|
|
return nil
|
|
}
|