Skip to content

Commit

Permalink
Merge pull request #9984 from gyuho/20180806-metrics-all
Browse files Browse the repository at this point in the history
docs,tools/etcd-dump-metrics: automate metrics documentation
  • Loading branch information
gyuho authored Aug 7, 2018
2 parents b42a9ce + 902893f commit 3599938
Show file tree
Hide file tree
Showing 66 changed files with 30,080 additions and 323 deletions.
8 changes: 1 addition & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is official etcd documentation.
Still working in progress...

* :ref:`set-up`: setting up an etcd cluster.
* :ref:`monitor`: monitoring an etcd cluster.
* :ref:`operate`: operating an etcd cluster.
* :ref:`client-architecture`: describes etcd client components.

.. toctree::
Expand All @@ -22,12 +22,6 @@ Still working in progress...

operate

.. toctree::
:maxdepth: 3
:caption: Monitor

monitor

.. toctree::
:maxdepth: 3
:caption: FAQs
Expand Down
File renamed without changes.
511 changes: 511 additions & 0 deletions docs/metrics/v3.1.0

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.1

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.10

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.11

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.12

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.13

Large diffs are not rendered by default.

516 changes: 516 additions & 0 deletions docs/metrics/v3.1.14

Large diffs are not rendered by default.

516 changes: 516 additions & 0 deletions docs/metrics/v3.1.15

Large diffs are not rendered by default.

516 changes: 516 additions & 0 deletions docs/metrics/v3.1.16

Large diffs are not rendered by default.

516 changes: 516 additions & 0 deletions docs/metrics/v3.1.17

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/metrics-v3.1 → docs/metrics/v3.1.18
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,11 @@ go_memstats_sys_bytes
# type: "counter"
# gRPC codes:
# - "OK"
# - "Unavailable"
grpc_server_handled_total{grpc_code="CODE",grpc_method="DeleteRange",grpc_service="etcdserverpb.KV",grpc_type="unary"}
grpc_server_handled_total{grpc_code="CODE",grpc_method="Put",grpc_service="etcdserverpb.KV",grpc_type="unary"}
grpc_server_handled_total{grpc_code="CODE",grpc_method="Range",grpc_service="etcdserverpb.KV",grpc_type="unary"}
grpc_server_handled_total{grpc_code="CODE",grpc_method="Watch",grpc_service="etcdserverpb.Watch",grpc_type="bidi_stream"}

# name: "grpc_server_msg_received_total"
# description: "Total number of RPC stream messages received on the server."
Expand Down
598 changes: 598 additions & 0 deletions docs/metrics/v3.1.19

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.2

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.3

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.4

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.5

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.6

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.7

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.8

Large diffs are not rendered by default.

511 changes: 511 additions & 0 deletions docs/metrics/v3.1.9

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.0

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.1

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.10

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.11

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.12

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.13

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.14

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.15

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.16

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.17

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.18

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions docs/metrics/v3.2.19

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.2

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions docs/metrics/v3.2.20

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions docs/metrics/v3.2.21

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions docs/metrics/v3.2.22

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions docs/metrics-v3.2 → docs/metrics/v3.2.23
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,6 @@ http_request_size_bytes{handler="prometheus",quantile="0.99"}
http_request_size_bytes_sum{handler="prometheus"}
http_request_size_bytes_count{handler="prometheus"}

# name: "http_requests_total"
# description: "Total number of HTTP requests made."
# type: "counter"
http_requests_total{code="200",handler="prometheus",method="get"}

# name: "http_response_size_bytes"
# description: "The HTTP response sizes in bytes."
# type: "summary"
Expand Down
632 changes: 632 additions & 0 deletions docs/metrics/v3.2.24

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.3

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.4

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.5

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.6

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.7

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.8

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions docs/metrics/v3.2.9

Large diffs are not rendered by default.

698 changes: 698 additions & 0 deletions docs/metrics/v3.3.0

Large diffs are not rendered by default.

698 changes: 698 additions & 0 deletions docs/metrics/v3.3.1

Large diffs are not rendered by default.

698 changes: 698 additions & 0 deletions docs/metrics/v3.3.2

Large diffs are not rendered by default.

698 changes: 698 additions & 0 deletions docs/metrics/v3.3.3

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions docs/metrics/v3.3.4

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions docs/metrics/v3.3.5

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions docs/metrics/v3.3.6

Large diffs are not rendered by default.

703 changes: 703 additions & 0 deletions docs/metrics/v3.3.7

Large diffs are not rendered by default.

File renamed without changes.
802 changes: 802 additions & 0 deletions docs/metrics/v3.3.9

Large diffs are not rendered by default.

70 changes: 65 additions & 5 deletions docs/operate.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _monitor:
.. _operate:


Monitor
Expand All @@ -13,23 +13,83 @@ List of metrics
Latest
======

.. literalinclude:: metrics-latest
Download: :download:`latest <metrics/latest>`.

.. literalinclude:: metrics/latest
:language: BASH

v3.3
====

.. literalinclude:: metrics-v3.3
- :download:`v3.3.9 <metrics/v3.3.9>`
- :download:`v3.3.8 <metrics/v3.3.8>`
- :download:`v3.3.7 <metrics/v3.3.7>`
- :download:`v3.3.6 <metrics/v3.3.6>`
- :download:`v3.3.5 <metrics/v3.3.5>`
- :download:`v3.3.4 <metrics/v3.3.4>`
- :download:`v3.3.3 <metrics/v3.3.3>`
- :download:`v3.3.2 <metrics/v3.3.2>`
- :download:`v3.3.1 <metrics/v3.3.1>`
- :download:`v3.3.0 <metrics/v3.3.0>`

.. literalinclude:: metrics/v3.3.9
:language: BASH

v3.2
====

.. literalinclude:: metrics-v3.2
- :download:`v3.2.24 <metrics/v3.2.24>`
- :download:`v3.2.23 <metrics/v3.2.23>`
- :download:`v3.2.22 <metrics/v3.2.22>`
- :download:`v3.2.21 <metrics/v3.2.21>`
- :download:`v3.2.20 <metrics/v3.2.20>`
- :download:`v3.2.19 <metrics/v3.2.19>`
- :download:`v3.2.18 <metrics/v3.2.18>`
- :download:`v3.2.17 <metrics/v3.2.17>`
- :download:`v3.2.16 <metrics/v3.2.16>`
- :download:`v3.2.15 <metrics/v3.2.15>`
- :download:`v3.2.14 <metrics/v3.2.14>`
- :download:`v3.2.13 <metrics/v3.2.13>`
- :download:`v3.2.12 <metrics/v3.2.12>`
- :download:`v3.2.11 <metrics/v3.2.11>`
- :download:`v3.2.10 <metrics/v3.2.10>`
- :download:`v3.2.9 <metrics/v3.2.9>`
- :download:`v3.2.8 <metrics/v3.2.8>`
- :download:`v3.2.7 <metrics/v3.2.7>`
- :download:`v3.2.6 <metrics/v3.2.6>`
- :download:`v3.2.5 <metrics/v3.2.5>`
- :download:`v3.2.4 <metrics/v3.2.4>`
- :download:`v3.2.3 <metrics/v3.2.3>`
- :download:`v3.2.2 <metrics/v3.2.2>`
- :download:`v3.2.1 <metrics/v3.2.1>`
- :download:`v3.2.0 <metrics/v3.2.0>`

.. literalinclude:: metrics/v3.2.24
:language: BASH

v3.1
====

.. literalinclude:: metrics-v3.1
- :download:`v3.1.19 <metrics/v3.1.19>`
- :download:`v3.1.18 <metrics/v3.1.18>`
- :download:`v3.1.17 <metrics/v3.1.17>`
- :download:`v3.1.16 <metrics/v3.1.16>`
- :download:`v3.1.15 <metrics/v3.1.15>`
- :download:`v3.1.14 <metrics/v3.1.14>`
- :download:`v3.1.13 <metrics/v3.1.13>`
- :download:`v3.1.12 <metrics/v3.1.12>`
- :download:`v3.1.11 <metrics/v3.1.11>`
- :download:`v3.1.10 <metrics/v3.1.10>`
- :download:`v3.1.9 <metrics/v3.1.9>`
- :download:`v3.1.8 <metrics/v3.1.8>`
- :download:`v3.1.7 <metrics/v3.1.7>`
- :download:`v3.1.6 <metrics/v3.1.6>`
- :download:`v3.1.5 <metrics/v3.1.5>`
- :download:`v3.1.4 <metrics/v3.1.4>`
- :download:`v3.1.3 <metrics/v3.1.3>`
- :download:`v3.1.2 <metrics/v3.1.2>`
- :download:`v3.1.1 <metrics/v3.1.1>`
- :download:`v3.1.0 <metrics/v3.1.0>`

.. literalinclude:: metrics/v3.1.19
:language: BASH
17 changes: 6 additions & 11 deletions tools/etcd-dump-metrics/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
go install -v ./tools/etcd-dump-metrics

# for latest master branch
etcd-dump-metrics > docs/metrics-latest
etcd-dump-metrics > docs/metrics/latest

# download etcd v3.3 to ./bin
# Or download etcd v3.3.9 to ./bin
goreman start
etcd-dump-metrics -addr http://localhost:2379/metrics > docs/metrics-v3.3

# download etcd v3.2 to ./bin
goreman start
etcd-dump-metrics -addr http://localhost:2379/metrics > docs/metrics-v3.2

# download etcd v3.1 to ./bin
goreman start
etcd-dump-metrics -addr http://localhost:2379/metrics > docs/metrics-v3.1
etcd-dump-metrics --addr http://localhost:2379/metrics > docs/metrics/v3.3.9

# Or download etcd v3.3.9 to temporary directory to fetch metrics
etcd-dump-metrics --debug --download-ver v3.3.9
etcd-dump-metrics --download-ver v3.3.9 > docs/metrics/v3.3.9
94 changes: 94 additions & 0 deletions tools/etcd-dump-metrics/etcd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright 2018 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"context"
"fmt"
"io/ioutil"
"net/url"
"os"
"strings"
"time"

"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/embed"

"go.uber.org/zap"
)

func newEmbedURLs(n int) (urls []url.URL) {
urls = make([]url.URL, n)
for i := 0; i < n; i++ {
u, _ := url.Parse(fmt.Sprintf("unix://localhost:%d%06d", os.Getpid(), i))
urls[i] = *u
}
return urls
}

func setupEmbedCfg(cfg *embed.Config, curls, purls, ics []url.URL) {
cfg.Logger = "zap"
cfg.LogOutputs = []string{"/dev/null"}
// []string{"stderr"} to enable server logging
cfg.Debug = false

var err error
cfg.Dir, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("%016X", time.Now().UnixNano()))
if err != nil {
panic(err)
}
os.RemoveAll(cfg.Dir)

cfg.ClusterState = "new"
cfg.LCUrls, cfg.ACUrls = curls, curls
cfg.LPUrls, cfg.APUrls = purls, purls

cfg.InitialCluster = ""
for i := range ics {
cfg.InitialCluster += fmt.Sprintf(",%d=%s", i, ics[i].String())
}
cfg.InitialCluster = cfg.InitialCluster[1:]
}

func getCommand(exec, name, dir, cURL, pURL, cluster string) string {
s := fmt.Sprintf("%s --name %s --data-dir %s --listen-client-urls %s --advertise-client-urls %s ",
exec, name, dir, cURL, cURL)
s += fmt.Sprintf("--listen-peer-urls %s --initial-advertise-peer-urls %s ", pURL, pURL)
s += fmt.Sprintf("--initial-cluster %s ", cluster)
return s + "--initial-cluster-token tkn --initial-cluster-state new"
}

func write(ep string) {
cli, err := clientv3.New(clientv3.Config{Endpoints: []string{strings.Replace(ep, "/metrics", "", 1)}})
if err != nil {
lg.Panic("failed to create client", zap.Error(err))
}
defer cli.Close()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_, err = cli.Put(ctx, "____test", "")
if err != nil {
lg.Panic("failed to write test key", zap.Error(err))
}
_, err = cli.Get(ctx, "____test")
if err != nil {
lg.Panic("failed to read test key", zap.Error(err))
}
_, err = cli.Delete(ctx, "____test")
if err != nil {
lg.Panic("failed to delete test key", zap.Error(err))
}
cli.Watch(ctx, "____test", clientv3.WithCreatedNotify())
}
58 changes: 58 additions & 0 deletions tools/etcd-dump-metrics/install_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2018 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build darwin

package main

import (
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"

"github.com/coreos/etcd/pkg/fileutil"
)

const downloadURL = `https://storage.googleapis.com/etcd/%s/etcd-%s-darwin-amd64.zip`

func install(ver, dir string) (string, error) {
ep := fmt.Sprintf(downloadURL, ver, ver)

resp, err := http.Get(ep)
if err != nil {
return "", err
}
defer resp.Body.Close()

d, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}

zipPath := filepath.Join(dir, "etcd.zip")
if err = ioutil.WriteFile(zipPath, d, fileutil.PrivateFileMode); err != nil {
return "", err
}

if err = exec.Command("bash", "-c", fmt.Sprintf("unzip %s -d %s", zipPath, dir)).Run(); err != nil {
return "", err
}

bp1 := filepath.Join(dir, fmt.Sprintf("etcd-%s-darwin-amd64", ver), "etcd")
bp2 := filepath.Join(dir, "etcd")
return bp2, os.Rename(bp1, bp2)
}
54 changes: 54 additions & 0 deletions tools/etcd-dump-metrics/install_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2018 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package main

import (
"fmt"
"io/ioutil"
"net/http"
"os/exec"
"path/filepath"

"github.com/coreos/etcd/pkg/fileutil"
)

const downloadURL = `https://storage.googleapis.com/etcd/%s/etcd-%s-linux-amd64.tar.gz`

func install(ver, dir string) (string, error) {
ep := fmt.Sprintf(downloadURL, ver, ver)

resp, err := http.Get(ep)
if err != nil {
return "", err
}
defer resp.Body.Close()

d, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}

tarPath := filepath.Join(dir, "etcd.tar.gz")
if err = ioutil.WriteFile(tarPath, d, fileutil.PrivateFileMode); err != nil {
return "", err
}

if err = exec.Command("bash", "-c", fmt.Sprintf("tar xzvf %s -C %s --strip-components=1", tarPath, dir)).Run(); err != nil {
return "", err
}
return filepath.Join(dir, "etcd"), nil
}
23 changes: 23 additions & 0 deletions tools/etcd-dump-metrics/install_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2018 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build windows

package main

import "errors"

func install(ver, dir string) error {
return errors.New("windows install is not supported yet")
}
Loading

0 comments on commit 3599938

Please sign in to comment.