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

Support tags for automatic sidecar configuration #13367

Merged
merged 3 commits into from
Sep 8, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ public abstract class NodeDetails {
@Nullable
public abstract CollectorStatusList statusList();

@JsonProperty("tags")
@Nullable
public abstract List<String> tags();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a Set to prevent duplicates?

Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't hurt yeah. can I fix this in a separate PR? I'm waiting for this one to be merged


@JsonCreator
public static NodeDetails create(@JsonProperty("operating_system") String operatingSystem,
@JsonProperty("ip") @Nullable String ip,
@JsonProperty("metrics") @Nullable NodeMetrics metrics,
@JsonProperty("log_file_list") @Nullable List<NodeLogFile> logFileList,
@JsonProperty("status") @Nullable CollectorStatusList statusList) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList);
@JsonProperty("status") @Nullable CollectorStatusList statusList,
@JsonProperty("tags") @Nullable List<String> tags) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public Sidecar save(Sidecar sidecar) {
} else {
throw new IllegalArgumentException("Specified object failed validation: " + violations);
}
} else
} else {
throw new IllegalArgumentException("Specified object is not of correct implementation type (" + sidecar.getClass() + ")!");
}
}

public List<Sidecar> all() {
Expand Down Expand Up @@ -168,7 +169,8 @@ public int markExpired(Period period, String message) {
nodeDetails.ip(),
nodeDetails.metrics(),
nodeDetails.logFileList(),
statusListToSave);
statusListToSave,
nodeDetails.tags());

Sidecar toSave = collector.toBuilder()
.nodeDetails(nodeDetailsToSave)
Expand All @@ -194,7 +196,8 @@ public Sidecar fromRequest(String nodeId, RegistrationRequest request, String co
request.nodeDetails().ip(),
request.nodeDetails().metrics(),
request.nodeDetails().logFileList(),
request.nodeDetails().statusList()),
request.nodeDetails().statusList(),
request.nodeDetails().tags()),
collectorVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public void testSaveFirstRecord() throws Exception {
null,
null,
null,
null,
null),
version
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void testRegister() throws Exception {
null,
null,
null,
null,
null
)
);
Expand All @@ -144,6 +145,7 @@ public void testRegisterInvalidCollectorId() throws Exception {
null,
null,
null,
null,
null
)
);
Expand All @@ -164,6 +166,7 @@ public void testRegisterInvalidNodeId() throws Exception {
null,
null,
null,
null,
null
)
);
Expand Down Expand Up @@ -198,6 +201,7 @@ public void testRegisterMissingOperatingSystem() throws Exception {
null,
null,
null,
null,
null
)
);
Expand Down