mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-10-30 18:26:45 +00:00
# Conflicts: # api/v1alpha1/casting.go # api/v1alpha1/installation/signoz.go # docs/casting.md # docs/examples/docker/compose/pours/deployment/configs/ingester/opamp.yaml # docs/examples/systemd/binary/pours/deployment/signoz-ingester.service # docs/examples/systemd/binary/pours/deployment/signoz-signoz.service # docs/examples/systemd/binary/pours/deployment/signoz-telemetrystore-migrator.service # docs/schemas/v1alpha1.yaml # internal/foundry/registry.go # internal/instrumentation/handler.go # internal/molding/signozmolding/signoz.go
32 lines
1007 B
Go
32 lines
1007 B
Go
package foundry
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"strings"
|
|
|
|
"github.com/hanzoai/o11y-foundry/api/v1alpha1"
|
|
foundryerrors "github.com/hanzoai/o11y-foundry/internal/errors"
|
|
)
|
|
|
|
func (foundry *Foundry) Gauge(ctx context.Context, machinery v1alpha1.Machinery) error {
|
|
p, err := foundry.newPlanner(ctx, machinery)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
unavailableTools := []string{}
|
|
for _, tooler := range p.Toolers() {
|
|
if err := tooler.Gauge(ctx); err != nil {
|
|
foundry.Logger.ErrorContext(ctx, "tool is not available or cannot be detected properly", slog.String("tool.name", tooler.Name()), foundryerrors.LogAttr(err))
|
|
unavailableTools = append(unavailableTools, tooler.Name())
|
|
continue
|
|
}
|
|
foundry.Logger.InfoContext(ctx, "tool is available", slog.String("tool.name", tooler.Name()))
|
|
}
|
|
if len(unavailableTools) > 0 {
|
|
return foundryerrors.Newf(foundryerrors.TypeNotFound, "tools are not available, please install them and try again: %s", strings.Join(unavailableTools, ", "))
|
|
}
|
|
return nil
|
|
}
|