Commit graph

531 commits

Author SHA1 Message Date
Bplotka 1823ae8bc4 Fixed int64 overflow for timestamp in v1/api parseDuration and parseTime (#2501)
* Fixed int64 overflow for timestamp in v1/api parseDuration and parseTime

This led to unexpected results on wrong query with "(...)&start=148966367200.372&end=1489667272.372"
That query is wrong because of `start > end` but actually internal int64 overflow caused start to be something around MinInt64 (huge negative value) and was passing validation.

BTW: Not sure if negative timestamp makes sense even.. But model.Earliest is actually MinInt64, can someone explain me why?

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>

* Added missing trailing periods on comments.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>

* MOved to only `<` and `>`. Removed equal.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
2017-03-16 15:16:20 +01:00
Fabian Reinartz de1e4322d7 Merge pull request #2474 from Gouthamve/custom-timeouts-1399
Support Custom Timeout for Queries
2017-03-12 14:20:59 +01:00
Erdem Agaoglu 90625b0400 Use revision as cachebuster 2017-03-07 18:03:52 +03:00
Goutham Veeramachaneni 4b0270290b
Fix comments to match convention 2017-03-06 23:21:27 +05:30
Goutham Veeramachaneni c6b329c55b
Support Custom Timeouts for Queries 2017-03-06 23:02:21 +05:30
Goutham Veeramachaneni 6634984a38
Comments and Typo Fixes 2017-03-06 17:16:37 +05:30
Erdem Agaoglu 241da87f7f Adding version to names of static files
to prevent browsers using old files in local caches after an upgrade.
2017-03-03 23:36:06 +03:00
Derek Marcotte 0a7fb56b16 Expose PromConsole.Graph.buildQueryUrl, refactor dispatch to use (#2461)
Expose buildQueryUrl, refactor dispatch to use

buildQueryUrl will allow users to execute queries over the range of an
existing graph.  This will be helpful to select data series they wish to
annotate the graph with, for example.
2017-03-01 22:37:50 +00:00
Julius Volz 7e14533b32 Merge pull request #2396 from lightpriest/fuzzy-fix-lookup
Fix fuzzy search lookup issues
2017-02-28 19:06:30 +01:00
Derek Marcotte 74a3b1051a Add rickshawGraph proerty to the Graph object. (#2438)
Add rickshawGraph property to the Graph object.

This allows further changes to be made to the graph, for example,
annotations.
2017-02-18 10:03:32 +00:00
Or Cohen 93d20d2d2b Improve fuzzy search
The fuzzy library didn't try to find a "best match", but settled on the
first fuzzy match that exists. This patch includes a modified version of
the fuzzy library, which recursivley tries on the rest of the search
string to find a better match. If found, returns that one.

Another small modification is that if a pattern fully matches, it
skips the lookup entirley and returns the highest score possible for
that match.
2017-02-05 17:38:05 +02:00
Or Cohen 81d37a04aa Fix autocomplete misses certain queries
For some of the queries, the fuzzy lookup was not filtering properly.
The problem is due to the "replace" beind made on the query itself. It
accidently removes only the first underscore. This patch changes it so
that it removes all of the whitespaces, letting the fuzzy algorithm do
its magic, also fixing this problem.

Originally, the underscore were replaced by a space for this specific
reason, to let the user type a space and have the lookup treat it as the
word break.

Fixes #2380
2017-02-05 16:20:52 +02:00
Frederic Branczyk bd92571bdd
web/api: make target and alertmanager api responses consistent 2017-01-16 11:53:00 +01:00
Frederic Branczyk 389c6d0043
web/api: add alertmanager api 2017-01-13 15:30:20 +01:00
beorn7 767c0709b1 Retrieval: Avoid copying Target
retreival.Target contains a mutex. It was copied in the Targets()
call. This potentially can wreak a lot of havoc.

It might even have caused the issues reported as #2266 and #2262 .
2017-01-06 18:43:41 +01:00
Fabian Reinartz c9f4aea8e2 Merge pull request #2305 from alicebob/favicon
Add a favicon to the web GUI
2017-01-04 10:15:27 +01:00
Ed Schouten b3a39ccd8a Use lexicographic order to sort alerts by name.
Right now the /alerts page of Prometheus sorts alerts by severity
(firing, pending, inactive). Once multiple alerts have the same
severity, their order seems to correlate to how they are placed in the
configuration files, but not always. Looking at the code, we make use of
sort.Sort(), which is documented not to provide a stable sort. The
Less() function also only takes the alert state into account.

This change extends the Less() function to provide a lexicographic order
on both the alert state and the name. This means I can finally find the
alerts I'm looking for without using my browser's search feature.
2016-12-27 14:28:44 +01:00
Harmen 135d32ea22 make assets 2016-12-27 13:59:20 +01:00
Harmen dfa4f79bcd add favicon 2016-12-27 13:58:51 +01:00
Brian Brazil bed4635802 Use irate consistently in console template examples. (#2296)
I must have forgotten my 'g' when switching these.
2016-12-21 13:19:23 +00:00
Brian Brazil 2e3b42ad6c Correctly handle the end time being 0 in the URL. (#2290) 2016-12-18 19:30:52 +00:00
Fabian Reinartz 9ecea36ef9 Merge pull request #2259 from prometheus/federationerr
web: don't return federation errors over HTTP
2016-12-06 16:18:03 +01:00
Fabian Reinartz cef2e04aa3 web: add error counter for federation responses 2016-12-06 16:09:50 +01:00
Fabian Reinartz 0ea0a19848 Merge pull request #2240 from agaoglu/read-timeout
Set read-timeout for http.Server
2016-12-06 16:01:45 +01:00
Fabian Reinartz 9d68e81b32 web: don't return federation errors over HTTP
We are writing federation responses streaming. So after
the first byte we wrote, the status header is fixed. We cannot
return an HTTP error for intermediate error but should just abort
and log instead.
2016-12-06 15:52:50 +01:00
Erdem Agaoglu e487477a17 LimitListener to limit max number of connections
This also drops tcp keep-alive in ListenAndServe but it's no longer
necessary since we now close idle connections long before that.
2016-12-06 12:45:59 +03:00
Morten Siebuhr c5b17263a6 web: Display current working directory on status-page 2016-12-05 19:46:41 +01:00
Frederic Branczyk 33b583d50e
web/api: add targets endpoint 2016-12-05 13:13:21 +01:00
Frederic Branczyk 8f8cea4fbd
retrieval: refactor TargetManager to return flat list of Targets 2016-12-02 13:28:58 +01:00
Erdem Agaoglu 9986b28380 Set read-timeout for http.Server
This also specifies a timeout for idle client connections, which may
cause "too many open files" errors.
See #2238
2016-12-01 16:29:45 +03:00
Fabian Reinartz d4deb8bbf2 web: show discovered Alertmanagers in UI 2016-11-24 15:06:50 +01:00
Martín Ferrari 4298d91a9c Update bindata.go 2016-11-17 02:33:31 +00:00
Martín Ferrari fe83ea511f Replace handlebars with the simpler and saner mustache library. 2016-11-17 02:33:12 +00:00
Martín Ferrari 0a6972b6a3 Replace datetimepicker library with a more maintained version.
Adds also the moment.js library, which is a dependency of it.

Following conventions in the web/ui directory, I am not including the original
sources or LICENSE files.
2016-11-17 02:29:08 +00:00
Brian Brazil 79f8514c9c Point user to POST if they try to GET /-/reload (#2172) 2016-11-07 15:14:22 +00:00
Fabian Reinartz 30af47535d Merge remote-tracking branch 'origin/release-1.2' 2016-11-01 15:42:13 +01:00
Anders Daljord Morken 5c025a2f41 query_range: Validate that start comes before end 2016-11-01 15:28:28 +01:00
beorn7 5b16d6bd6e Merge branch 'release-1.2' 2016-10-31 00:06:23 +01:00
beorn7 f0acde7721 Regenerate assets after cherry-pick 2016-10-28 14:16:48 +02:00
Stuart Olivera 223a22457f ui: don’t consider aborted requests complete
If an existing request is aborted due to a new request, ignore the completion of the initial request.

Example:
1. Chrome dev tools: enable 5 second network latency
2. Execute query
3. A second later, execute the query again
4. Currently, the spinner will hide, and the stats will immediately display, as if the request had completed. Instead, the spinner and stats should wait until the 2nd execution finishes.
2016-10-28 14:15:11 +02:00
beorn7 569a1d78eb Regenerate bindata after merge 2016-10-25 12:15:55 +02:00
beorn7 7e4d005ee1 Merge branch 'release-1.2' 2016-10-25 12:15:41 +02:00
tattsun 68e20bd9ac ISSUE-2109 ui: fix decode query params bug 2016-10-25 07:41:24 +09:00
Or Cohen 50f8e35c54 Add fuzzy search to /graph textarea (#2081)
* Add fuzzy search to /graph textarea

We have a few thousands different metrics and looking up some of them
can be quite annoying with the simple string matching.

This patch adds a fuzzy search to the textarea lookup box on the /graph
page. It uses a small neat library from github.com/mattyork/fuzzy.

* Add fuzzy lib to NOTICE and re-build assets

Previously built assets changed the mode.
2016-10-17 09:37:11 +02:00
Fabian Reinartz 630b96c5f3 Merge pull request #2079 from prometheus/fabxc-storage
storage: enhance Querier interface usage
2016-10-16 10:48:51 +02:00
Fabian Reinartz 8fa18d564a storage: enhance Querier interface usage
This extracts Querier as an instantiateable and closeable object
rather than just defining extending methods of the storage interface.
This improves composability and allows abstracting query transactions,
which can be useful for transaction-level caches, consistent data views,
and encapsulating teardown.
2016-10-16 10:39:29 +02:00
Stuart Olivera b76d59e68b ui: don’t consider aborted requests complete
If an existing request is aborted due to a new request, ignore the completion of the initial request.

Example:
1. Chrome dev tools: enable 5 second network latency
2. Execute query
3. A second later, execute the query again
4. Currently, the spinner will hide, and the stats will immediately display, as if the request had completed. Instead, the spinner and stats should wait until the 2nd execution finishes.
2016-10-12 17:20:44 -07:00
Matthias Rampke 4f96d28e60 Always show instance label on target page. (#2062) 2016-10-12 12:45:47 +02:00
Julius Volz 4f79072fd1 Update common/route vendoring for contextFn errors 2016-10-02 23:04:03 +02:00
Julius Volz f92532f254 api: Consolidate web API contexts
This is based on the common/route changes in
https://github.com/prometheus/common/pull/61.
2016-09-21 03:22:20 +02:00
Julius Volz c187308366 storage: Contextify storage interfaces.
This is based on https://github.com/prometheus/prometheus/pull/1997.

This adds contexts to the relevant Storage methods and already passes
PromQL's new per-query context into the storage's query methods.
The immediate motivation supporting multi-tenancy in Frankenstein, but
this could also be used by Prometheus's normal local storage to support
cancellations and timeouts at some point.
2016-09-19 16:29:07 +02:00
Julius Volz ed5a0f0abe promql: Allow per-query contexts.
For Weaveworks' Frankenstein, we need to support multitenancy. In
Frankenstein, we initially solved this without modifying the promql
package at all: we constructed a new promql.Engine for every
query and injected a storage implementation into that engine which would
be primed to only collect data for a given user.

This is problematic to upstream, however. Prometheus assumes that there
is only one engine: the query concurrency gate is part of the engine,
and the engine contains one central cancellable context to shut down all
queries. Also, creating a new engine for every query seems like overkill.

Thus, we want to be able to pass per-query contexts into a single engine.

This change gets rid of the promql.Engine's built-in base context and
allows passing in a per-query context instead. Central cancellation of
all queries is still possible by deriving all passed-in contexts from
one central one, but this is now the responsibility of the caller. The
central query context is now created in main() and passed into the
relevant components (web handler / API, rule manager).

In a next step, the per-query context would have to be passed to the
storage implementation, so that the storage can implement multi-tenancy
or other features based on the contextual information.
2016-09-19 15:38:17 +02:00
Bora Tunca 2e9de70267 generate assets 2016-09-16 18:20:12 -04:00
Bora Tunca 44377dc458 Add backward compatibility to old query format 2016-09-16 18:20:00 -04:00
beorn7 1f2785ebb7 Merge branch 'release-1.1' 2016-09-16 16:33:28 +02:00
beorn7 717dd8adac web: add more federation test scenarios 2016-09-15 15:23:55 +02:00
beorn7 784a8ad7c5 web: Inline httptest.NewRequest because it only exists in Go1.7+ 2016-09-15 15:06:36 +02:00
beorn7 39c4915401 federation: Collapse time series of the same name
This will avoid duplicate MetricFamilies, thereby shrinking the size
of the federation payload and also creating legal text format.

Also, add unit tests for federation. They were also needed for the
previous state of the code, but were missing.
2016-09-14 19:35:20 +02:00
beorn7 094a098ce6 Revert "Revert the /graph changes."
This reverts commit aa43d34a86.

This brings back the /graph changes so that @grandbora can continue to
work on the redirect for backwards compatibility. And other changes
can already take the new /graph parameters into account.
2016-09-03 21:05:23 +02:00
beorn7 aa43d34a86 Revert the /graph changes.
This revert will be reverted once v1.1 is released and has its own
release branch. Since we had already change on top of this, there was
no cleaner way of cutting those changes out.

This commit reverts the following commits:

Revert "Update backend helpers and templates to new url schema"
This reverts commit fc6cdd0611.

Revert "Refactor graph.js"
This reverts commit 445fac56e0.

Revert "Use query parameters in the url"
This reverts commit 3e18d86d8a.

Revert "Point to correct place for GraphLinkForExpression"
This reverts commit 3da825fc76.

Assets are also updated.
2016-09-02 13:59:09 +02:00
Anders Daljord Morken e9885ecb94 Bugfix: Avoid divide-by-zero panic on query_range?step=0 2016-08-16 15:20:34 +02:00
Fabian Reinartz df22684b5b web/ui: fix job link 2016-08-08 19:03:51 +02:00
Fabian Reinartz cfe5c5fa15 Merge branch 'master' of https://github.com/cambridge-university-press/prometheus into cambridge-university-press-master 2016-08-08 10:46:36 +02:00
Bora Tunca 12bcc92311 Generate bindata.go 2016-08-08 09:52:14 +02:00
Bora Tunca 445fac56e0 Refactor graph.js 2016-08-08 09:52:13 +02:00
Bora Tunca 3e18d86d8a Use query parameters in the url 2016-08-06 17:28:18 +02:00
Bora Tunca 3da825fc76 Point to correct place for GraphLinkForExpression 2016-08-06 17:28:18 +02:00
Julius Volz d770783777 Neurotic cleanups to graph.js 2016-08-05 23:35:11 +02:00
Fabian Reinartz 70490fe568 Merge pull request #1805 from prometheus/higher-level-storage-interface
Make the storage interface higher-level.
2016-08-05 16:17:14 +02:00
Harmen 7b4a67f651 make assets build 2016-07-31 16:32:25 +02:00
Harmen 0b883e24ba Add a 'Remove Graph' link to the 'Graph' screen 2016-07-31 16:30:23 +02:00
Andrew Hemming 7ebcd678ea Added HTML link for each job name
Useful for quick navigation on the target page when there are many jobs
and targets

Corrected HTML link for each job name

Regenerated bindata
2016-07-28 17:10:34 +01:00
Tobias Schmidt 5416518178 Fix go fmt of ui/bindata.go 2016-07-27 18:35:01 -04:00
Harmen a1443280b4 make assets build 2016-07-27 12:56:08 +02:00
Harmen 512b3f8d95 Friendlier message when there are no alerting rules 2016-07-27 12:54:46 +02:00
Matt Bostock 78715e4182 Alerts template: remove silence table header
There's no corresponding table column for this table header. The
placeholder link for silences was removed in e8800730.

Accordingly, regenerate `web/ui/bindata.go` by running:

    make assets format
2016-07-26 21:33:21 +01:00
Harmen afc5873b0e don't store empty values in the URL 2016-07-25 21:08:05 +02:00
Julius Volz 3bfec97d46 Make the storage interface higher-level.
See discussion in
https://groups.google.com/forum/#!topic/prometheus-developers/bkuGbVlvQ9g

The main idea is that the user of a storage shouldn't have to deal with
fingerprints anymore, and should not need to do an individual preload
call for each metric. The storage interface needs to be made more
high-level to not expose these details.

This also makes it easier to reuse the same storage interface for remote
storages later, as fewer roundtrips are required and the fingerprint
concept doesn't work well across the network.

NOTE: this deliberately gets rid of a small optimization in the old
query Analyzer, where we dedupe instants and ranges for the same series.
This should have a minor impact, as most queries do not have multiple
selectors loading the same series (and at the same offset).
2016-07-25 13:59:22 +02:00
beorn7 1bb077b5ef Merge branch 'release-1.0' into beorn7/release 2016-07-21 14:55:05 +02:00
beorn7 4ff4857112 Recreate assets 2016-07-21 14:11:09 +02:00
Brian Brazil 56151e57ba Update example console templates to new HTTP API.
Fixes #1819
2016-07-21 14:01:09 +02:00
Brian Brazil 9e58070c04 Merge pull request #1820 from prometheus/console-api
Update example console templates to new HTTP API.
2016-07-18 21:59:21 +01:00
Brian Brazil d458ecd4b9 Update example console templates to new HTTP API.
Fixes #1819
2016-07-18 20:36:47 +01:00
Dmitry Vorobev 273e457da4 web: return status code and error message for config resource 2016-07-15 10:15:24 +02:00
Fabian Reinartz 59d26e8536 web: add -web.route-prefix flag
Fixes #1191
2016-07-07 11:49:16 +02:00
Fabian Reinartz 62af249d06 Merge pull request #1761 from prometheus/fabxc-legacyapi
api: drop legacy API
2016-06-27 14:26:03 +02:00
Fabian Reinartz 425736a377 *: remove last remainers of non-second metrics 2016-06-23 17:50:39 +02:00
Fabian Reinartz 97f62c021e api: drop legacy API 2016-06-23 17:14:32 +02:00
Brian Brazil 4dbe689632 Do our own date parsing in console template graph controls.
Fixes #1442
2016-06-10 10:23:40 +01:00
Fabian Reinartz 25135c3691 web: round last scrape timestamp to milliseconds 2016-06-08 20:23:54 +02:00
David Gstir 2dd80225a4 Fix JS XHR requests in prom_console.js on IE11
IE11 does not support automatic JSON parsing for responses with
xhr.responseType = 'json', so we have to to do it manually.
2016-06-01 19:44:04 +02:00
Julius Volz 194a486c60 Merge pull request #1660 from alileza/add_http_errorlog
Log HTTP server errors using common/log
2016-05-26 15:03:15 -05:00
Ali Reza 624717e801 Log HTTP server errors using common/log
change naming to be more descriptive.
Fixes #1651

remove pointer receiver

use common/log error logger
2016-05-27 00:20:40 +07:00
Roman Vynar 9d616952b3
Added missed pathPrefix to Status sub-menus 2016-05-26 17:42:28 +03:00
beorn7 93460fb853 Remove a spurious "w" from _base.html 2016-05-25 13:59:50 +02:00
Bjoern Rabenstein 52a133d4d2 Make assets without debug settings 2016-05-23 11:13:08 +02:00
beorn7 da8cb10b43 Partition the status tab into items in a dropdown
I got feedback from different sources about rules and targets being
too heavy in the status tab if their are lots of them.

This change also allows for more fine-granular locking.
2016-05-18 18:13:55 +02:00
Fabian Reinartz 54de6afd22 Merge pull request #1625 from prometheus/series-api-time-bounds
Support time range in /api/v1/series endpoint.
2016-05-12 11:53:31 +02:00
Julius Volz 0c1e7a5b00 Support time range in /api/v1/series endpoint.
This adds optional "start" and "end" form values that may be used to
restrict the time range of returned series.

Fixes https://github.com/prometheus/prometheus/issues/1542
2016-05-12 07:28:02 +02:00
Steve Durrheimer 399d5c6375
Make version informations consistent between prometheus components 2016-05-05 22:33:18 +02:00