-
Notifications
You must be signed in to change notification settings - Fork 453
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
Conversation
robskillington
commented
Oct 9, 2018
•
edited
Loading
edited
- Tests
"net/http" | ||
|
||
"github.com/m3db/m3/src/collector/reporter" | ||
"github.com/m3db/m3/src/query/api/v1/handler" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good call, cheers.
src/collector/config/m3collector.yml
Outdated
|
||
client: | ||
placementKV: | ||
namespace: /r2/m3aggregator |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing.
src/collector/config/m3collector.yml
Outdated
placementKV: | ||
namespace: /r2/m3aggregator | ||
placementWatcher: | ||
key: placement |
There was a problem hiding this comment.
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?
src/collector/config/m3collector.yml
Outdated
matcher: | ||
initWatchTimeout: 10s | ||
rulesKVConfig: | ||
namespace: /r2/rules |
There was a problem hiding this comment.
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
src/collector/config/m3collector.yml
Outdated
|
||
client: | ||
placementKV: | ||
namespace: /r2/m3aggregator |
There was a problem hiding this comment.
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 Report
@@ Coverage Diff @@
## master #1050 +/- ##
=======================================
Coverage 77.48% 77.48%
=======================================
Files 535 535
Lines 45661 45661
=======================================
Hits 35381 35381
Misses 8045 8045
Partials 2235 2235
Continue to review full report at Codecov.
|
src/collector/server/server.go
Outdated
|
||
go func() { | ||
logger.Info("starting server", zap.String("address", listenAddress)) | ||
if err := srv.ListenAndServe(); err != nil { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:stamp:
4d287e1
to
2f4da96
Compare