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

Serve metrics under a dedicated port #48

Merged
merged 5 commits into from
Mar 7, 2018
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class EtcdMember:
API_VERSION = '/v2/'
DEFAULT_CLIENT_PORT = 2379
DEFAULT_PEER_PORT = 2380
DEFAULT_METRICS_PORT = 2381
AG_TAG = 'aws:autoscaling:groupName'
CF_TAG = 'aws:cloudformation:stack-name'

Expand All @@ -56,6 +57,7 @@ def __init__(self, arg, region=None):

self.client_port = self.DEFAULT_CLIENT_PORT
self.peer_port = self.DEFAULT_PEER_PORT
self.metrics_port = self.DEFAULT_METRICS_PORT

self.client_urls = [] # these values could be assigned only from the running etcd
self.peer_urls = [] # cluster by performing http://addr:client_port/v2/members api call
Expand Down Expand Up @@ -253,6 +255,8 @@ def etcd_arguments(self, data_dir, initial_cluster, cluster_state):
self.peer_url,
'-listen-client-urls',
'http://0.0.0.0:{}'.format(self.client_port),
'-listen-metrics-urls',
Copy link
Contributor

Choose a reason for hiding this comment

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

It breaks compatibility with old etcd, because the same script is used for different images containing different version.
Moreover, it even breaks upgrade 3.2 => 3.3.

Those arguments should be applied conditionally, i.e. only if etcd version is >= 3.3.
You can get version from environment: ETCDVERSION.

'http://0.0.0.0:{}'.format(self.metrics_port),
'-advertise-client-urls',
self.get_client_url(),
'-initial-cluster',
Expand Down