cleanup log messages.
This commit is contained in:
@@ -32,8 +32,6 @@ func (sr *scrutinyRepository) SaveSmartAttributes(ctx context.Context, wwn strin
|
|||||||
func (sr *scrutinyRepository) GetSmartAttributeHistory(ctx context.Context, wwn string, durationKey string, attributes []string) ([]measurements.Smart, error) {
|
func (sr *scrutinyRepository) GetSmartAttributeHistory(ctx context.Context, wwn string, durationKey string, attributes []string) ([]measurements.Smart, error) {
|
||||||
// Get SMartResults from InfluxDB
|
// Get SMartResults from InfluxDB
|
||||||
|
|
||||||
fmt.Println("GetDeviceDetails from INFLUXDB")
|
|
||||||
|
|
||||||
//TODO: change the filter startrange to a real number.
|
//TODO: change the filter startrange to a real number.
|
||||||
|
|
||||||
// Get parser flux query result
|
// Get parser flux query result
|
||||||
@@ -45,18 +43,13 @@ func (sr *scrutinyRepository) GetSmartAttributeHistory(ctx context.Context, wwn
|
|||||||
|
|
||||||
result, err := sr.influxQueryApi.Query(ctx, queryStr)
|
result, err := sr.influxQueryApi.Query(ctx, queryStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Println("GetDeviceDetails NO EROR")
|
|
||||||
|
|
||||||
// Use Next() to iterate over query result lines
|
// Use Next() to iterate over query result lines
|
||||||
for result.Next() {
|
for result.Next() {
|
||||||
fmt.Println("GetDeviceDetails NEXT")
|
|
||||||
|
|
||||||
// Observe when there is new grouping key producing new table
|
// Observe when there is new grouping key producing new table
|
||||||
if result.TableChanged() {
|
if result.TableChanged() {
|
||||||
//fmt.Printf("table: %s\n", result.TableMetadata().String())
|
//fmt.Printf("table: %s\n", result.TableMetadata().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("DECODINIG TABLE VALUES: %v", result.Record().Values())
|
|
||||||
smartData, err := measurements.NewSmartFromInfluxDB(result.Record().Values())
|
smartData, err := measurements.NewSmartFromInfluxDB(result.Record().Values())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -61,12 +61,7 @@ func NewSmartFromInfluxDB(attrs map[string]interface{}) (*Smart, error) {
|
|||||||
Attributes: map[string]SmartAttribute{},
|
Attributes: map[string]SmartAttribute{},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Prefetched Smart: %v\n", sm)
|
|
||||||
|
|
||||||
//two steps (because we dont know the
|
|
||||||
for key, val := range attrs {
|
for key, val := range attrs {
|
||||||
log.Printf("Found Attribute (%s = %v)\n", key, val)
|
|
||||||
|
|
||||||
switch key {
|
switch key {
|
||||||
case "temp":
|
case "temp":
|
||||||
sm.Temp = val.(int64)
|
sm.Temp = val.(int64)
|
||||||
@@ -100,13 +95,7 @@ func NewSmartFromInfluxDB(attrs map[string]interface{}) (*Smart, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("########NUMBER OF ATTRIBUTES: %v", len(sm.Attributes))
|
log.Printf("Found Smart Device (%s) Attributes (%v)", sm.DeviceWWN, len(sm.Attributes))
|
||||||
log.Printf("########SMART: %v", sm)
|
|
||||||
|
|
||||||
//panic("ERROR HERE.")
|
|
||||||
|
|
||||||
//log.Printf("Sm.Attributes: %v", sm.Attributes)
|
|
||||||
//log.Printf("sm.Attributes[attributeId]: %v", sm.Attributes[attributeId])
|
|
||||||
|
|
||||||
return &sm, nil
|
return &sm, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user