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

feat: publish to callback endpoint for tracking #1753

Merged
merged 27 commits into from
Jun 19, 2024
Merged

feat: publish to callback endpoint for tracking #1753

merged 27 commits into from
Jun 19, 2024

Conversation

yhl25
Copy link
Contributor

@yhl25 yhl25 commented Jun 6, 2024

No description provided.

// Callback defines the callback configuration for the messages processed by the pipeline.
// can be used for tracking the message processing status.
// +optional
Callback Callback `json:"callback,omitempty" protobuf:"bytes,9,opt,name=callback"`
Copy link
Member

Choose a reason for hiding this comment

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

As we discussed, can we use annotation at this moment?

type Callback struct {
// Enabled indicates whether callback is enabled for the pipeline.
// +optional
Enabled bool `json:"enabled,omitempty" protobuf:"varint,1,opt,name=enabled"`
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed.

pkg/udf/rpc/grpc_map.go Show resolved Hide resolved
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 65.23077% with 113 lines in your changes missing coverage. Please review.

Project coverage is 56.82%. Comparing base (f69d830) to head (928bdfc).

Files Patch % Lines
pkg/shared/callback/callback.go 68.42% 24 Missing and 12 partials ⚠️
pkg/isb/serde.go 51.11% 10 Missing and 12 partials ⚠️
pkg/sources/forward/data_forward.go 66.66% 8 Missing and 2 partials ⚠️
pkg/sources/http/http.go 0.00% 6 Missing ⚠️
pkg/udf/forward/options.go 0.00% 5 Missing ⚠️
pkg/sinks/forward/options.go 0.00% 4 Missing ⚠️
pkg/sources/forward/options.go 0.00% 4 Missing ⚠️
pkg/sources/transformer/grpc_transformer.go 60.00% 4 Missing ⚠️
pkg/udf/rpc/grpc_map.go 60.00% 4 Missing ⚠️
pkg/udf/rpc/grpc_mapstream.go 60.00% 4 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1753      +/-   ##
==========================================
+ Coverage   56.63%   56.82%   +0.19%     
==========================================
  Files         216      218       +2     
  Lines       17350    17581     +231     
==========================================
+ Hits         9826     9991     +165     
- Misses       6692     6735      +43     
- Partials      832      855      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
return fmt.Errorf("received non-OK response status: %s", resp.Status)
}

_ = resp.Body.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Use defer before line 239.

})

if dOpts.callbackURL != "" {
client := &http.Client{
Copy link
Member

Choose a reason for hiding this comment

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

This has been existing in GetClient(), do not need it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need it

@@ -74,7 +75,7 @@ func (sp *SourceProcessor) Start(ctx context.Context) error {
healthCheckers []metrics.HealthChecker
idleManager wmb.IdleManager
pipelineName = sp.VertexInstance.Vertex.Spec.PipelineName
vertexName = sp.VertexInstance.Vertex.Name
vertexName = sp.VertexInstance.Vertex.Spec.Name
Copy link
Member

Choose a reason for hiding this comment

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

Will existing pipelines get impacted with this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

pkg/isb/message.go Outdated Show resolved Hide resolved
@@ -73,6 +74,23 @@ type Header struct {
Headers map[string]string
}

// MessageID is the message ID of the message which is used for exactly-once-semantics.
type MessageID struct {
Copy link
Member

Choose a reason for hiding this comment

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

Will this change impact existing pipelines?

Copy link
Contributor Author

@yhl25 yhl25 Jun 17, 2024

Choose a reason for hiding this comment

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

No, it should not impact.

@vigith vigith changed the title feat: Support For Publishing Callbacks. feat: publish to callback endpoint for tracking Jun 18, 2024
@@ -87,7 +92,7 @@ func (u *SinkProcessor) Start(ctx context.Context) error {
// create reader for each partition. Each partition is a group in redis
for index, bufferPartition := range u.VertexInstance.Vertex.OwnedBuffers() {
fromGroup := bufferPartition + "-group"
consumer := fmt.Sprintf("%s-%v", u.VertexInstance.Vertex.Name, u.VertexInstance.Replica)
consumer := fmt.Sprintf("%s-%v", vertexName, u.VertexInstance.Replica)
Copy link
Member

Choose a reason for hiding this comment

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

This is risky. vertex.spec.Name is not unique in one namespace, while vertex.Name is.

enableMapUdfStream, err := u.VertexInstance.Vertex.MapUdfStreamEnabled()
if err != nil {
return fmt.Errorf("failed to parse UDF map streaming metadata, %w", err)
enableMapStreamStr := os.Getenv(dfv1.EnvMapStreaming)
Copy link
Member

Choose a reason for hiding this comment

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

Use pkg/shared/util.LookupEnvBoolOr()

@yhl25 yhl25 marked this pull request as ready for review June 19, 2024 04:22
@yhl25 yhl25 requested a review from vigith as a code owner June 19, 2024 04:22
@yhl25 yhl25 requested a review from whynowy June 19, 2024 04:22
vigith and others added 5 commits June 18, 2024 22:45
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Comment on lines 11 to 12
rpu: 5
duration: 1s
http: {}
Copy link
Member

Choose a reason for hiding this comment

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

don't we have to update the quickstart if we change the source?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added by mistake.

}

// If the client is not in the cache, create a new one
client := &http.Client{
Copy link
Member

Choose a reason for hiding this comment

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

if the callback server (for this url) is restarted, will the http.Client auto-reconnect internally or will this client become invalid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the server restart case, If I am not wrong the client doesn't maintain a persistent connection to the server, so it simply creates a new connection when there is a post request, so ideally it should be fine. But still, the client caches the TCP connections. Let me run some tests, If I find any issues I will create a follow-up PR to fix it.

Signed-off-by: Vigith Maurice <[email protected]>
@yhl25 yhl25 enabled auto-merge (squash) June 19, 2024 16:27
@yhl25 yhl25 merged commit 8da7c22 into main Jun 19, 2024
25 checks passed
@yhl25 yhl25 deleted the cb-poc branch June 19, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants