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

chore: log error from transformer #5465

Open
wants to merge 1 commit into
base: release/1.41.x
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions processor/integrations/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
jsoniter "github.com/json-iterator/go"
"github.com/tidwall/gjson"

"github.com/rudderlabs/rudder-go-kit/logger"
"github.com/rudderlabs/rudder-go-kit/stats"
backendconfig "github.com/rudderlabs/rudder-server/backend-config"
"github.com/rudderlabs/rudder-server/utils/misc"
Expand Down Expand Up @@ -42,11 +43,20 @@
Files map[string]interface{} `json:"files"`
}

var integrationsLogger = logger.NewLogger().With("component", "integrations")

type TransStatsT struct {
StatTags map[string]string `json:"statTags"`
}

func logError(msg string, response string) {
if strings.Contains(response, "unhandledStatusCode") {
integrationsLogger.Error(msg, logger.NewStringField("response", response))
}

Check warning on line 55 in processor/integrations/integrations.go

View check run for this annotation

Codecov / codecov/patch

processor/integrations/integrations.go#L54-L55

Added lines #L54 - L55 were not covered by tests
}

func CollectDestErrorStats(input []byte) {
logError("Error in delivery", string(input))
var integrationStat TransStatsT
err := json.Unmarshal(input, &integrationStat)
if err == nil {
Expand All @@ -57,6 +67,7 @@
}

func CollectIntgTransformErrorStats(input []byte) {
logError("Error in transformation", string(input))
var integrationStats []TransStatsT
err := json.Unmarshal(input, &integrationStats)
if err == nil {
Expand Down
Loading