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

Add m3collector service and config with report endpoint #1050

Merged
merged 7 commits into from
Oct 9, 2018

Conversation

robskillington
Copy link
Collaborator

@robskillington robskillington commented Oct 9, 2018

  • Tests

"net/http"

"github.com/m3db/m3/src/collector/reporter"
"github.com/m3db/m3/src/query/api/v1/handler"
Copy link
Contributor

Choose a reason for hiding this comment

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

query dependencies feel a little weird....probably not much we can do about models / storage right now but if you're only importing the error function I wonder if its worth just duplicating it

Copy link
Contributor

Choose a reason for hiding this comment

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

ah you're using the WriteJSONResponse too...whatever lol

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'll put a todo to clean this up.

Copy link
Collaborator Author

@robskillington robskillington Oct 9, 2018

Choose a reason for hiding this comment

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

Hm, screw it, I'll move it into x/net/http.


func (h *reportHandler) parseRequest(r *http.Request) (*reportRequest, *handler.ParseError) {
body := r.Body
if r.Body == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

should you use the variable you just created?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yup, that's kinda strange. Ta.

func (h *reportHandler) newMetricID(metric metricValue) (id.ID, *handler.ParseError) {
tags := make(models.Tags, 0, len(metric.Tags))
for n, v := range metric.Tags {
tags = tags.AddTag(models.Tag{Name: []byte(n), Value: []byte(v)})
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the tag name has to be a string after JSON deserialization because you can't have []byte be a map key, but can the JSON map be map[string][]byte so we don't have to convert it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nah unfortunately JSON decoder expects []byte types to be base64 encoded strings, so will make this endpoint very hard to use.

This is a super low volume test endpoint, so don't fret too much about perf here.

tags = models.Normalize(tags)
tagsIter := storage.TagsToIdentTagIterator(tags)

encoder := h.encoderPool.Get()
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need a reset here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah good call, cheers.


client:
placementKV:
namespace: /r2/m3aggregator
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the default namespace we want to use? Probably dont want r2 in the name

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's just change this to /m3aggregator? @richardartoul need to use the same in coordinator endpoint and m3agg config

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure thing.

placementKV:
namespace: /r2/m3aggregator
placementWatcher:
key: placement
Copy link
Contributor

Choose a reason for hiding this comment

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

you're watching for m3agg placements right? I think this will be the name of the service in the placement so make this m3agg maybe?

matcher:
initWatchTimeout: 10s
rulesKVConfig:
namespace: /r2/rules
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove /r2 here as well


client:
placementKV:
namespace: /r2/m3aggregator
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's just change this to /m3aggregator? @richardartoul need to use the same in coordinator endpoint and m3agg config

@codecov
Copy link

codecov bot commented Oct 9, 2018

Codecov Report

Merging #1050 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1050   +/-   ##
=======================================
  Coverage   77.48%   77.48%           
=======================================
  Files         535      535           
  Lines       45661    45661           
=======================================
  Hits        35381    35381           
  Misses       8045     8045           
  Partials     2235     2235
Flag Coverage Δ
#aggregator 81.65% <0%> (ø) ⬆️
#collector 61.88% <0%> (ø) ⬆️
#dbnode 81.27% <0%> (ø) ⬆️
#m3em 73.21% <0%> (ø) ⬆️
#m3ninx 75.25% <0%> (ø) ⬆️
#m3nsch 51.19% <0%> (ø) ⬆️
#query 63.32% <0%> (ø) ⬆️
#x 76.2% <0%> (ø) ⬆️

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 8081448...19d68c6. Read the comment docs.


go func() {
logger.Info("starting server", zap.String("address", listenAddress))
if err := srv.ListenAndServe(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldnt this fatal or 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.

Sure thing, I'll make sure err != http.ErrServerClosed too so we don't fatal in the "normal" sigterm case where we explicitly shut it down ourselves (need to retain clean exit).

Copy link
Contributor

@richardartoul richardartoul left a comment

Choose a reason for hiding this comment

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

:stamp:

@robskillington robskillington merged commit c37e065 into master Oct 9, 2018
@robskillington robskillington deleted the r/add-collector-scaffold branch October 9, 2018 23:11
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.

3 participants