Files
zeekay 4e3a8ef9ca merge: upstream/main (preserve Hanzo brand, 50 commits)
# 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
2026-06-02 09:59:25 -07:00

42 lines
1.1 KiB
Go

package main
import (
"context"
"log/slog"
foundryerrors "github.com/hanzoai/o11y-foundry/internal/errors"
"github.com/hanzoai/o11y-foundry/internal/foundry"
"github.com/hanzoai/o11y-foundry/internal/instrumentation"
"github.com/spf13/cobra"
)
func registerGaugeCmd(rootCmd *cobra.Command) {
gaugeCmd := &cobra.Command{
Use: "gauge",
Short: "Gauge whether required tools are available.",
RunE: recoverRunE(domain.EventGauge, func(cmd *cobra.Command, args []string) (domain.Properties, error) {
return runGauge(cmd.Context(), rootLogger, commonCfg.File)
}),
}
rootCmd.AddCommand(gaugeCmd)
}
func runGauge(ctx context.Context, logger *slog.Logger, path string) (domain.Properties, error) {
foundry, err := foundry.New(logger)
if err != nil {
logger.ErrorContext(ctx, "failed to create foundry, please report this issues to developers at https://github.com/hanzoai/o11y-foundry/issues", foundryerrors.LogAttr(err))
return err
}
casting, err := foundry.Config.GetV1Alpha1(ctx, path)
if err != nil {
return domain.NewProperties(), err
}
props := casting.TrackableProperties()
err = foundry.Gauge(ctx, casting)
return props, err
}