From 097439b0f9dca96414dc150f87d55f3a40ac4a9f Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 5 Jun 2018 11:20:32 +0200 Subject: [PATCH 1/2] web: limit the number of dropped targets (#4212) Displaying all the dropped targets in the service-discovery page hurts the Prometheus server as well as the browser when thousands of dropped targets exist. This change limits this number to 1,000 and display the number of active/total targets per scrape configuration. Add warning when more than 100 targets are dropped Signed-off-by: Simon Pasquier --- web/ui/bindata.go | 8 ++++---- web/ui/static/js/targets.js | 1 + web/ui/templates/service-discovery.html | 11 +++++++++-- web/web.go | 26 ++++++++++++++++++++++++- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/web/ui/bindata.go b/web/ui/bindata.go index a9e2805d6..8fa64371a 100644 --- a/web/ui/bindata.go +++ b/web/ui/bindata.go @@ -231,7 +231,7 @@ func webUiTemplatesRulesHtml() (*asset, error) { return a, nil } -var _webUiTemplatesServiceDiscoveryHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x55\x51\x8b\xdb\x38\x10\x7e\xf7\xaf\x18\x74\x79\x3a\xd6\x6b\x76\xe1\xee\x21\x27\xfb\x5e\xf6\xe5\xe0\x0e\x0e\x5a\xfa\x52\x4a\x91\xad\x49\x3c\x59\xad\x64\x24\x25\x4d\x30\xfe\xef\x45\x96\xed\xd8\x69\x52\xda\x2d\x7d\xeb\xc2\x06\x69\x46\xfa\xe6\x9b\x99\x4f\xe3\xb6\x95\xb8\x21\x8d\xc0\x6a\x14\x92\x75\x5d\xc2\x15\xe9\x67\xf0\xa7\x06\x73\xe6\xf1\xe8\xb3\xca\x39\x06\x16\x55\xce\x9c\x3f\x29\x74\x35\xa2\x67\x50\x5b\xdc\xe4\xac\x6d\xa1\x11\xbe\xfe\xdf\xe2\x86\x8e\xd0\x75\x99\xf3\xc2\x53\x15\xee\x64\x5e\xd8\x2d\x7a\x77\x5f\x39\xf7\xf7\x21\x6f\x5b\x28\xf7\xa4\xe4\x3b\xb4\x8e\x8c\x86\xae\x63\x45\xc2\x5d\x65\xa9\xf1\xe0\x6c\x75\x1b\x6b\x77\x86\xda\xdd\x42\xe2\x59\x44\x2a\x92\xb6\x45\x2d\xbb\x2e\x49\x78\xcf\xb6\x48\x00\x7e\x7f\x4f\xf2\xc3\xba\xc4\x8d\xb1\x08\x6d\x02\x00\x20\xc9\x35\x4a\x9c\xd6\x50\x2a\x53\x3d\xff\xd5\xdb\x2a\xa3\x3d\x6a\xbf\x06\x06\x2c\x5a\x5e\x84\xdd\x92\x4e\xbd\x69\xd6\x90\xfe\xf9\x47\x73\x8c\xe6\x1a\x69\x5b\xfb\x35\x9c\x2d\x07\x72\x54\x92\x22\x7f\x5a\x43\x4d\x52\xa2\x0e\xf6\x2e\xe1\xd9\x40\x22\x39\xd7\x79\x08\x13\x4a\x0d\xc0\x25\x1d\xa0\x52\xc2\xb9\xbc\x77\x08\xd2\x68\xd3\x8d\xda\x93\x64\x45\xd2\x63\xf3\xfa\xa1\x78\x83\xf6\x40\x15\xc2\x13\xb9\xca\x1c\xd0\x9e\x78\x56\x3f\x14\xd1\x3d\x43\xf0\xa2\x54\x98\x4e\x38\x2c\x9e\x00\xe0\xbd\x63\x71\x0a\xa6\xb3\x12\xb5\x43\x39\xec\x4b\x63\x25\xda\x69\xeb\xbc\xa5\x66\xda\xd5\x21\xf4\x19\x74\xaf\xc6\x25\x40\xdb\x5a\xa1\xb7\x08\x2b\xba\x83\xd5\xce\x94\xb0\xce\xe1\xfe\x1f\x2d\xf1\xd8\xa7\x39\xfe\x71\x45\xc5\x6c\x0b\xc0\xc5\x20\xa4\xdf\x76\xa6\x4c\xdb\x36\xdc\x0d\xfd\x1c\x57\x3c\x13\xf3\x0b\x3c\x9b\x03\x8c\xad\x1e\x7d\x23\x21\x9e\x49\x3a\x0c\xd5\x6b\xdb\xd5\x20\x9e\x9e\xd2\xdb\xb8\x1e\x2e\x4d\xac\x2f\x19\x7f\x7b\x65\xeb\x47\x20\x99\xb3\x25\xfb\x19\xc3\x68\x9a\x0c\xbc\xdc\x7b\x6f\xf4\xf0\xbc\xe2\x86\x9d\x83\x44\xa2\x95\x51\x4a\x34\x0e\x65\x1a\x5b\x55\x7a\x1d\xfe\xd3\xc6\xd2\x8b\xb0\x27\x56\xb8\xda\x7c\x82\x17\x63\x91\x67\x11\x62\xa2\x93\xd5\x8f\x3f\xa5\xe9\xd0\xeb\x38\x67\xe3\xbb\xd1\x46\xe3\x2c\x4f\xee\xc3\xf4\x18\x63\xed\x4c\xf9\x51\xa2\x17\xa4\x1c\x5b\x74\xcf\xdb\x8b\xee\xfb\xba\x18\x25\x8d\x12\xfe\x15\x25\x2a\xc7\x33\x5f\x7f\x79\x2c\x36\xee\xc6\x11\x9e\xcd\x91\x83\x17\x85\x9c\xb3\x2b\x8d\x3c\x0d\x82\x98\xf7\x9d\x42\xbb\x61\x12\xc8\x45\xaf\xae\x12\x9e\x92\x54\x3d\x13\xb6\xf4\x0f\x3d\x8f\xbe\x5e\x51\xe7\xf4\x22\xf5\xfb\xff\x44\x03\x8b\x20\x03\xf2\x5e\x4d\xc8\xe4\x7c\x4a\x5a\x91\xc6\xa9\xee\xbd\xad\x5f\xa7\x41\x3a\x97\xf5\x9f\x47\x1f\x24\xdd\x73\xb8\x83\xd5\x41\xa8\x3d\x06\x2a\x03\xab\x2b\xb1\xe1\xda\xcb\x9c\xb9\x5c\x23\xf4\x22\x6d\xe8\x7f\xcf\x7a\x1c\x53\xee\xba\x30\xc5\x63\xc8\xae\x63\x3c\x0b\x37\xaf\xc3\x2e\x5f\xf2\x9c\x3f\x2a\x87\x57\x49\xde\xa4\x78\x93\xa0\xc4\x8d\xd8\x2b\xcf\x8a\x50\xae\xdb\x6c\xbe\xc2\x65\x36\x5f\xe6\xe7\xe7\xa3\x2f\x5a\xbc\xfc\x51\xa5\xfc\xd2\xc7\xb2\xa2\xdf\xad\x8f\xd7\x91\x9c\x34\xf2\x64\x4d\xd3\xa0\x7c\x25\xa9\x57\x0a\x65\x39\xb9\x2e\x71\x78\x36\x4c\xae\x69\x1b\x46\xf2\xe2\x23\x17\xaf\x01\x6a\x19\x55\x33\x7e\xfb\x46\xa8\xcf\x01\x00\x00\xff\xff\xa7\x61\xed\x17\xe0\x09\x00\x00") +var _webUiTemplatesServiceDiscoveryHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x55\x41\xaf\xe3\x34\x10\xbe\xe7\x57\x8c\x4c\x0f\x80\x5e\x9b\x7d\x2b\xc1\xa1\xb8\x41\x48\x7b\x41\x02\x09\x89\x15\x17\x84\x90\x13\x4f\x9b\x79\xeb\xda\x91\xed\x66\x5b\x59\xf9\xef\xc8\x71\x92\x26\xa5\x5d\xe0\xc1\x91\x27\xbd\x2a\x9e\x19\x7f\xf3\xcd\xf8\x1b\x3b\x04\x89\x7b\xd2\x08\xac\x46\x21\x59\xd7\x65\x5c\x91\xfe\x00\xfe\xd2\xe0\x8e\x79\x3c\xfb\xbc\x72\x8e\x81\x45\xb5\x63\xce\x5f\x14\xba\x1a\xd1\x33\xa8\x2d\xee\x77\x2c\x04\x68\x84\xaf\x7f\xb2\xb8\xa7\x33\x74\x5d\xee\xbc\xf0\x54\xc5\x3d\xb9\x17\xf6\x80\xde\x6d\x2a\xe7\xbe\x6d\x77\x21\x40\x79\x22\x25\x7f\x41\xeb\xc8\x68\xe8\x3a\x56\x64\xdc\x55\x96\x1a\x0f\xce\x56\x8f\xb1\x5e\xae\x50\x2f\x8f\x90\x78\x9e\x90\x8a\x2c\x04\xd4\xb2\xeb\xb2\x8c\xf7\x6c\x8b\x0c\xe0\xcb\x5f\x49\xfe\xb6\x2d\x71\x6f\x2c\x42\xc8\x00\x00\x24\xb9\x46\x89\xcb\x16\x4a\x65\xaa\x0f\xdf\xf4\xb6\xca\x68\x8f\xda\x6f\x81\x01\x4b\x96\xa3\xb0\x07\xd2\x6b\x6f\x9a\x2d\xac\xbf\xfe\xaa\x39\x27\x73\x8d\x74\xa8\xfd\x16\xae\x96\x96\x1c\x95\xa4\xc8\x5f\xb6\x50\x93\x94\xa8\xa3\xbd\xcb\x78\x3e\x90\xc8\xae\x7d\x1e\xd2\xc4\x56\x03\x70\x49\x2d\x54\x4a\x38\xb7\xeb\x1d\x82\x34\xda\xf5\x5e\x9d\x48\xb2\x22\xeb\xb1\x79\xfd\x5c\xfc\x8c\xb6\xa5\x0a\xe1\x1d\xb9\xca\xb4\x68\x2f\x3c\xaf\x9f\x8b\xe4\x9e\x21\x78\x51\x2a\x5c\x4f\x38\x2c\x45\x00\xf0\xde\xb1\x88\x82\x29\x56\xa2\x76\x28\x87\x75\x69\xac\x44\x3b\x2d\x9d\xb7\xd4\x4c\xab\x3a\xa6\xbe\x82\x9e\xd4\xf8\x09\x10\x82\x15\xfa\x80\xb0\xa2\x27\x58\xbd\x98\x12\xb6\x3b\xd8\x7c\xaf\x25\x9e\xfb\x32\xc7\x3f\xae\xa8\x98\x2d\x01\xb8\x18\x84\xf4\xd9\x8b\x29\xd7\x21\xc4\xbd\xf1\x3c\xc7\x2f\x9e\x8b\x02\x3e\x0f\x01\x28\x62\xc1\x6a\xf3\x5d\xe5\xa9\x8d\x79\xa2\x40\x66\xf6\xf7\xc6\x0b\x95\xcc\x20\x52\xcc\x20\x9a\x2f\xe6\xf9\xf3\x39\x81\x51\x2a\xa3\x6f\x2c\x88\xe7\x92\xda\xa1\xfb\x21\xac\x06\x9c\xbe\xa4\xf7\xe9\x7b\xd8\xf4\xc9\xaa\xff\xfe\xe9\xd4\x6f\x81\xe4\x8e\x2d\x3b\x30\x63\x99\x4c\x93\x81\x97\x27\xef\x8d\x1e\x46\x34\x2d\xd8\x35\x49\x22\x5b\x19\xa5\x44\xe3\x50\xae\xd3\x71\x97\x5e\xc7\xff\x75\x63\xe9\x28\xec\x85\x15\xae\x36\x1f\xe1\x68\x2c\xf2\x3c\x41\x4c\x74\xf2\xfa\xed\xf8\x1d\xc2\x47\xf2\xf5\xd4\xe4\x77\xd6\x34\x51\x0e\x2b\x9a\xe8\x84\x40\x7b\x38\x78\xd8\xc0\xf3\x9b\x37\x70\x6d\xe6\x42\xd7\x23\x15\x54\x78\x8c\xd2\x87\x7e\x2a\x76\x6c\x9c\x42\x6d\x34\x2e\x2a\x86\x4d\x3c\xc7\xb1\x96\x5a\xb4\x08\x25\xa2\x06\x99\x08\x3c\x41\x64\x4f\xfa\x00\x46\xab\x0b\xf8\x1a\x61\x4f\xd6\xf9\x9e\xc3\x10\x33\xed\x16\x0e\xf0\x2c\x8e\x8d\x42\xb7\x99\x4a\xec\x0f\xf8\x9e\x0a\x6e\x34\xf1\x5f\x0e\xce\x5f\x54\xcd\x7d\xbc\x81\xc7\x5c\x2f\xa6\xfc\x5d\xa2\x17\xa4\x1c\x9b\x8f\x0c\xf7\xf6\x66\x82\x7c\x5d\x8c\xd7\x02\x4a\xf8\x41\x94\xa8\x1c\xcf\x7d\xfd\xe7\xb0\x24\xde\x07\x21\x3c\x9f\x23\x47\x2f\x0a\x39\x67\x57\x1a\x79\x19\x86\x62\xae\xfd\x41\x1b\x63\xb7\x6f\xb4\x7a\x97\xf0\x54\xa4\xea\x99\xb0\xa5\x7f\xd0\x7c\xf2\xf5\x13\x75\x2d\x2f\x51\xdf\xfc\x28\x1a\x58\x24\x19\x90\x4f\x6a\x42\x26\xe7\xd7\xa4\x15\x69\x9c\xfa\xde\xdb\xfa\xef\x75\x1c\x9d\xdb\xfe\xcf\xb3\x0f\x63\xdd\x73\x78\x82\x55\x2b\xd4\x09\x23\x95\x81\xd5\x9d\xdc\x70\xef\x76\x9b\xb9\x5c\x23\xf4\xa2\x6c\xe8\x7f\xaf\xf3\x38\x96\xdc\x75\xf1\x25\x4c\x29\xbb\x8e\xf1\x3c\xee\xbc\x0f\xbb\xbc\xcd\xe6\xfc\x51\x39\xbc\x4b\xf2\x21\xc5\x87\x04\x25\xee\xc5\x49\x79\x56\xc4\x76\x3d\x66\xf3\x09\x2e\xb3\x79\x9a\xc7\xcf\x9f\x8f\x64\xf1\xf2\xdf\x2a\xe5\x7f\x7d\x2c\x3b\xfa\x8f\xf5\xf1\x3a\x92\x93\x46\x86\x07\xe2\x95\xa4\x5e\x29\x94\xe5\xcd\x75\x8b\xc3\xf3\xe1\xe6\x9a\x96\xf1\x4a\x5e\x3c\xf4\x69\x1b\xa0\x96\x49\x35\xe3\xfb\x3f\x42\xfd\x11\x00\x00\xff\xff\x63\xb0\x0e\x0c\x24\x0b\x00\x00") func webUiTemplatesServiceDiscoveryHtmlBytes() ([]byte, error) { return bindataRead( @@ -246,7 +246,7 @@ func webUiTemplatesServiceDiscoveryHtml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "web/ui/templates/service-discovery.html", size: 2528, mode: os.FileMode(420), modTime: time.Unix(1519919461, 0)} + info := bindataFileInfo{name: "web/ui/templates/service-discovery.html", size: 2852, mode: os.FileMode(420), modTime: time.Unix(1528121552, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -531,7 +531,7 @@ func webUiStaticJsProm_consoleJs() (*asset, error) { return a, nil } -var _webUiStaticJsTargetsJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x55\x4d\x6f\xdb\x38\x10\xbd\xeb\x57\x0c\x08\x1f\x28\xc0\x16\x82\xbd\x7a\x7d\x58\x2c\x16\xd8\xf6\xd2\x43\xd2\x73\x40\x93\x63\x91\x0d\x4d\x1a\xe4\xa8\x4d\x10\xf8\xbf\x17\xa4\xa8\x2f\xdb\x49\xda\xea\x28\xce\xcc\x9b\xf7\xe6\x71\x78\xe8\x9c\x24\xe3\x1d\x90\x6f\x5b\x8b\x9f\xfd\xfe\x41\xec\x2d\xf2\x7d\x47\xe4\xdd\x1a\xa2\xf6\x9d\x55\xff\x3d\x9f\x84\x53\xf5\x6b\x05\x60\x0e\x50\x0e\x1b\x8b\xae\x25\x0d\xbb\xdd\x0e\xee\x6a\x78\x85\x80\xd4\x05\xb7\x85\x73\x55\xe2\x16\xc9\x90\xb2\x01\x4a\x6e\xc0\xa3\xff\x8e\xff\x5a\x11\x23\x67\xd2\x5b\x2b\x4e\x11\xd5\x86\x12\x38\xab\x1b\xa1\x54\x39\xc3\x9c\x3d\x3b\xd2\x74\xb4\x9c\x45\xed\x7f\x80\xc5\x18\x59\xbd\xad\x00\xce\x80\x36\xe2\x3b\x10\x57\x65\x26\x84\x6b\xf4\x19\xc4\xd1\x07\x2c\x10\x89\x55\x29\x7d\x12\x01\x1d\x45\xce\x9a\x9c\xb2\x91\xde\x91\x30\x0e\x03\xab\x9b\x83\x71\x8a\xb3\xa1\x54\x2f\xeb\x52\x89\x6d\x75\xae\xaa\x51\x78\xe3\x0c\xf1\x5e\x9d\x15\x67\x05\x80\x44\x68\x91\x22\xab\x1b\x69\x8d\x7c\xe2\x63\x34\x1f\x74\x94\xde\x45\x82\x0c\xf3\x60\xc8\x22\xec\x60\xc5\x49\x9b\x98\x52\x7c\xc4\x48\x9c\xe9\xbf\xc6\x7e\x44\xa2\x4c\x14\x38\x33\x2a\xf1\xc9\x35\xd2\x8c\x86\x24\x2d\xe2\x5b\x7a\x0c\x90\x00\xd6\x4b\x61\xef\xc9\x07\xd1\x62\x13\x91\x3e\x11\x1e\xf9\xd4\xc3\x1a\x46\x9d\x7b\xcd\xd2\x77\x61\xac\x82\xb7\x06\x0a\x1d\x96\xa0\x32\xbd\xdb\xed\x5c\x4e\xee\x77\xba\x19\xa9\x7c\xdc\xce\x41\xd8\x38\xf6\x93\xc6\xdd\x8b\xb4\xe2\xac\xf9\xe6\xf7\x8f\x1a\x85\xc2\x00\x49\x46\x14\x52\xcf\x06\xf2\xb8\x06\x6b\xdc\xd3\x72\x2e\x52\x48\x8d\x2a\x43\xdc\x93\xa0\x34\x9d\x45\xb7\x6d\xe9\x76\xc5\x73\xee\x6c\x34\xa5\x85\xa4\xc5\x75\x91\xdd\x6e\xc1\x69\x54\xe2\x36\xa9\x26\x9a\xbd\x35\xae\x8d\x83\xad\xd8\xfb\x3c\x0f\xc6\x12\x86\x38\x98\xbc\x73\x1a\x85\x25\xfd\xb2\x79\xcb\x8d\x1c\x97\xac\xfb\xc4\xec\x44\x2c\x16\x2e\x48\xfd\xb9\x91\x97\xa7\x8d\xd4\xc6\xaa\x80\x8e\x33\xb3\xb0\x65\x0a\x9d\x99\xa0\xb5\x2f\x27\x9d\xfe\x6d\x3a\x27\x35\xca\xa7\x44\x7f\xe2\x9f\xa3\x17\xf7\xfd\x66\x42\x89\x4e\xdf\xec\xfe\x4f\xa1\x39\x10\xf6\xe4\x36\xa7\x60\x8e\x22\xbc\x4c\xb6\x29\x9a\x4c\x59\x26\x6e\xc6\xba\xa5\xef\x5e\xc5\xeb\x8d\x90\x0d\x93\xb6\xc9\xd7\x41\xd1\x6b\xdf\xbf\xc9\x37\x83\xfc\x2a\xd7\x1b\x04\x3e\xe2\x3c\x93\xe7\x82\xeb\x02\xe3\x4f\xe8\xfe\x63\xed\x85\xd1\xe6\x7b\xaf\x44\xa4\xfb\x33\x66\x0f\x6b\x70\xfa\xd1\xa4\x30\x7e\x23\x75\xd4\xf2\x46\x81\xe2\xb6\xf8\x7f\x1f\x91\x2d\x37\x2b\xd9\x6f\xc4\xbc\x1c\xfb\x7b\x27\x13\x47\x56\x37\xc6\x29\x7c\xfe\x72\xe0\x4c\x09\xd7\x26\x2e\xf0\x37\xdc\x6d\xcb\x63\x36\x96\x4b\x4f\xdd\xa2\x9e\x36\x0a\x79\x9d\xde\xbd\x73\x55\xad\x78\x5a\xe8\xf5\xb6\xfa\x19\x00\x00\xff\xff\x16\x00\xb8\x4b\x5a\x07\x00\x00") +var _webUiStaticJsTargetsJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x55\xcb\x6e\xdb\x30\x10\xbc\xeb\x2b\x16\x84\x0f\x14\x60\x0b\x41\xaf\xae\x0f\x45\x51\xa0\xed\xa5\x87\xa4\xe7\x80\xa6\xd6\x22\x1b\x9a\x34\xc8\x55\x1b\x23\xf0\xbf\x17\xa4\xa8\x97\x1f\x49\x53\x1d\xb5\x8f\xd9\x99\x1d\xad\x76\xad\x95\xa4\x9d\x05\x72\x4d\x63\xf0\xbb\xdb\x3e\x88\xad\x41\xbe\x6d\x89\x9c\x5d\x42\x50\xae\x35\xf5\x97\xe7\x83\xb0\x75\xf9\x52\x00\xe8\x1d\xe4\x60\x65\xd0\x36\xa4\x60\xb3\xd9\xc0\x5d\x09\x2f\xe0\x91\x5a\x6f\xd7\x70\x2a\x72\xde\xac\x18\x62\x35\x40\xae\xf5\xb8\x77\xbf\xf1\xb3\x11\x21\x70\x26\x9d\x31\xe2\x10\xb0\x5e\x51\x04\x67\x65\x25\xea\x3a\xc7\x30\x55\x4f\x42\x8a\xf6\x86\xb3\xa0\xdc\x1f\x30\x18\x02\x2b\xd7\x05\xc0\x09\xd0\x04\x7c\x05\xe2\xa2\xcd\x88\x70\x89\x3e\x81\xd8\x3b\x8f\x19\x22\xb2\xca\xad\x0f\xc2\xa3\xa5\xc0\x59\x95\x4a\x56\xd2\x59\x12\xda\xa2\x67\x65\xb5\xd3\xb6\xe6\xac\x6f\xd5\xc9\x3a\x57\x62\xfd\x9e\x46\xd5\x38\x1e\x1a\xdc\xa3\xa5\x9b\x5d\x4f\x45\x31\xac\x53\x5b\x4d\xbc\xd3\x7c\xc1\x59\x46\x23\xe1\x1b\xa4\xc0\xca\x4a\x1a\x2d\x9f\xf8\x90\xcd\xfb\xed\x48\x67\x03\x41\x9a\xe5\x41\x93\x41\xd8\xc0\x82\x93\xd2\x21\x96\xb8\x80\x81\x38\x53\x1f\x86\xe1\x44\x14\x92\xc8\x73\xa6\xeb\xa8\x52\xea\x11\x37\xdf\x17\x29\x11\x6e\xa9\xdc\x43\x02\x18\x27\x85\xb9\x27\xe7\x45\x83\x55\x40\xfa\x46\xb8\xe7\xe3\x0c\x4b\x18\xb6\xd7\x6d\x22\x3e\x67\x76\xcd\x78\x4b\x20\xdf\x62\x4e\xca\x9e\xb8\x3e\xce\xb9\x1f\xde\x33\xcd\x40\xe5\xed\x71\x76\xc2\x84\x61\x9e\x68\xa2\x4e\xa4\x05\x67\xd5\x2f\xb7\x7d\x54\x28\x6a\xf4\x10\x65\x44\x21\xd5\x64\x21\x8f\x4b\x30\xda\x3e\xcd\xf7\x22\x85\x54\x58\x27\x88\x7b\x12\x14\xb7\x33\x9b\xb6\xc9\xd3\x2e\x78\xaa\x9d\xac\x26\x8f\x10\xb5\xb8\x6c\xb2\xd9\xcc\x38\x0d\x4a\x5c\x27\x55\x05\xbd\x35\xda\x36\xa1\xb7\x15\x7b\x9d\xe7\x4e\x1b\x42\x1f\x7a\xc7\xb7\x56\xa1\x30\xa4\x8e\xab\x5b\x6e\xe4\x38\x67\xdd\x15\x26\x27\x62\xb6\x70\x46\xea\xe2\x5a\x9e\x47\x2b\xa9\xb4\xa9\x3d\x5a\xce\xf4\xcc\x96\x31\x75\x62\x82\xc6\x1c\x0f\x2a\xbe\x5b\xb5\x56\x2a\x94\x4f\x91\xfe\xc8\x3f\x65\xcf\xae\xc8\xd5\x82\x9c\x1d\x9f\xc9\x55\x19\x53\x53\x22\x6c\xc9\xae\x0e\x5e\xef\x85\x3f\x8e\xb6\xc9\x9a\x8c\x55\x3a\xac\x86\xbe\x79\xee\x4e\xc5\xcb\xf3\x90\x0c\x13\x6f\xd4\xcf\x5e\xd1\x4b\xdf\xdf\xe4\x9b\x40\xfe\x95\xeb\x15\x02\x6f\x71\x9e\xc8\x73\xc6\x75\x86\xf1\x3f\x74\x3f\x19\x73\x66\xb4\xe9\xdd\xcb\x19\xf1\xfb\x19\xaa\xfb\x33\x38\xbe\xa8\x62\x1a\xbf\x52\x3a\x68\x79\xa5\x41\x76\x5b\xf8\xda\x65\x24\xcb\x4d\x5a\x76\x17\x31\x1d\xc7\xee\xbb\x93\x91\x23\x2b\x2b\x6d\x6b\x7c\xfe\xb1\xe3\xac\x16\xb6\x89\x5c\xe0\x23\xdc\xad\xf3\x2f\x72\x68\x17\x7f\xa0\xb3\x7e\x4a\xd7\xc8\xcb\xf8\x37\x3d\x15\xc5\x82\xc7\x83\x5e\xae\x8b\xbf\x01\x00\x00\xff\xff\x77\x65\x76\xad\xb0\x07\x00\x00") func webUiStaticJsTargetsJsBytes() ([]byte, error) { return bindataRead( @@ -546,7 +546,7 @@ func webUiStaticJsTargetsJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "web/ui/static/js/targets.js", size: 1882, mode: os.FileMode(420), modTime: time.Unix(1511992584, 0)} + info := bindataFileInfo{name: "web/ui/static/js/targets.js", size: 1968, mode: os.FileMode(420), modTime: time.Unix(1528120974, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/web/ui/static/js/targets.js b/web/ui/static/js/targets.js index c46614a61..1d0651923 100644 --- a/web/ui/static/js/targets.js +++ b/web/ui/static/js/targets.js @@ -8,6 +8,7 @@ function toggleJobTable(button, shouldExpand){ } button.parents(".table-container").find("table").toggle(shouldExpand); + button.parents(".table-container").find(".collapsed-element").toggle(shouldExpand); } function init() { diff --git a/web/ui/templates/service-discovery.html b/web/ui/templates/service-discovery.html index 6e0d937c8..e48957255 100644 --- a/web/ui/templates/service-discovery.html +++ b/web/ui/templates/service-discovery.html @@ -22,20 +22,27 @@ {{$targets := .Targets}} - {{range $job := .Index}} + {{range $i, $job := .Index}}

{{$job}}

+ {{with index $.Dropped $i}} + {{if gt . 100 }} + + {{end}} + {{end}} diff --git a/web/web.go b/web/web.go index d7e00441b..443f0bc91 100644 --- a/web/web.go +++ b/web/web.go @@ -600,10 +600,34 @@ func (h *Handler) serviceDiscovery(w http.ResponseWriter, r *http.Request) { scrapeConfigData := struct { Index []string Targets map[string][]*scrape.Target + Active []int + Dropped []int + Total []int }{ Index: index, - Targets: targets, + Targets: make(map[string][]*scrape.Target), + Active: make([]int, len(index)), + Dropped: make([]int, len(index)), + Total: make([]int, len(index)), } + for i, job := range scrapeConfigData.Index { + scrapeConfigData.Targets[job] = make([]*scrape.Target, 0, len(targets[job])) + scrapeConfigData.Total[i] = len(targets[job]) + for _, target := range targets[job] { + // Do not display more than 100 dropped targets per job to avoid + // returning too much data to the clients. + if target.Labels().Len() == 0 { + scrapeConfigData.Dropped[i]++ + if scrapeConfigData.Dropped[i] > 100 { + continue + } + } else { + scrapeConfigData.Active[i]++ + } + scrapeConfigData.Targets[job] = append(scrapeConfigData.Targets[job], target) + } + } + h.executeTemplate(w, "service-discovery.html", scrapeConfigData) } From 32324f79c746a733f8c76bc1eace3a664b8ea5c5 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 5 Jun 2018 05:33:04 -0400 Subject: [PATCH 2/2] vendour: update prometheus/tsdb Signed-off-by: Fabian Reinartz --- vendor/github.com/prometheus/tsdb/README.md | 2 ++ vendor/github.com/prometheus/tsdb/block.go | 15 ++++----- vendor/github.com/prometheus/tsdb/db.go | 34 ++++++++++++++------- vendor/vendor.json | 26 ++++++++-------- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/vendor/github.com/prometheus/tsdb/README.md b/vendor/github.com/prometheus/tsdb/README.md index 2d72fcf47..737020c4d 100644 --- a/vendor/github.com/prometheus/tsdb/README.md +++ b/vendor/github.com/prometheus/tsdb/README.md @@ -7,4 +7,6 @@ This repository contains the Prometheus storage layer that is used in its 2.x re A writeup of its design can be found [here](https://fabxc.org/blog/2017-04-10-writing-a-tsdb/). +Video: [Storing 16 Bytes at Scale](https://youtu.be/b_pEevMAC3I) from [PromCon 2017](https://promcon.io/2017-munich/). + See also the [format documentation](docs/format/README.md). diff --git a/vendor/github.com/prometheus/tsdb/block.go b/vendor/github.com/prometheus/tsdb/block.go index e3760df76..9ae2adbde 100644 --- a/vendor/github.com/prometheus/tsdb/block.go +++ b/vendor/github.com/prometheus/tsdb/block.go @@ -468,9 +468,9 @@ Outer: return writeMetaFile(pb.dir, &pb.meta) } -// CleanTombstones will rewrite the block if there any tombstones to remove them -// and returns if there was a re-write. -func (pb *Block) CleanTombstones(dest string, c Compactor) (bool, error) { +// CleanTombstones will remove the tombstones and rewrite the block (only if there are any tombstones). +// If there was a rewrite, then it returns the ULID of the new block written, else nil. +func (pb *Block) CleanTombstones(dest string, c Compactor) (*ulid.ULID, error) { numStones := 0 pb.tombstones.Iter(func(id uint64, ivs Intervals) error { @@ -480,14 +480,15 @@ func (pb *Block) CleanTombstones(dest string, c Compactor) (bool, error) { }) if numStones == 0 { - return false, nil + return nil, nil } - if _, err := c.Write(dest, pb, pb.meta.MinTime, pb.meta.MaxTime); err != nil { - return false, err + uid, err := c.Write(dest, pb, pb.meta.MinTime, pb.meta.MaxTime) + if err != nil { + return nil, err } - return true, nil + return &uid, nil } // Snapshot creates snapshot of the block into dir. diff --git a/vendor/github.com/prometheus/tsdb/db.go b/vendor/github.com/prometheus/tsdb/db.go index db9564375..28cb14f33 100644 --- a/vendor/github.com/prometheus/tsdb/db.go +++ b/vendor/github.com/prometheus/tsdb/db.go @@ -835,34 +835,46 @@ func (db *DB) Delete(mint, maxt int64, ms ...labels.Matcher) error { } // CleanTombstones re-writes any blocks with tombstones. -func (db *DB) CleanTombstones() error { +func (db *DB) CleanTombstones() (err error) { db.cmtx.Lock() defer db.cmtx.Unlock() start := time.Now() defer db.metrics.tombCleanTimer.Observe(time.Since(start).Seconds()) + newUIDs := []ulid.ULID{} + defer func() { + // If any error is caused, we need to delete all the new directory created. + if err != nil { + for _, uid := range newUIDs { + dir := filepath.Join(db.Dir(), uid.String()) + if err := os.RemoveAll(dir); err != nil { + level.Error(db.logger).Log("msg", "failed to delete block after failed `CleanTombstones`", "dir", dir, "err", err) + } + } + } + }() + db.mtx.RLock() blocks := db.blocks[:] db.mtx.RUnlock() - deleted := []string{} + deletable := []string{} for _, b := range blocks { - ok, err := b.CleanTombstones(db.Dir(), db.compactor) - if err != nil { - return errors.Wrapf(err, "clean tombstones: %s", b.Dir()) - } - - if ok { - deleted = append(deleted, b.Dir()) + if uid, er := b.CleanTombstones(db.Dir(), db.compactor); er != nil { + err = errors.Wrapf(er, "clean tombstones: %s", b.Dir()) + return err + } else if uid != nil { // New block was created. + deletable = append(deletable, b.Dir()) + newUIDs = append(newUIDs, *uid) } } - if len(deleted) == 0 { + if len(deletable) == 0 { return nil } - return errors.Wrap(db.reload(deleted...), "reload blocks") + return errors.Wrap(db.reload(deletable...), "reload blocks") } func intervalOverlap(amin, amax, bmin, bmax int64) bool { diff --git a/vendor/vendor.json b/vendor/vendor.json index 75e095d00..1c5c47c51 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -820,40 +820,40 @@ "revisionTime": "2016-04-11T19:08:41Z" }, { - "checksumSHA1": "e7QdIY1+bs+75qObh1MLVdGNLvE=", + "checksumSHA1": "eohOTRwnox/+qrSrgYmnxeJB2yM=", "path": "github.com/prometheus/tsdb", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "QI0UME2olSr4kH6Z8UkpffM59Mc=", "path": "github.com/prometheus/tsdb/chunkenc", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "746Mjy2y6wdsGjY/FcGhc8tI4w8=", "path": "github.com/prometheus/tsdb/chunks", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "dnyelqeik/xHDRCvCmKFv/Op9XQ=", "path": "github.com/prometheus/tsdb/fileutil", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "A2uIFwIgeHmXGBzOpna95kM80RY=", "path": "github.com/prometheus/tsdb/index", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "Va8HWvOFTwFeewZFadMAOzNGDps=", "path": "github.com/prometheus/tsdb/labels", - "revision": "ae33d7873d94cec6b3da3ffbf903b3b35a2db9ee", - "revisionTime": "2018-05-29T19:14:13Z" + "revision": "c848349f07c83bd38d5d19faa5ea71c7fd8923ea", + "revisionTime": "2018-06-05T09:24:13Z" }, { "checksumSHA1": "5SYLEhADhdBVZAGPVHWggQl7H8k=",