-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[heartbeat] Set IDs explicitly #9697
Changes from all commits
8f64ebb
9f143d2
e335e02
669bf0e
680ea77
2ec4a4f
b31d815
6aaff4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
package dialchain | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"strconv" | ||
"time" | ||
|
@@ -130,14 +129,14 @@ func (b *Builder) Run( | |
// correctly resolved endpoint. | ||
func MakeDialerJobs( | ||
b *Builder, | ||
typ, scheme string, | ||
scheme string, | ||
endpoints []Endpoint, | ||
mode monitors.IPSettings, | ||
fn func(event *beat.Event, dialer transport.Dialer, addr string) error, | ||
) ([]monitors.Job, error) { | ||
var jobs []monitors.Job | ||
for _, endpoint := range endpoints { | ||
endpointJobs, err := makeEndpointJobs(b, typ, scheme, endpoint, mode, fn) | ||
endpointJobs, err := makeEndpointJobs(b, scheme, endpoint, mode, fn) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
@@ -149,7 +148,7 @@ func MakeDialerJobs( | |
|
||
func makeEndpointJobs( | ||
b *Builder, | ||
typ, scheme string, | ||
scheme string, | ||
endpoint Endpoint, | ||
mode monitors.IPSettings, | ||
fn func(*beat.Event, transport.Dialer, string) error, | ||
|
@@ -180,8 +179,7 @@ func makeEndpointJobs( | |
|
||
// Create job that first resolves one or multiple IP (depending on | ||
// config.Mode) in order to create one continuation Task per IP. | ||
jobID := jobID(typ, scheme, endpoint.Host, endpoint.Ports) | ||
settings := monitors.MakeHostJobSettings(jobID, endpoint.Host, mode) | ||
settings := monitors.MakeHostJobSettings(endpoint.Host, mode) | ||
|
||
job, err := monitors.MakeByHostJob(settings, | ||
monitors.MakePingAllIPPortFactory(endpoint.Ports, | ||
|
@@ -199,15 +197,5 @@ func makeEndpointJobs( | |
if err != nil { | ||
return nil, err | ||
} | ||
return []monitors.Job{monitors.WithJobId(jobID, monitors.WithFields(fields, job))}, nil | ||
} | ||
|
||
func jobID(typ, jobType, host string, ports []uint16) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see there was some value in the old id. I wonder if this is still something we can reconstruct on the UI side as all the data should be available there if needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. I don't think we're missing it inside of heartbeat itself. |
||
var h string | ||
if len(ports) == 1 { | ||
h = fmt.Sprintf("%v:%v", host, ports[0]) | ||
} else { | ||
h = fmt.Sprintf("%v:%v", host, ports) | ||
} | ||
return fmt.Sprintf("%v-%v@%v", typ, jobType, h) | ||
return []monitors.Job{monitors.WithFields(fields, job)}, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also the change to the
name
field be mentioned here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need, its behavior hasn't really changed. What has changed is our semantic interpretation of it for the UI, which no one is using yet, so I think that's not worth discussing.