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

Added metadata information about servers into consul service description #5455

Merged

Conversation

pierresouchay
Copy link
Contributor

This allows have information about servers from HTTP APIs without using the command line.

It will allow to see information about servers from GUIs using the HTTP APIs for instance.

"consul_voter": strconv.FormatBool(!parts.NonVoter),
"raft_version": strconv.Itoa(parts.RaftVersion),
"serf_protocol": fmt.Sprintf("%v (%v .. %v)", member.ProtocolCur, member.ProtocolMin, member.ProtocolMax),
"version": parts.Build.String(),
Copy link
Contributor

@ShimmerGlass ShimmerGlass Mar 9, 2019

Choose a reason for hiding this comment

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

This could maybe be "consul_version" (we could add this meta to agents as well in the future and it could conflict with user defined meta)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Aestek version sounds good as it is namespaced by consul service name (and AFAIK, it is not possible to add other meta to consul service)

@pierresouchay
Copy link
Contributor Author

Could someone review this - as it is pretty straighforward ? This is pretty minor, but would help foreign systems to get information about members of cluster easily (for instance prometheus to target specific instances of Consul servers)

@pierresouchay
Copy link
Contributor Author

pierresouchay commented Jun 20, 2019

@i0rek Can you have a look, it is pretty straightforward and allow systems such as prometheus (for instance to solve #4659 since prometheus can extract version information from service.meta tags) or UIs to discover quickly more informations about servers without digging into consul tools (we could even later add information about who is the leader to solve issues such as #5073)

Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

Looks good in general, have one question.

agent/consul/leader.go Outdated Show resolved Hide resolved
@johncowen
Copy link
Contributor

johncowen commented Jun 24, 2019

Hi @pierresouchay / @Aestek

Thanks for this, exposing this kind of info will be very useful for us.

(we could even later add information about who is the leader to solve issues such as #5073)

This could be very useful for a feature we're currently adding to the UI!

Overall, I was just wondering if you could let me know where the version value (and other potential ones) are eventually surfaced in the API (so at what endpoint)?

@mkeeler , we were chatting about namespacing useful meta kv's with consul the other day I think this is all a similar subject?

@pierresouchay
Copy link
Contributor Author

@johncowen Those values will be available in Service.Meta of the service consul (and thus, available in the HTTP APIs, or, for instance in prometheus or similar systems that allow extracting Service.Meta)

@johncowen
Copy link
Contributor

Oh I see, now I understand what you said about the namespacing, these will only be set on the consul service itself, therefore doesn't necessarily need a consul_.

👍

@pierresouchay pierresouchay force-pushed the server_info_in_consul_service branch from e424ee2 to 3062cab Compare June 24, 2019 11:47
@pierresouchay
Copy link
Contributor Author

Damned unstable tests

@pierresouchay pierresouchay force-pushed the server_info_in_consul_service branch from 3062cab to 0bba50f Compare June 24, 2019 12:14
@pierresouchay
Copy link
Contributor Author

@i0rek Unit tests are not stable once again :(
Trying to force-push once again...

This allows have information about servers from HTTP APIs without
using the command line.
Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

I changed my mind about booted_as_consul_voter and I have another comment. Looks good otherwise.

agent/consul/leader.go Outdated Show resolved Hide resolved
agent/consul/leader.go Outdated Show resolved Hide resolved
@pierresouchay
Copy link
Contributor Author

@i0rek All DONE

Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

Thanks!

@hanshasselberg hanshasselberg merged commit 4eb7397 into hashicorp:master Jun 26, 2019
@pierresouchay
Copy link
Contributor Author

@i0rek Thank you again !

eikenb added a commit to hashicorp/consul-template that referenced this pull request Jul 24, 2019
Several calls had version meta-data added in consul 1.5.2 [1]. This
fixes those tests and bumps circleci tests to use consul 1.5.2.

[1] hashicorp/consul#5455
eikenb added a commit to hashicorp/consul-template that referenced this pull request Jul 24, 2019
Several calls had version meta-data added in consul 1.5.2 [1]. This
fixes those tests and bumps circleci tests to use consul 1.5.2.

[1] hashicorp/consul#5455
eikenb added a commit to hashicorp/consul-template that referenced this pull request Jul 24, 2019
Several calls had version meta-data added in consul 1.5.2 [1]. This
fixes those tests and bumps circleci tests to use consul 1.5.2.

[1] hashicorp/consul#5455
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