Skip to content

Commit

Permalink
Fix Marco's comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
  • Loading branch information
codesome committed Feb 12, 2021
1 parent 1b4ee91 commit 92657d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* [FEATURE] Overrides Exporter: Add `overrides-exporter` module for exposing per-tenant resource limit overrides as metrics. It is not included in `all` target, and must be explicitly enabled. #3785
* [FEATURE] Experimental thanosconvert: introduce an experimental tool `thanosconvert` to migrate Thanos block metadata to Cortex metadata. #3770
* [FEATURE] Alertmanager: It now shards the `/api/v1/alerts` API using the ring when sharding is enabled. #3671
* Added `NewMaxBytesHandler` in the utils package for limiting the size of http request body.
* Added `-alertmanager.max-recv-msg-size` (defaults to 16M) to limit the size of HTTP request body handled by the alertmanager.
* New flags added for communication between alertmanagers:
* `-alertmanager.max-recv-msg-size`
* `-alertmanager.alertmanager-client.remote-timeout`
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ The `alertmanager_config` configures the Cortex alertmanager.
# CLI flag: -alertmanager.configs.poll-interval
[poll_interval: <duration> | default = 15s]
# Maximum size (bytes) of an accepted HTTP request body size.
# Maximum size (bytes) of an accepted HTTP request body.
# CLI flag: -alertmanager.max-recv-msg-size
[max_recv_msg_size: <int> | default = 16777216]
Expand Down
8 changes: 4 additions & 4 deletions pkg/alertmanager/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ func (d *Distributor) doWrite(userID string, w http.ResponseWriter, r *http.Requ

var firstSuccessfulResponse *httpgrpc.HTTPResponse
var firstSuccessfulResponseMtx sync.Mutex
grpcHeaders := httpTogrpchttpHeaders(r.Header)
grpcHeaders := httpToHttpgrpcHeaders(r.Header)
err = ring.DoBatch(r.Context(), RingOp, d.alertmanagerRing, []uint32{shardByUser(userID)}, func(am ring.InstanceDesc, _ []int) error {
// Use a background context to make sure all alertmanagers get the request even if we return early.
localCtx := user.InjectOrgID(context.Background(), userID)
sp, localCtx := opentracing.StartSpanFromContext(localCtx, "Distribute.doWrite")
sp, localCtx := opentracing.StartSpanFromContext(localCtx, "Distributor.doWrite")
defer sp.Finish()

resp, err := d.doRequest(localCtx, am, &httpgrpc.HTTPRequest{
Expand Down Expand Up @@ -171,7 +171,7 @@ func (d *Distributor) doRead(userID string, w http.ResponseWriter, r *http.Reque
return
}

sp, ctx := opentracing.StartSpanFromContext(r.Context(), "Distribute.doRead")
sp, ctx := opentracing.StartSpanFromContext(r.Context(), "Distributor.doRead")
defer sp.Finish()
// Until we have a mechanism to combine the results from multiple alertmanagers,
// we forward the request to only only of the alertmanagers.
Expand Down Expand Up @@ -223,7 +223,7 @@ func shardByUser(userID string) uint32 {
return ringHasher.Sum32()
}

func httpTogrpchttpHeaders(hs http.Header) []*httpgrpc.Header {
func httpToHttpgrpcHeaders(hs http.Header) []*httpgrpc.Header {
result := make([]*httpgrpc.Header, 0, len(hs))
for k, vs := range hs {
result = append(result, &httpgrpc.Header{
Expand Down
2 changes: 1 addition & 1 deletion pkg/alertmanager/multitenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const (
func (cfg *MultitenantAlertmanagerConfig) RegisterFlags(f *flag.FlagSet) {
f.StringVar(&cfg.DataDir, "alertmanager.storage.path", "data/", "Base path for data storage.")
f.DurationVar(&cfg.Retention, "alertmanager.storage.retention", 5*24*time.Hour, "How long to keep data for.")
f.Int64Var(&cfg.MaxRecvMsgSize, "alertmanager.max-recv-msg-size", 16<<20, "Maximum size (bytes) of an accepted HTTP request body size.")
f.Int64Var(&cfg.MaxRecvMsgSize, "alertmanager.max-recv-msg-size", 16<<20, "Maximum size (bytes) of an accepted HTTP request body.")

f.Var(&cfg.ExternalURL, "alertmanager.web.external-url", "The URL under which Alertmanager is externally reachable (for example, if Alertmanager is served via a reverse proxy). Used for generating relative and absolute links back to Alertmanager itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Alertmanager. If omitted, relevant URL components will be derived automatically.")

Expand Down

0 comments on commit 92657d3

Please sign in to comment.