-
Notifications
You must be signed in to change notification settings - Fork 107
mt-gateway: support ingesting data into kafka #1608
Conversation
To be sure I understand this diff right, this doesn't change the Sarama version, it only adds another package right? I'm asking because when changing Sarama versions it's usually a good idea to do some benchmarks to verify that there are no regressions. |
And currently none of this code which gets added is actually being used, right? That's all going to be used by your new http gateway? |
By merging the dependencies of the mt-gateway into the MT repo separately before they actually get used, isn't there a risk that we accidentally copy more stuff from tsdb-gw than what's actually going to be used and this will then be left there as dead code, or are you sure that all of this is needed? |
Yes that is correct. I thought the same thing at first glance, but it only adds I understand that breaking it up like this makes for smaller and easier to read PRs, but in this case it does seem a little bit awkward. I think this should be part of the PR that uses this code in the HTTP proxy. Since #1602 is already merged, can we just rename this PR and add the HTTP proxy changes here as well? It is easy enough to review commit by commit.
We probably should take a look at everything
That would be easier to determine once we see some of the implementation
I don't think we need to maintain the instrumentation unless there is a good reason for it. |
Correct, @robert-milan
yep
Yeah, good call. This was mostly an attempt to unblock myself while #1602 was waiting on reviews... now that it's merged, I'll rebase and work on wiring things up wire things up |
…mpile at the moment)
publish
package and dependencies from raintank/tsdb-gw
cmd/mt-gateway/ingest/metrics.go
Outdated
default: | ||
log.Errorf("unable to read request body. %s", err) | ||
ctx.JSON(500, err) | ||
w.WriteHeader(500) | ||
fmt.Fprintf(w, "unable to read request body. %s", err) |
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.
there's a repeating pattern of writing a status code header, then writing a message on the following line, and in some cases also log a line with the same msg.
would it make sense to put these into a small helper like writeStatus(w, 499, "request cancelled", true)
(the last param could determine whether to log).
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, that had crossed my mind.
Skipped the boolean and just always log @ error (successful ingestions take a different code path)
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.
Looks good, just a few minor comments
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.
LGTM
Initial portion of this PR was porting the
github.com/raintank/tsdb-gw/publish
package to this repository for use in a new HTTP proxy (see https://github.com/grafana/metrictank-ops/issues/542 if you have access).The portion after this comment (specifically after the force push) pulls in the actual API endpoint and wires it up to Kafka.
A couple design decisions:
isAdmin=true
path is always taken.Once again, the latter portion of this PR is intended to be reviewed commit by commit.
Open questions:
docker-dev-custom-cfg-kafka
alongsidetsdb-gw
for now