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

[query] add an endpoint to ingest results #2224

Merged
merged 14 commits into from
Mar 30, 2020
Merged

Conversation

arnikola
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Mar 23, 2020

Codecov Report

Merging #2224 into master will increase coverage by <.1%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #2224     +/-   ##
========================================
+ Coverage    72.4%   72.4%   +<.1%     
========================================
  Files        1023    1023             
  Lines       89094   89067     -27     
========================================
+ Hits        64551   64561     +10     
+ Misses      20202   20181     -21     
+ Partials     4341    4325     -16
Flag Coverage Δ
#aggregator 82.1% <ø> (ø) ⬆️
#cluster 85.2% <ø> (ø) ⬆️
#collector 82.8% <ø> (ø) ⬆️
#dbnode 79.1% <ø> (+0.1%) ⬆️
#m3em 74.4% <ø> (ø) ⬆️
#m3ninx 74.4% <ø> (ø) ⬆️
#m3nsch 51.1% <ø> (ø) ⬆️
#metrics 17.5% <ø> (ø) ⬆️
#msg 74.9% <ø> (ø) ⬆️
#query 68.9% <100%> (ø) ⬆️
#x 83.1% <ø> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8584d9a...0dae944. Read the comment docs.

}

// GetOrGenID gets the ID for this result.
func (r *Series) GetOrGenID() string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

super nit: IDOrGenID()? Since Go keeps harping on about removing word "Get.." prefix on getter like things?

name := q.opts.tagOptions.MetricName()
for _, matcher := range query.TagMatchers {
if bytes.Equal(name, matcher.Name) {
iters = q.handler.getSeriesIterators(string(matcher.Value))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Do you want to break if you set iters to something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call

@@ -0,0 +1,201 @@
// Copyright (c) 2019 Uber Technologies, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: 2020

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops thought i got them all 👍


buf := []byte(series[0])
seriesList := make([]parser.Series, 0, 10)
if err := json.Unmarshal(buf, &series); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, any reason not to just unmarshal the whole request body rather than something in the "series" encoded form contents?

i.e.

type seriesLoadRequest struct {
  Series []parser.Series `json:"series"`
}

func (l *seriesLoadHandler) serveHTTP(r *http.Request) error {
  defer r.Body.Close()
 
  var req seriesLoadRequest
  if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
    // ....
  } 

Just seems slighlty non-standard to encode to JSON, then to encode to multipart-form, rather than just single level of serialization (i.e. just JSON).

}
}

if l.nameIDSeriesMap == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This should never be nil since you create it in the constructor yeah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops yeah, old path

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

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

LGTM other than minor comments/nits

@arnikola arnikola merged commit e883ab3 into master Mar 30, 2020
@arnikola arnikola deleted the arnikola/comparator-load branch March 30, 2020 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants