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

Switch to json formatted status events #2711

Merged
merged 1 commit into from
Jul 19, 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 internal/impl/kafka/enterprise/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/redpanda-data/benthos/v4/public/service"
"github.com/redpanda-data/benthos/v4/public/service/integration"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/encoding/protojson"

"github.com/redpanda-data/connect/v4/internal/impl/kafka/enterprise"
"github.com/redpanda-data/connect/v4/internal/protoconnect"
Expand Down Expand Up @@ -213,12 +213,12 @@ max_message_bytes: 1MB

var m protoconnect.StatusEvent

require.NoError(t, proto.Unmarshal([]byte(outRecords[0]), &m))
require.NoError(t, protojson.Unmarshal([]byte(outRecords[0]), &m))
assert.Equal(t, protoconnect.StatusEvent_TYPE_INITIALIZING, m.Type)
assert.Equal(t, "baz", m.InstanceId)
assert.Equal(t, "buz", m.PipelineId)

require.NoError(t, proto.Unmarshal([]byte(outRecords[1]), &m))
require.NoError(t, protojson.Unmarshal([]byte(outRecords[1]), &m))
assert.Equal(t, protoconnect.StatusEvent_TYPE_EXITING, m.Type)
assert.Equal(t, "uh oh", m.ExitError.Message)
assert.Equal(t, "baz", m.InstanceId)
Expand Down
4 changes: 2 additions & 2 deletions internal/impl/kafka/enterprise/status_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"

"github.com/redpanda-data/benthos/v4/public/service"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/encoding/protojson"

"github.com/redpanda-data/connect/v4/internal/protoconnect"
)
Expand Down Expand Up @@ -65,7 +65,7 @@ func (l *TopicLogger) sendStatusEvent(e *protoconnect.StatusEvent) {
return
}

data, err := proto.Marshal(e)
data, err := protojson.Marshal(e)
if err != nil {
l.fallbackLogger.Load().With("error", err).Error("Failed to marshal status event")
return
Expand Down
Loading