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: remove env logging #3277

Merged
merged 1 commit into from
Nov 11, 2024
Merged
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
17 changes: 0 additions & 17 deletions cmd/collectors/rest/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ import (
"github.com/netapp/harvest/v2/pkg/util"
"github.com/tidwall/gjson"
"log/slog"
"os"
"strconv"
"time"
)

const HoursInMonth = 24 * 30
const ARWSupportedVersion = "9.10.0"

var enableVolumeLogging bool

type Volume struct {
*plugin.AbstractPlugin
currentVal int
Expand Down Expand Up @@ -97,7 +94,6 @@ func (v *Volume) Init() error {
if err != nil {
return fmt.Errorf("unable to get version %w", err)
}
enableVolumeLogging = os.Getenv("ENABLE_VOLUME_LOGGING") != ""
return nil
}

Expand Down Expand Up @@ -139,10 +135,6 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]volumeInfo) {
var err error

if enableVolumeLogging {
v.SLogger.Info("Size of volumeMap", slog.Int("size", len(volumeMap)), slog.Any("volumeMap", volumeMap))
}

cloneSplitEstimateMetric := data.GetMetric("clone_split_estimate")
if cloneSplitEstimateMetric == nil {
if cloneSplitEstimateMetric, err = data.NewMetricFloat64("clone_split_estimate"); err != nil {
Expand All @@ -156,19 +148,13 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo
}

if volume.GetLabel("style") == "flexgroup_constituent" {
if enableVolumeLogging {
v.SLogger.Warn("Setting exportable for flexgroup constituent", slog.String("volume", volume.GetLabel("volume")), slog.Bool("exportable", v.includeConstituents))
}
volume.SetExportable(v.includeConstituents)
}

volume.SetLabel("isHardwareEncrypted", strconv.FormatBool(v.aggrsMap[volume.GetLabel("aggr")]))

if vInfo, ok := volumeMap[volume.GetLabel("volume")+volume.GetLabel("svm")]; ok {
if vInfo.isObjectStoreVolume {
if enableVolumeLogging {
v.SLogger.Warn("Setting exportable for object store volume", slog.String("volume", volume.GetLabel("volume")), slog.Bool("exportable", false))
}
volume.SetExportable(false)
continue
}
Expand All @@ -190,9 +176,6 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo
}
} else {
// The public API does not include node root and temp volumes, while the private CLI does include them. Harvest will exclude them the same as the public API by not exporting them.
if enableVolumeLogging {
v.SLogger.Warn("Setting exportable for excluded volume", slog.String("volume", volume.GetLabel("volume")), slog.Bool("exportable", false))
}
volume.SetExportable(false)
}
}
Expand Down
Loading