Skip to content

Get rid of the old ingester http interface #161

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

Merged
merged 1 commit into from
Nov 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions cmd/cortex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,6 @@ func setupIngester(
log.Fatal(err)
}
prometheus.MustRegister(ingester)

router.Path("/push").Handler(http.HandlerFunc(ingester.PushHandler))
router.Path("/query").Handler(http.HandlerFunc(ingester.QueryHandler))
router.Path("/label_values").Handler(http.HandlerFunc(ingester.LabelValuesHandler))
router.Path("/user_stats").Handler(http.HandlerFunc(ingester.UserStatsHandler))
router.Path("/ready").Handler(http.HandlerFunc(ingester.ReadinessHandler))
return ingester
}

Expand Down
30 changes: 11 additions & 19 deletions distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,18 @@ func (d *Distributor) getClientFor(ingester ring.IngesterDesc) (cortex.IngesterC
return client, nil
}

if ingester.GRPCHostname != "" {
conn, err := grpc.Dial(
ingester.GRPCHostname,
grpc.WithInsecure(),
grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(
otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer()),
middleware.ClientUserHeaderInterceptor,
)),
)
if err != nil {
return nil, err
}
client = cortex.NewIngesterClient(conn)
} else {
var err error
client, err = NewHTTPIngesterClient(ingester.Hostname, d.cfg.RemoteTimeout)
if err != nil {
return nil, err
}
conn, err := grpc.Dial(
ingester.GRPCHostname,
grpc.WithInsecure(),
grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(
otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer()),
middleware.ClientUserHeaderInterceptor,
)),
)
if err != nil {
return nil, err
}
client = cortex.NewIngesterClient(conn)

d.clients[ingester.Hostname] = client
return client, nil
Expand Down
149 changes: 0 additions & 149 deletions distributor/http_ingester_client.go

This file was deleted.

18 changes: 18 additions & 0 deletions distributor/http_server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package distributor

import (
"fmt"
"net/http"

"github.com/prometheus/common/log"
Expand All @@ -9,6 +10,23 @@ import (
"github.com/weaveworks/cortex/util"
)

// IngesterError is an error we got from an ingester.
type IngesterError struct {
StatusCode int
err error
}

func errStatusCode(code int, status string) IngesterError {
return IngesterError{
StatusCode: code,
err: fmt.Errorf("server returned HTTP status %s", status),
}
}

func (i IngesterError) Error() string {
return i.err.Error()
}

// PushHandler is a http.Handler which accepts WriteRequests.
func (d *Distributor) PushHandler(w http.ResponseWriter, r *http.Request) {
var req remote.WriteRequest
Expand Down
94 changes: 0 additions & 94 deletions ingester/http_server.go

This file was deleted.