Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Promql integration v2 #858

Merged
merged 37 commits into from
Mar 6, 2018
Merged

Promql integration v2 #858

merged 37 commits into from
Mar 6, 2018

Conversation

Dieterbe
Copy link
Contributor

@Dieterbe Dieterbe commented Feb 27, 2018

@jtlisi I want to merge prometheus support asap so I went ahead and addressed all my comments in #852 myself

this comes with a bunch of new commits and also i redid the "update dependencies" commit to not introduce 70MB of unneeded stuff as explained in #852 (comment)
in fact, by pinning gocql to what I think it was supposed to be (this was hard as the last update of our vendored copy of gocql update left out some files and didn't specify a revision) I was able to avoid updating gocql and keep more stuff out of vendor and out of the git repo.

I propose we merge this PR instead of #852
please have a look in general, and in specific:

  1. the Querier method, min and max int64 arguments are these in nanoseconds? (note that we don't actually use this method, we use the more useful one NewQuerier, but we needed it to comply to prometheus' interface)
  2. Per https://github.com/grafana/metrictank/pull/852/files/fa0f8640646960f144d829f8be0c595acf240f53#diff-b79cb0aaeb227c507327bf1b374e73ae I'm not sure we support multiple archives this way, this was the main last blocker I think before merging

jtlisi and others added 28 commits February 27, 2018 14:22
for consistency and also that's how Go works
* organize into separate file
* clean DRY between constructor and Querier interface method for promql
* use constructor where possible, meaning we can pass orgId directly
  instead of as context value and we know there's no error to   check
* fix ns->second conversion
* pass on real context instead of a background one
also:
* newer version of dep uses multi-line format
* it auto-added a bunch of constraints
* needed to pin gocql.
  it was tricky to determine which version our gocql is supposed to be at
  the last update was #778 but we don't know what version of gocql that was exactly.
  None of the versions in gocql's last year of git history matches what we have in our vendor dir,
  in fact, the smallest diff with any version was still about 480 lines; so it looks like not all go files were
  copied over.
  however it seems likely it would have been d9815cdf0ff24e2efa9b8062f4f94a6dd347ae51 because our vendor dir does include that change,
  not some of the later changes, and the time works with that PR.
jtlisi and others added 5 commits February 28, 2018 06:41
We are getting:

```
go vet ./...
api/models/prometheus.go:88: method Seek(t int64) bool should have signature Seek(int64, int) (int64, error)
exit status 1
```

because go vet is too eagerly assuming we're trying to implement
io.Seeker even though our Seek method is not used as such.

Note that `go vet` complains about this code as well, reproducing the issue in isolation:

```
package main

import "fmt"

type A struct {
}

func main() {
	a := A{}
	a.Seek(42)
}

func (a *A) Seek(t int64) bool {
	fmt.Println("this is my seek function", t)
	return true
}
```

Note, go vet's official description is:

""
Vet examines Go source code and reports suspicious constructs, such as
Printf calls whose arguments do not align with the format string. Vet
uses heuristics that do not guarantee all reports are genuine problems,
but it can find errors not caught by the compilers.
"""

i.e. it is expected to occasionally result in false positives.

Note also, from https://golang.org/doc/go1.10#test-vet  :

The go test command now automatically runs go vet on the package being
tested, to identify significant problems before running the test. Any
such problems are treated like build errors and prevent execution of the
test. Only a high-confidence subset of the available go vet checks are
enabled for this automatic check.

Therefore, we should stop relying on the full `go vet` with false positives
and instead we can simply leverage what's built into go test
@Dieterbe
Copy link
Contributor Author

Dieterbe commented Mar 6, 2018

I found the reason for all these irrelevant test flags
github.com/grafana/metrictank/api imports github.com/prometheus/prometheus/promql, and see
prometheus/prometheus#3915

furthermore, metrictank, mt-store-cat, and mt-whisper-importer-reader import github.com/grafana/metrictank/api so those programs get all the irrelevant test flags.

jtlisi and others added 2 commits March 6, 2018 12:46
it's different on every system. in particular, it causes
scripts/qa/docs.sh to complain about bogus diffs
@jtlisi jtlisi mentioned this pull request Mar 6, 2018
@Dieterbe Dieterbe merged commit 58af362 into master Mar 6, 2018
@Dieterbe Dieterbe deleted the promql-integration2 branch September 18, 2018 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants