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

Fix logging issues in stellar-etl writing to airflow #281

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions cmd/command_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func maybeUpload(cloudCredentials, cloudStorageBucket, cloudProvider, path strin
}

if len(cloudStorageBucket) == 0 {
cmdLogger.Error("No bucket specified")
cmdLogger.Fatal("No bucket specified")
return
}

Expand All @@ -137,11 +137,11 @@ func maybeUpload(cloudCredentials, cloudStorageBucket, cloudProvider, path strin
cloudStorage = newGCS(cloudCredentials, cloudStorageBucket)
err := cloudStorage.UploadTo(cloudCredentials, cloudStorageBucket, path)
if err != nil {
cmdLogger.Errorf("Unable to upload output to GCS: %s", err)
cmdLogger.Fatalf("Unable to upload output to GCS: %s", err)
return
}
default:
cmdLogger.Error("Unknown cloud provider")
cmdLogger.Fatal("Unknown cloud provider")
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/export_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var assetsCmd = &cobra.Command{
seenIDs[transformed.AssetID] = true
numBytes, err := exportEntry(transformed, outFile, commonArgs.Extra)
if err != nil {
cmdLogger.Error(err)
cmdLogger.LogError(err)
numFailures += 1
continue
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/export_effects.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd

import (
"fmt"

"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/stellar/stellar-etl/internal/input"
Expand Down Expand Up @@ -34,7 +36,7 @@ var effectsCmd = &cobra.Command{
effects, err := transform.TransformEffect(transformInput.Transaction, LedgerSeq, transformInput.LedgerCloseMeta, env.NetworkPassphrase)
if err != nil {
txIndex := transformInput.Transaction.Index
cmdLogger.Errorf("could not transform transaction %d in ledger %d: %v", txIndex, LedgerSeq, err)
cmdLogger.LogError(fmt.Errorf("could not transform transaction %d in ledger %d: %v", txIndex, LedgerSeq, err))
numFailures += 1
continue
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/export_ledger_entry_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"

"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/xdr"
Expand All @@ -28,6 +29,7 @@ confirmed by the Stellar network.
If no data type flags are set, then by default all of them are exported. If any are set, it is assumed that the others should not
be exported.`,
Run: func(cmd *cobra.Command, args []string) {
cmdLogger.SetLevel(logrus.InfoLevel)
commonArgs := utils.MustCommonFlags(cmd.Flags(), cmdLogger)
cmdLogger.StrictExport = commonArgs.StrictExport
env := utils.GetEnvironmentDetails(commonArgs)
Expand Down Expand Up @@ -316,7 +318,7 @@ func exportTransformedData(
case transform.ClaimableBalanceOutput:
// Skipping ClaimableBalanceOutputParquet because it is not needed in the current scope of work
// Note that ClaimableBalanceOutputParquet uses nested structs that will need to be handled
// for parquet conversio
// for parquet conversion
skip = true
case transform.ConfigSettingOutput:
transformedResource = append(transformedResource, v)
Expand Down
5 changes: 4 additions & 1 deletion internal/input/changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ func extractBatch(
if !ok {
// TODO: once LedgerEntryTypeData is tracked as well, all types should be addressed,
// so this info log should be a warning.
logger.Infof("change type: %v not tracked", change.Type)
// Skip LedgerEntryTypeData as we are intentionally not processing it
if change.Type != xdr.LedgerEntryTypeData {
logger.Infof("change type: %v not tracked", change.Type)
}
Comment on lines +131 to +134
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the error issue. This is just to log less spam in our output

} else {
cache.AddChange(change)
}
Expand Down
Loading