From afaa6a475cfcf9e7c98f2aa6a1a42142b677f175 Mon Sep 17 00:00:00 2001 From: StewartJingga Date: Sun, 12 Sep 2021 19:57:51 +0700 Subject: [PATCH] fix(enrich): unwantedly replacing data (#209) * fix(enrich): unwantedly replacing data * refactor(bigquery): add more information when logging --- plugins/extractors/bigquery/bigquery.go | 8 ++++---- utils/custom_properties.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/extractors/bigquery/bigquery.go b/plugins/extractors/bigquery/bigquery.go index 984259053..7c6c5d8e6 100644 --- a/plugins/extractors/bigquery/bigquery.go +++ b/plugins/extractors/bigquery/bigquery.go @@ -88,7 +88,7 @@ func (e *Extractor) Extract(ctx context.Context, config map[string]interface{}, return } - // Fetch and iterate over datesets + // Fetch and iterate over datasets it := e.client.Datasets(ctx) for { ds, err := it.Next() @@ -96,7 +96,7 @@ func (e *Extractor) Extract(ctx context.Context, config map[string]interface{}, break } if err != nil { - return errors.Wrap(err, "failed to fetch dataset") + return errors.Wrapf(err, "failed to fetch dataset %s", ds.DatasetID) } e.extractTable(ctx, ds, out) } @@ -123,12 +123,12 @@ func (e *Extractor) extractTable(ctx context.Context, ds *bigquery.Dataset, out break } if err != nil { - e.logger.Error("failed to scan, skipping table", "err", err) + e.logger.Error("failed to scan, skipping table", "err", err, "table", table.FullyQualifiedName()) continue } tmd, err := table.Metadata(ctx) if err != nil { - e.logger.Error("failed to fetch table's metadata, skipping table", "err", err) + e.logger.Error("failed to fetch table's metadata, skipping table", "err", err, "table", table.FullyQualifiedName()) continue } diff --git a/utils/custom_properties.go b/utils/custom_properties.go index 14d12a054..9e480c97d 100644 --- a/utils/custom_properties.go +++ b/utils/custom_properties.go @@ -41,15 +41,15 @@ func SetCustomProperties(data interface{}, customFields map[string]interface{}) case assets.Table: data.Properties = createOrGetCustomFacet(data.Properties) data.Properties.Attributes = protoStruct - res = data.Properties + res = data case assets.Topic: data.Properties = createOrGetCustomFacet(data.Properties) data.Properties.Attributes = protoStruct - res = data.Properties + res = data case assets.Dashboard: data.Properties = createOrGetCustomFacet(data.Properties) data.Properties.Attributes = protoStruct - res = data.Properties + res = data default: res = data }