id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
126,700
go-kit/kit
examples/shipping/cargo/cargo.go
DeriveDeliveryProgress
func (c *Cargo) DeriveDeliveryProgress(history HandlingHistory) { c.Delivery = DeriveDeliveryFrom(c.RouteSpecification, c.Itinerary, history) }
go
func (c *Cargo) DeriveDeliveryProgress(history HandlingHistory) { c.Delivery = DeriveDeliveryFrom(c.RouteSpecification, c.Itinerary, history) }
[ "func", "(", "c", "*", "Cargo", ")", "DeriveDeliveryProgress", "(", "history", "HandlingHistory", ")", "{", "c", ".", "Delivery", "=", "DeriveDeliveryFrom", "(", "c", ".", "RouteSpecification", ",", "c", ".", "Itinerary", ",", "history", ")", "\n", "}" ]
// DeriveDeliveryProgress updates all aspects of the cargo aggregate status // based on the current route specification, itinerary and handling of the cargo.
[ "DeriveDeliveryProgress", "updates", "all", "aspects", "of", "the", "cargo", "aggregate", "status", "based", "on", "the", "current", "route", "specification", "itinerary", "and", "handling", "of", "the", "cargo", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/cargo.go#L40-L42
126,701
go-kit/kit
examples/shipping/cargo/cargo.go
New
func New(id TrackingID, rs RouteSpecification) *Cargo { itinerary := Itinerary{} history := HandlingHistory{make([]HandlingEvent, 0)} return &Cargo{ TrackingID: id, Origin: rs.Origin, RouteSpecification: rs, Delivery: DeriveDeliveryFrom(rs, itinerary, history), } }
go
func New(id TrackingID, rs RouteSpecification) *Cargo { itinerary := Itinerary{} history := HandlingHistory{make([]HandlingEvent, 0)} return &Cargo{ TrackingID: id, Origin: rs.Origin, RouteSpecification: rs, Delivery: DeriveDeliveryFrom(rs, itinerary, history), } }
[ "func", "New", "(", "id", "TrackingID", ",", "rs", "RouteSpecification", ")", "*", "Cargo", "{", "itinerary", ":=", "Itinerary", "{", "}", "\n", "history", ":=", "HandlingHistory", "{", "make", "(", "[", "]", "HandlingEvent", ",", "0", ")", "}", "\n\n", ...
// New creates a new, unrouted cargo.
[ "New", "creates", "a", "new", "unrouted", "cargo", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/cargo.go#L45-L55
126,702
go-kit/kit
examples/shipping/cargo/cargo.go
IsSatisfiedBy
func (s RouteSpecification) IsSatisfiedBy(itinerary Itinerary) bool { return itinerary.Legs != nil && s.Origin == itinerary.InitialDepartureLocation() && s.Destination == itinerary.FinalArrivalLocation() }
go
func (s RouteSpecification) IsSatisfiedBy(itinerary Itinerary) bool { return itinerary.Legs != nil && s.Origin == itinerary.InitialDepartureLocation() && s.Destination == itinerary.FinalArrivalLocation() }
[ "func", "(", "s", "RouteSpecification", ")", "IsSatisfiedBy", "(", "itinerary", "Itinerary", ")", "bool", "{", "return", "itinerary", ".", "Legs", "!=", "nil", "&&", "s", ".", "Origin", "==", "itinerary", ".", "InitialDepartureLocation", "(", ")", "&&", "s",...
// IsSatisfiedBy checks whether provided itinerary satisfies this // specification.
[ "IsSatisfiedBy", "checks", "whether", "provided", "itinerary", "satisfies", "this", "specification", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/cargo.go#L83-L87
126,703
go-kit/kit
log/term/colorlogger.go
NewColorLogger
func NewColorLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger { if color == nil { panic("color func nil") } return &colorLogger{ w: w, newLogger: newLogger, color: color, bufPool: sync.Pool{New: func() interface...
go
func NewColorLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger { if color == nil { panic("color func nil") } return &colorLogger{ w: w, newLogger: newLogger, color: color, bufPool: sync.Pool{New: func() interface...
[ "func", "NewColorLogger", "(", "w", "io", ".", "Writer", ",", "newLogger", "func", "(", "io", ".", "Writer", ")", "log", ".", "Logger", ",", "color", "func", "(", "keyvals", "...", "interface", "{", "}", ")", "FgBgColor", ")", "log", ".", "Logger", "...
// NewColorLogger returns a Logger which writes colored logs to w. ANSI color // codes for the colors returned by color are added to the formatted output // from the Logger returned by newLogger and the combined result written to w.
[ "NewColorLogger", "returns", "a", "Logger", "which", "writes", "colored", "logs", "to", "w", ".", "ANSI", "color", "codes", "for", "the", "colors", "returned", "by", "color", "are", "added", "to", "the", "formatted", "output", "from", "the", "Logger", "retur...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/term/colorlogger.go#L80-L91
126,704
go-kit/kit
transport/http/request_response_funcs.go
SetResponseHeader
func SetResponseHeader(key, val string) ServerResponseFunc { return func(ctx context.Context, w http.ResponseWriter) context.Context { w.Header().Set(key, val) return ctx } }
go
func SetResponseHeader(key, val string) ServerResponseFunc { return func(ctx context.Context, w http.ResponseWriter) context.Context { w.Header().Set(key, val) return ctx } }
[ "func", "SetResponseHeader", "(", "key", ",", "val", "string", ")", "ServerResponseFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "w", "http", ".", "ResponseWriter", ")", "context", ".", "Context", "{", "w", ".", "Header", "(", ...
// SetResponseHeader returns a ServerResponseFunc that sets the given header.
[ "SetResponseHeader", "returns", "a", "ServerResponseFunc", "that", "sets", "the", "given", "header", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/request_response_funcs.go#L31-L36
126,705
go-kit/kit
transport/http/request_response_funcs.go
SetRequestHeader
func SetRequestHeader(key, val string) RequestFunc { return func(ctx context.Context, r *http.Request) context.Context { r.Header.Set(key, val) return ctx } }
go
func SetRequestHeader(key, val string) RequestFunc { return func(ctx context.Context, r *http.Request) context.Context { r.Header.Set(key, val) return ctx } }
[ "func", "SetRequestHeader", "(", "key", ",", "val", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "context", ".", "Context", "{", "r", ".", "Header", ".", "Set", ...
// SetRequestHeader returns a RequestFunc that sets the given header.
[ "SetRequestHeader", "returns", "a", "RequestFunc", "that", "sets", "the", "given", "header", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/request_response_funcs.go#L39-L44
126,706
go-kit/kit
transport/http/request_response_funcs.go
PopulateRequestContext
func PopulateRequestContext(ctx context.Context, r *http.Request) context.Context { for k, v := range map[contextKey]string{ ContextKeyRequestMethod: r.Method, ContextKeyRequestURI: r.RequestURI, ContextKeyRequestPath: r.URL.Path, ContextKeyRequestProto: r.Proto, Con...
go
func PopulateRequestContext(ctx context.Context, r *http.Request) context.Context { for k, v := range map[contextKey]string{ ContextKeyRequestMethod: r.Method, ContextKeyRequestURI: r.RequestURI, ContextKeyRequestPath: r.URL.Path, ContextKeyRequestProto: r.Proto, Con...
[ "func", "PopulateRequestContext", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "context", ".", "Context", "{", "for", "k", ",", "v", ":=", "range", "map", "[", "contextKey", "]", "string", "{", "ContextKeyRequestMethod...
// PopulateRequestContext is a RequestFunc that populates several values into // the context from the HTTP request. Those values may be extracted using the // corresponding ContextKey type in this package.
[ "PopulateRequestContext", "is", "a", "RequestFunc", "that", "populates", "several", "values", "into", "the", "context", "from", "the", "HTTP", "request", ".", "Those", "values", "may", "be", "extracted", "using", "the", "corresponding", "ContextKey", "type", "in",...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/request_response_funcs.go#L49-L68
126,707
go-kit/kit
examples/shipping/cargo/handling.go
MostRecentlyCompletedEvent
func (h HandlingHistory) MostRecentlyCompletedEvent() (HandlingEvent, error) { if len(h.HandlingEvents) == 0 { return HandlingEvent{}, errors.New("delivery history is empty") } return h.HandlingEvents[len(h.HandlingEvents)-1], nil }
go
func (h HandlingHistory) MostRecentlyCompletedEvent() (HandlingEvent, error) { if len(h.HandlingEvents) == 0 { return HandlingEvent{}, errors.New("delivery history is empty") } return h.HandlingEvents[len(h.HandlingEvents)-1], nil }
[ "func", "(", "h", "HandlingHistory", ")", "MostRecentlyCompletedEvent", "(", ")", "(", "HandlingEvent", ",", "error", ")", "{", "if", "len", "(", "h", ".", "HandlingEvents", ")", "==", "0", "{", "return", "HandlingEvent", "{", "}", ",", "errors", ".", "N...
// MostRecentlyCompletedEvent returns most recently completed handling event.
[ "MostRecentlyCompletedEvent", "returns", "most", "recently", "completed", "handling", "event", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/handling.go#L73-L79
126,708
go-kit/kit
examples/shipping/cargo/handling.go
CreateHandlingEvent
func (f *HandlingEventFactory) CreateHandlingEvent(registered time.Time, completed time.Time, id TrackingID, voyageNumber voyage.Number, unLocode location.UNLocode, eventType HandlingEventType) (HandlingEvent, error) { if _, err := f.CargoRepository.Find(id); err != nil { return HandlingEvent{}, err } if _, err...
go
func (f *HandlingEventFactory) CreateHandlingEvent(registered time.Time, completed time.Time, id TrackingID, voyageNumber voyage.Number, unLocode location.UNLocode, eventType HandlingEventType) (HandlingEvent, error) { if _, err := f.CargoRepository.Find(id); err != nil { return HandlingEvent{}, err } if _, err...
[ "func", "(", "f", "*", "HandlingEventFactory", ")", "CreateHandlingEvent", "(", "registered", "time", ".", "Time", ",", "completed", "time", ".", "Time", ",", "id", "TrackingID", ",", "voyageNumber", "voyage", ".", "Number", ",", "unLocode", "location", ".", ...
// CreateHandlingEvent creates a validated handling event.
[ "CreateHandlingEvent", "creates", "a", "validated", "handling", "event", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/handling.go#L95-L121
126,709
go-kit/kit
examples/shipping/booking/transport.go
MakeHandler
func MakeHandler(bs Service, logger kitlog.Logger) http.Handler { opts := []kithttp.ServerOption{ kithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)), kithttp.ServerErrorEncoder(encodeError), } bookCargoHandler := kithttp.NewServer( makeBookCargoEndpoint(bs), decodeBookCargoRequest, encodeRes...
go
func MakeHandler(bs Service, logger kitlog.Logger) http.Handler { opts := []kithttp.ServerOption{ kithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)), kithttp.ServerErrorEncoder(encodeError), } bookCargoHandler := kithttp.NewServer( makeBookCargoEndpoint(bs), decodeBookCargoRequest, encodeRes...
[ "func", "MakeHandler", "(", "bs", "Service", ",", "logger", "kitlog", ".", "Logger", ")", "http", ".", "Handler", "{", "opts", ":=", "[", "]", "kithttp", ".", "ServerOption", "{", "kithttp", ".", "ServerErrorHandler", "(", "transport", ".", "NewLogErrorHandl...
// MakeHandler returns a handler for the booking service.
[ "MakeHandler", "returns", "a", "handler", "for", "the", "booking", "service", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/booking/transport.go#L21-L81
126,710
go-kit/kit
examples/shipping/booking/transport.go
encodeError
func encodeError(_ context.Context, err error, w http.ResponseWriter) { w.Header().Set("Content-Type", "application/json; charset=utf-8") switch err { case cargo.ErrUnknown: w.WriteHeader(http.StatusNotFound) case ErrInvalidArgument: w.WriteHeader(http.StatusBadRequest) default: w.WriteHeader(http.StatusInte...
go
func encodeError(_ context.Context, err error, w http.ResponseWriter) { w.Header().Set("Content-Type", "application/json; charset=utf-8") switch err { case cargo.ErrUnknown: w.WriteHeader(http.StatusNotFound) case ErrInvalidArgument: w.WriteHeader(http.StatusBadRequest) default: w.WriteHeader(http.StatusInte...
[ "func", "encodeError", "(", "_", "context", ".", "Context", ",", "err", "error", ",", "w", "http", ".", "ResponseWriter", ")", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "switch", "err", "{", "case...
// encode errors from business-logic
[ "encode", "errors", "from", "business", "-", "logic" ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/booking/transport.go#L182-L195
126,711
go-kit/kit
sd/internal/instance/cache.go
Update
func (c *Cache) Update(event sd.Event) { c.mtx.Lock() defer c.mtx.Unlock() sort.Strings(event.Instances) if reflect.DeepEqual(c.state, event) { return // no need to broadcast the same instances } c.state = event c.reg.broadcast(event) }
go
func (c *Cache) Update(event sd.Event) { c.mtx.Lock() defer c.mtx.Unlock() sort.Strings(event.Instances) if reflect.DeepEqual(c.state, event) { return // no need to broadcast the same instances } c.state = event c.reg.broadcast(event) }
[ "func", "(", "c", "*", "Cache", ")", "Update", "(", "event", "sd", ".", "Event", ")", "{", "c", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "sort", ".", "Strings", "(", "event", ".", "In...
// Update receives new instances from service discovery, stores them internally, // and notifies all registered listeners.
[ "Update", "receives", "new", "instances", "from", "service", "discovery", "stores", "them", "internally", "and", "notifies", "all", "registered", "listeners", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/internal/instance/cache.go#L28-L39
126,712
go-kit/kit
examples/shipping/routing/proxying.go
NewProxyingMiddleware
func NewProxyingMiddleware(ctx context.Context, proxyURL string) ServiceMiddleware { return func(next Service) Service { var e endpoint.Endpoint e = makeFetchRoutesEndpoint(ctx, proxyURL) e = circuitbreaker.Hystrix("fetch-routes")(e) return proxyService{ctx, e, next} } }
go
func NewProxyingMiddleware(ctx context.Context, proxyURL string) ServiceMiddleware { return func(next Service) Service { var e endpoint.Endpoint e = makeFetchRoutesEndpoint(ctx, proxyURL) e = circuitbreaker.Hystrix("fetch-routes")(e) return proxyService{ctx, e, next} } }
[ "func", "NewProxyingMiddleware", "(", "ctx", "context", ".", "Context", ",", "proxyURL", "string", ")", "ServiceMiddleware", "{", "return", "func", "(", "next", "Service", ")", "Service", "{", "var", "e", "endpoint", ".", "Endpoint", "\n", "e", "=", "makeFet...
// NewProxyingMiddleware returns a new instance of a proxying middleware.
[ "NewProxyingMiddleware", "returns", "a", "new", "instance", "of", "a", "proxying", "middleware", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/routing/proxying.go#L59-L66
126,713
go-kit/kit
metrics/multi/multi.go
Add
func (c Counter) Add(delta float64) { for _, counter := range c { counter.Add(delta) } }
go
func (c Counter) Add(delta float64) { for _, counter := range c { counter.Add(delta) } }
[ "func", "(", "c", "Counter", ")", "Add", "(", "delta", "float64", ")", "{", "for", "_", ",", "counter", ":=", "range", "c", "{", "counter", ".", "Add", "(", "delta", ")", "\n", "}", "\n", "}" ]
// Add implements counter.
[ "Add", "implements", "counter", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/multi/multi.go#L18-L22
126,714
go-kit/kit
metrics/multi/multi.go
With
func (c Counter) With(labelValues ...string) metrics.Counter { next := make(Counter, len(c)) for i := range c { next[i] = c[i].With(labelValues...) } return next }
go
func (c Counter) With(labelValues ...string) metrics.Counter { next := make(Counter, len(c)) for i := range c { next[i] = c[i].With(labelValues...) } return next }
[ "func", "(", "c", "Counter", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Counter", "{", "next", ":=", "make", "(", "Counter", ",", "len", "(", "c", ")", ")", "\n", "for", "i", ":=", "range", "c", "{", "next", "[", "i",...
// With implements counter.
[ "With", "implements", "counter", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/multi/multi.go#L25-L31
126,715
go-kit/kit
metrics/multi/multi.go
With
func (g Gauge) With(labelValues ...string) metrics.Gauge { next := make(Gauge, len(g)) for i := range g { next[i] = g[i].With(labelValues...) } return next }
go
func (g Gauge) With(labelValues ...string) metrics.Gauge { next := make(Gauge, len(g)) for i := range g { next[i] = g[i].With(labelValues...) } return next }
[ "func", "(", "g", "Gauge", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Gauge", "{", "next", ":=", "make", "(", "Gauge", ",", "len", "(", "g", ")", ")", "\n", "for", "i", ":=", "range", "g", "{", "next", "[", "i", "]"...
// With implements gauge.
[ "With", "implements", "gauge", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/multi/multi.go#L49-L55
126,716
go-kit/kit
metrics/multi/multi.go
With
func (h Histogram) With(labelValues ...string) metrics.Histogram { next := make(Histogram, len(h)) for i := range h { next[i] = h[i].With(labelValues...) } return next }
go
func (h Histogram) With(labelValues ...string) metrics.Histogram { next := make(Histogram, len(h)) for i := range h { next[i] = h[i].With(labelValues...) } return next }
[ "func", "(", "h", "Histogram", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Histogram", "{", "next", ":=", "make", "(", "Histogram", ",", "len", "(", "h", ")", ")", "\n", "for", "i", ":=", "range", "h", "{", "next", "[", ...
// With implements histogram.
[ "With", "implements", "histogram", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/multi/multi.go#L80-L86
126,717
go-kit/kit
transport/http/proto/client.go
EncodeProtoRequest
func EncodeProtoRequest(_ context.Context, r *http.Request, preq interface{}) error { r.Header.Set("Content-Type", "application/x-protobuf") if headerer, ok := preq.(httptransport.Headerer); ok { for k := range headerer.Headers() { r.Header.Set(k, headerer.Headers().Get(k)) } } req, ok := preq.(proto.Message...
go
func EncodeProtoRequest(_ context.Context, r *http.Request, preq interface{}) error { r.Header.Set("Content-Type", "application/x-protobuf") if headerer, ok := preq.(httptransport.Headerer); ok { for k := range headerer.Headers() { r.Header.Set(k, headerer.Headers().Get(k)) } } req, ok := preq.(proto.Message...
[ "func", "EncodeProtoRequest", "(", "_", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ",", "preq", "interface", "{", "}", ")", "error", "{", "r", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "h...
// EncodeProtoRequest is an EncodeRequestFunc that serializes the request as Protobuf. // If the request implements Headerer, the provided headers will be applied // to the request. If the given request does not implement proto.Message, an error will // be returned.
[ "EncodeProtoRequest", "is", "an", "EncodeRequestFunc", "that", "serializes", "the", "request", "as", "Protobuf", ".", "If", "the", "request", "implements", "Headerer", "the", "provided", "headers", "will", "be", "applied", "to", "the", "request", ".", "If", "the...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/proto/client.go#L18-L37
126,718
go-kit/kit
endpoint/endpoint.go
Chain
func Chain(outer Middleware, others ...Middleware) Middleware { return func(next Endpoint) Endpoint { for i := len(others) - 1; i >= 0; i-- { // reverse next = others[i](next) } return outer(next) } }
go
func Chain(outer Middleware, others ...Middleware) Middleware { return func(next Endpoint) Endpoint { for i := len(others) - 1; i >= 0; i-- { // reverse next = others[i](next) } return outer(next) } }
[ "func", "Chain", "(", "outer", "Middleware", ",", "others", "...", "Middleware", ")", "Middleware", "{", "return", "func", "(", "next", "Endpoint", ")", "Endpoint", "{", "for", "i", ":=", "len", "(", "others", ")", "-", "1", ";", "i", ">=", "0", ";",...
// Chain is a helper function for composing middlewares. Requests will // traverse them in the order they're declared. That is, the first middleware // is treated as the outermost middleware.
[ "Chain", "is", "a", "helper", "function", "for", "composing", "middlewares", ".", "Requests", "will", "traverse", "them", "in", "the", "order", "they", "re", "declared", ".", "That", "is", "the", "first", "middleware", "is", "treated", "as", "the", "outermos...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/endpoint/endpoint.go#L21-L28
126,719
go-kit/kit
metrics/graphite/graphite.go
New
func New(prefix string, logger log.Logger) *Graphite { return &Graphite{ prefix: prefix, counters: map[string]*Counter{}, gauges: map[string]*Gauge{}, histograms: map[string]*Histogram{}, logger: logger, } }
go
func New(prefix string, logger log.Logger) *Graphite { return &Graphite{ prefix: prefix, counters: map[string]*Counter{}, gauges: map[string]*Gauge{}, histograms: map[string]*Histogram{}, logger: logger, } }
[ "func", "New", "(", "prefix", "string", ",", "logger", "log", ".", "Logger", ")", "*", "Graphite", "{", "return", "&", "Graphite", "{", "prefix", ":", "prefix", ",", "counters", ":", "map", "[", "string", "]", "*", "Counter", "{", "}", ",", "gauges",...
// New returns a Graphite object that may be used to create metrics. Prefix is // applied to all created metrics. Callers must ensure that regular calls to // WriteTo are performed, either manually or with one of the helper methods.
[ "New", "returns", "a", "Graphite", "object", "that", "may", "be", "used", "to", "create", "metrics", ".", "Prefix", "is", "applied", "to", "all", "created", "metrics", ".", "Callers", "must", "ensure", "that", "regular", "calls", "to", "WriteTo", "are", "p...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/graphite/graphite.go#L45-L53
126,720
go-kit/kit
metrics/graphite/graphite.go
NewGauge
func (g *Graphite) NewGauge(name string) *Gauge { ga := NewGauge(g.prefix + name) g.mtx.Lock() g.gauges[g.prefix+name] = ga g.mtx.Unlock() return ga }
go
func (g *Graphite) NewGauge(name string) *Gauge { ga := NewGauge(g.prefix + name) g.mtx.Lock() g.gauges[g.prefix+name] = ga g.mtx.Unlock() return ga }
[ "func", "(", "g", "*", "Graphite", ")", "NewGauge", "(", "name", "string", ")", "*", "Gauge", "{", "ga", ":=", "NewGauge", "(", "g", ".", "prefix", "+", "name", ")", "\n", "g", ".", "mtx", ".", "Lock", "(", ")", "\n", "g", ".", "gauges", "[", ...
// NewGauge returns a gauge. Observations are aggregated and emitted once per // write invocation.
[ "NewGauge", "returns", "a", "gauge", ".", "Observations", "are", "aggregated", "and", "emitted", "once", "per", "write", "invocation", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/graphite/graphite.go#L67-L73
126,721
go-kit/kit
metrics/graphite/graphite.go
NewHistogram
func (g *Graphite) NewHistogram(name string, buckets int) *Histogram { h := NewHistogram(g.prefix+name, buckets) g.mtx.Lock() g.histograms[g.prefix+name] = h g.mtx.Unlock() return h }
go
func (g *Graphite) NewHistogram(name string, buckets int) *Histogram { h := NewHistogram(g.prefix+name, buckets) g.mtx.Lock() g.histograms[g.prefix+name] = h g.mtx.Unlock() return h }
[ "func", "(", "g", "*", "Graphite", ")", "NewHistogram", "(", "name", "string", ",", "buckets", "int", ")", "*", "Histogram", "{", "h", ":=", "NewHistogram", "(", "g", ".", "prefix", "+", "name", ",", "buckets", ")", "\n", "g", ".", "mtx", ".", "Loc...
// NewHistogram returns a histogram. Observations are aggregated and emitted as // per-quantile gauges, once per write invocation. 50 is a good default value // for buckets.
[ "NewHistogram", "returns", "a", "histogram", ".", "Observations", "are", "aggregated", "and", "emitted", "as", "per", "-", "quantile", "gauges", "once", "per", "write", "invocation", ".", "50", "is", "a", "good", "default", "value", "for", "buckets", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/graphite/graphite.go#L78-L84
126,722
go-kit/kit
metrics/graphite/graphite.go
WriteTo
func (g *Graphite) WriteTo(w io.Writer) (count int64, err error) { g.mtx.RLock() defer g.mtx.RUnlock() now := time.Now().Unix() for name, c := range g.counters { n, err := fmt.Fprintf(w, "%s %f %d\n", name, c.c.ValueReset(), now) if err != nil { return count, err } count += int64(n) } for name, ga :=...
go
func (g *Graphite) WriteTo(w io.Writer) (count int64, err error) { g.mtx.RLock() defer g.mtx.RUnlock() now := time.Now().Unix() for name, c := range g.counters { n, err := fmt.Fprintf(w, "%s %f %d\n", name, c.c.ValueReset(), now) if err != nil { return count, err } count += int64(n) } for name, ga :=...
[ "func", "(", "g", "*", "Graphite", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "count", "int64", ",", "err", "error", ")", "{", "g", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "g", ".", "mtx", ".", "RUnlock", "(", ")", "\...
// WriteTo flushes the buffered content of the metrics to the writer, in // Graphite plaintext format. WriteTo abides best-effort semantics, so // observations are lost if there is a problem with the write. Clients should be // sure to call WriteTo regularly, ideally through the WriteLoop or SendLoop // helper methods.
[ "WriteTo", "flushes", "the", "buffered", "content", "of", "the", "metrics", "to", "the", "writer", "in", "Graphite", "plaintext", "format", ".", "WriteTo", "abides", "best", "-", "effort", "semantics", "so", "observations", "are", "lost", "if", "there", "is", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/graphite/graphite.go#L117-L157
126,723
go-kit/kit
metrics/graphite/graphite.go
NewHistogram
func NewHistogram(name string, buckets int) *Histogram { return &Histogram{generic.NewHistogram(name, buckets)} }
go
func NewHistogram(name string, buckets int) *Histogram { return &Histogram{generic.NewHistogram(name, buckets)} }
[ "func", "NewHistogram", "(", "name", "string", ",", "buckets", "int", ")", "*", "Histogram", "{", "return", "&", "Histogram", "{", "generic", ".", "NewHistogram", "(", "name", ",", "buckets", ")", "}", "\n", "}" ]
// NewHistogram returns a new usable Histogram metric.
[ "NewHistogram", "returns", "a", "new", "usable", "Histogram", "metric", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/graphite/graphite.go#L201-L203
126,724
go-kit/kit
examples/shipping/handling/logging.go
NewLoggingService
func NewLoggingService(logger log.Logger, s Service) Service { return &loggingService{logger, s} }
go
func NewLoggingService(logger log.Logger, s Service) Service { return &loggingService{logger, s} }
[ "func", "NewLoggingService", "(", "logger", "log", ".", "Logger", ",", "s", "Service", ")", "Service", "{", "return", "&", "loggingService", "{", "logger", ",", "s", "}", "\n", "}" ]
// NewLoggingService returns a new instance of a logging Service.
[ "NewLoggingService", "returns", "a", "new", "instance", "of", "a", "logging", "Service", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/handling/logging.go#L19-L21
126,725
go-kit/kit
metrics/generic/generic.go
Value
func (c *Counter) Value() float64 { return math.Float64frombits(atomic.LoadUint64(&c.bits)) }
go
func (c *Counter) Value() float64 { return math.Float64frombits(atomic.LoadUint64(&c.bits)) }
[ "func", "(", "c", "*", "Counter", ")", "Value", "(", ")", "float64", "{", "return", "math", ".", "Float64frombits", "(", "atomic", ".", "LoadUint64", "(", "&", "c", ".", "bits", ")", ")", "\n", "}" ]
// Value returns the current value of the counter.
[ "Value", "returns", "the", "current", "value", "of", "the", "counter", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/generic/generic.go#L57-L59
126,726
go-kit/kit
metrics/generic/generic.go
Value
func (g *Gauge) Value() float64 { return math.Float64frombits(atomic.LoadUint64(&g.bits)) }
go
func (g *Gauge) Value() float64 { return math.Float64frombits(atomic.LoadUint64(&g.bits)) }
[ "func", "(", "g", "*", "Gauge", ")", "Value", "(", ")", "float64", "{", "return", "math", ".", "Float64frombits", "(", "atomic", ".", "LoadUint64", "(", "&", "g", ".", "bits", ")", ")", "\n", "}" ]
// Value returns the current value of the gauge.
[ "Value", "returns", "the", "current", "value", "of", "the", "gauge", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/generic/generic.go#L125-L127
126,727
go-kit/kit
metrics/generic/generic.go
Quantile
func (h *Histogram) Quantile(q float64) float64 { h.h.RLock() defer h.h.RUnlock() return h.h.Quantile(q) }
go
func (h *Histogram) Quantile(q float64) float64 { h.h.RLock() defer h.h.RUnlock() return h.h.Quantile(q) }
[ "func", "(", "h", "*", "Histogram", ")", "Quantile", "(", "q", "float64", ")", "float64", "{", "h", ".", "h", ".", "RLock", "(", ")", "\n", "defer", "h", ".", "h", ".", "RUnlock", "(", ")", "\n", "return", "h", ".", "h", ".", "Quantile", "(", ...
// Quantile returns the value of the quantile q, 0.0 < q < 1.0.
[ "Quantile", "returns", "the", "value", "of", "the", "quantile", "q", "0", ".", "0", "<", "q", "<", "1", ".", "0", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/generic/generic.go#L169-L173
126,728
go-kit/kit
metrics/generic/generic.go
Print
func (h *Histogram) Print(w io.Writer) { h.h.RLock() defer h.h.RUnlock() fmt.Fprintf(w, h.h.String()) }
go
func (h *Histogram) Print(w io.Writer) { h.h.RLock() defer h.h.RUnlock() fmt.Fprintf(w, h.h.String()) }
[ "func", "(", "h", "*", "Histogram", ")", "Print", "(", "w", "io", ".", "Writer", ")", "{", "h", ".", "h", ".", "RLock", "(", ")", "\n", "defer", "h", ".", "h", ".", "RUnlock", "(", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "h", ".", ...
// Print writes a string representation of the histogram to the passed writer. // Useful for printing to a terminal.
[ "Print", "writes", "a", "string", "representation", "of", "the", "histogram", "to", "the", "passed", "writer", ".", "Useful", "for", "printing", "to", "a", "terminal", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/generic/generic.go#L182-L186
126,729
go-kit/kit
metrics/generic/generic.go
ApproximateMovingAverage
func (h *SimpleHistogram) ApproximateMovingAverage() float64 { h.mtx.RLock() defer h.mtx.RUnlock() return h.avg }
go
func (h *SimpleHistogram) ApproximateMovingAverage() float64 { h.mtx.RLock() defer h.mtx.RUnlock() return h.avg }
[ "func", "(", "h", "*", "SimpleHistogram", ")", "ApproximateMovingAverage", "(", ")", "float64", "{", "h", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "h", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "h", ".", "avg", "\n", "}" ]
// ApproximateMovingAverage returns the approximate moving average of observations.
[ "ApproximateMovingAverage", "returns", "the", "approximate", "moving", "average", "of", "observations", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/generic/generic.go#L238-L242
126,730
go-kit/kit
transport/http/proto/server.go
EncodeProtoResponse
func EncodeProtoResponse(ctx context.Context, w http.ResponseWriter, pres interface{}) error { res, ok := pres.(proto.Message) if !ok { return errors.New("response does not implement proto.Message") } w.Header().Set("Content-Type", "application/x-protobuf") if headerer, ok := w.(httptransport.Headerer); ok { f...
go
func EncodeProtoResponse(ctx context.Context, w http.ResponseWriter, pres interface{}) error { res, ok := pres.(proto.Message) if !ok { return errors.New("response does not implement proto.Message") } w.Header().Set("Content-Type", "application/x-protobuf") if headerer, ok := w.(httptransport.Headerer); ok { f...
[ "func", "EncodeProtoResponse", "(", "ctx", "context", ".", "Context", ",", "w", "http", ".", "ResponseWriter", ",", "pres", "interface", "{", "}", ")", "error", "{", "res", ",", "ok", ":=", "pres", ".", "(", "proto", ".", "Message", ")", "\n", "if", ...
// EncodeProtoResponse is an EncodeResponseFunc that serializes the response as Protobuf. // Many Proto-over-HTTP services can use it as a sensible default. If the response // implements Headerer, the provided headers will be applied to the response. If the // response implements StatusCoder, the provided StatusCode wi...
[ "EncodeProtoResponse", "is", "an", "EncodeResponseFunc", "that", "serializes", "the", "response", "as", "Protobuf", ".", "Many", "Proto", "-", "over", "-", "HTTP", "services", "can", "use", "it", "as", "a", "sensible", "default", ".", "If", "the", "response", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/proto/server.go#L16-L47
126,731
go-kit/kit
examples/addsvc/pkg/addtransport/grpc.go
NewGRPCServer
func NewGRPCServer(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) pb.AddServer { // Zipkin GRPC Server Trace can either be instantiated per gRPC method with a // provided operation name or a global tracing service can be instantiated // without an operat...
go
func NewGRPCServer(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) pb.AddServer { // Zipkin GRPC Server Trace can either be instantiated per gRPC method with a // provided operation name or a global tracing service can be instantiated // without an operat...
[ "func", "NewGRPCServer", "(", "endpoints", "addendpoint", ".", "Set", ",", "otTracer", "stdopentracing", ".", "Tracer", ",", "zipkinTracer", "*", "stdzipkin", ".", "Tracer", ",", "logger", "log", ".", "Logger", ")", "pb", ".", "AddServer", "{", "// Zipkin GRPC...
// NewGRPCServer makes a set of endpoints available as a gRPC AddServer.
[ "NewGRPCServer", "makes", "a", "set", "of", "endpoints", "available", "as", "a", "gRPC", "AddServer", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/addsvc/pkg/addtransport/grpc.go#L35-L66
126,732
go-kit/kit
examples/addsvc/pkg/addtransport/grpc.go
NewGRPCClient
func NewGRPCClient(conn *grpc.ClientConn, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) addservice.Service { // We construct a single ratelimiter middleware, to limit the total outgoing // QPS from this client to all methods on the remote instance. We also // construct per-endpoi...
go
func NewGRPCClient(conn *grpc.ClientConn, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) addservice.Service { // We construct a single ratelimiter middleware, to limit the total outgoing // QPS from this client to all methods on the remote instance. We also // construct per-endpoi...
[ "func", "NewGRPCClient", "(", "conn", "*", "grpc", ".", "ClientConn", ",", "otTracer", "stdopentracing", ".", "Tracer", ",", "zipkinTracer", "*", "stdzipkin", ".", "Tracer", ",", "logger", "log", ".", "Logger", ")", "addservice", ".", "Service", "{", "// We ...
// NewGRPCClient returns an AddService backed by a gRPC server at the other end // of the conn. The caller is responsible for constructing the conn, and // eventually closing the underlying transport. We bake-in certain middlewares, // implementing the client library pattern.
[ "NewGRPCClient", "returns", "an", "AddService", "backed", "by", "a", "gRPC", "server", "at", "the", "other", "end", "of", "the", "conn", ".", "The", "caller", "is", "responsible", "for", "constructing", "the", "conn", "and", "eventually", "closing", "the", "...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/addsvc/pkg/addtransport/grpc.go#L88-L161
126,733
go-kit/kit
examples/shipping/inmem/inmem.go
NewCargoRepository
func NewCargoRepository() cargo.Repository { return &cargoRepository{ cargos: make(map[cargo.TrackingID]*cargo.Cargo), } }
go
func NewCargoRepository() cargo.Repository { return &cargoRepository{ cargos: make(map[cargo.TrackingID]*cargo.Cargo), } }
[ "func", "NewCargoRepository", "(", ")", "cargo", ".", "Repository", "{", "return", "&", "cargoRepository", "{", "cargos", ":", "make", "(", "map", "[", "cargo", ".", "TrackingID", "]", "*", "cargo", ".", "Cargo", ")", ",", "}", "\n", "}" ]
// NewCargoRepository returns a new instance of a in-memory cargo repository.
[ "NewCargoRepository", "returns", "a", "new", "instance", "of", "a", "in", "-", "memory", "cargo", "repository", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/inmem/inmem.go#L44-L48
126,734
go-kit/kit
examples/shipping/inmem/inmem.go
NewLocationRepository
func NewLocationRepository() location.Repository { r := &locationRepository{ locations: make(map[location.UNLocode]*location.Location), } r.locations[location.SESTO] = location.Stockholm r.locations[location.AUMEL] = location.Melbourne r.locations[location.CNHKG] = location.Hongkong r.locations[location.JNTKO]...
go
func NewLocationRepository() location.Repository { r := &locationRepository{ locations: make(map[location.UNLocode]*location.Location), } r.locations[location.SESTO] = location.Stockholm r.locations[location.AUMEL] = location.Melbourne r.locations[location.CNHKG] = location.Hongkong r.locations[location.JNTKO]...
[ "func", "NewLocationRepository", "(", ")", "location", ".", "Repository", "{", "r", ":=", "&", "locationRepository", "{", "locations", ":", "make", "(", "map", "[", "location", ".", "UNLocode", "]", "*", "location", ".", "Location", ")", ",", "}", "\n\n", ...
// NewLocationRepository returns a new instance of a in-memory location repository.
[ "NewLocationRepository", "returns", "a", "new", "instance", "of", "a", "in", "-", "memory", "location", "repository", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/inmem/inmem.go#L70-L83
126,735
go-kit/kit
examples/shipping/inmem/inmem.go
NewVoyageRepository
func NewVoyageRepository() voyage.Repository { r := &voyageRepository{ voyages: make(map[voyage.Number]*voyage.Voyage), } r.voyages[voyage.V100.Number] = voyage.V100 r.voyages[voyage.V300.Number] = voyage.V300 r.voyages[voyage.V400.Number] = voyage.V400 r.voyages[voyage.V0100S.Number] = voyage.V0100S r.voyag...
go
func NewVoyageRepository() voyage.Repository { r := &voyageRepository{ voyages: make(map[voyage.Number]*voyage.Voyage), } r.voyages[voyage.V100.Number] = voyage.V100 r.voyages[voyage.V300.Number] = voyage.V300 r.voyages[voyage.V400.Number] = voyage.V400 r.voyages[voyage.V0100S.Number] = voyage.V0100S r.voyag...
[ "func", "NewVoyageRepository", "(", ")", "voyage", ".", "Repository", "{", "r", ":=", "&", "voyageRepository", "{", "voyages", ":", "make", "(", "map", "[", "voyage", ".", "Number", "]", "*", "voyage", ".", "Voyage", ")", ",", "}", "\n\n", "r", ".", ...
// NewVoyageRepository returns a new instance of a in-memory voyage repository.
[ "NewVoyageRepository", "returns", "a", "new", "instance", "of", "a", "in", "-", "memory", "voyage", "repository", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/inmem/inmem.go#L98-L114
126,736
go-kit/kit
examples/shipping/inmem/inmem.go
NewHandlingEventRepository
func NewHandlingEventRepository() cargo.HandlingEventRepository { return &handlingEventRepository{ events: make(map[cargo.TrackingID][]cargo.HandlingEvent), } }
go
func NewHandlingEventRepository() cargo.HandlingEventRepository { return &handlingEventRepository{ events: make(map[cargo.TrackingID][]cargo.HandlingEvent), } }
[ "func", "NewHandlingEventRepository", "(", ")", "cargo", ".", "HandlingEventRepository", "{", "return", "&", "handlingEventRepository", "{", "events", ":", "make", "(", "map", "[", "cargo", ".", "TrackingID", "]", "[", "]", "cargo", ".", "HandlingEvent", ")", ...
// NewHandlingEventRepository returns a new instance of a in-memory handling event repository.
[ "NewHandlingEventRepository", "returns", "a", "new", "instance", "of", "a", "in", "-", "memory", "handling", "event", "repository", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/inmem/inmem.go#L138-L142
126,737
go-kit/kit
examples/stringsvc1/main.go
main
func main() { svc := stringService{} uppercaseHandler := httptransport.NewServer( makeUppercaseEndpoint(svc), decodeUppercaseRequest, encodeResponse, ) countHandler := httptransport.NewServer( makeCountEndpoint(svc), decodeCountRequest, encodeResponse, ) http.Handle("/uppercase", uppercaseHandler) ...
go
func main() { svc := stringService{} uppercaseHandler := httptransport.NewServer( makeUppercaseEndpoint(svc), decodeUppercaseRequest, encodeResponse, ) countHandler := httptransport.NewServer( makeCountEndpoint(svc), decodeCountRequest, encodeResponse, ) http.Handle("/uppercase", uppercaseHandler) ...
[ "func", "main", "(", ")", "{", "svc", ":=", "stringService", "{", "}", "\n\n", "uppercaseHandler", ":=", "httptransport", ".", "NewServer", "(", "makeUppercaseEndpoint", "(", "svc", ")", ",", "decodeUppercaseRequest", ",", "encodeResponse", ",", ")", "\n\n", "...
// Transports expose the service to the network. In this first example we utilize JSON over HTTP.
[ "Transports", "expose", "the", "service", "to", "the", "network", ".", "In", "this", "first", "example", "we", "utilize", "JSON", "over", "HTTP", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/stringsvc1/main.go#L77-L95
126,738
go-kit/kit
metrics/cloudwatch2/cloudwatch2.go
WithLogger
func WithLogger(logger log.Logger) Option { return func(cw *CloudWatch) { cw.logger = logger } }
go
func WithLogger(logger log.Logger) Option { return func(cw *CloudWatch) { cw.logger = logger } }
[ "func", "WithLogger", "(", "logger", "log", ".", "Logger", ")", "Option", "{", "return", "func", "(", "cw", "*", "CloudWatch", ")", "{", "cw", ".", "logger", "=", "logger", "\n", "}", "\n", "}" ]
// WithLogger sets the Logger that will receive error messages generated // during the WriteLoop. By default, no logger is used.
[ "WithLogger", "sets", "the", "Logger", "that", "will", "receive", "error", "messages", "generated", "during", "the", "WriteLoop", ".", "By", "default", "no", "logger", "is", "used", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/cloudwatch2/cloudwatch2.go#L46-L50
126,739
go-kit/kit
metrics/cloudwatch2/cloudwatch2.go
WithConcurrentRequests
func WithConcurrentRequests(n int) Option { return func(cw *CloudWatch) { if n > maxConcurrentRequests { n = maxConcurrentRequests } cw.numConcurrentRequests = n } }
go
func WithConcurrentRequests(n int) Option { return func(cw *CloudWatch) { if n > maxConcurrentRequests { n = maxConcurrentRequests } cw.numConcurrentRequests = n } }
[ "func", "WithConcurrentRequests", "(", "n", "int", ")", "Option", "{", "return", "func", "(", "cw", "*", "CloudWatch", ")", "{", "if", "n", ">", "maxConcurrentRequests", "{", "n", "=", "maxConcurrentRequests", "\n", "}", "\n", "cw", ".", "numConcurrentReques...
// WithConcurrentRequests sets the upper limit on how many // cloudwatch.PutMetricDataRequest may be under way at any // given time. If n is greater than 20, 20 is used. By default, // the max is set at 10 concurrent requests.
[ "WithConcurrentRequests", "sets", "the", "upper", "limit", "on", "how", "many", "cloudwatch", ".", "PutMetricDataRequest", "may", "be", "under", "way", "at", "any", "given", "time", ".", "If", "n", "is", "greater", "than", "20", "20", "is", "used", ".", "B...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/cloudwatch2/cloudwatch2.go#L56-L63
126,740
go-kit/kit
metrics/cloudwatch2/cloudwatch2.go
WriteLoop
func (cw *CloudWatch) WriteLoop(ctx context.Context, c <-chan time.Time) { for { select { case <-c: if err := cw.Send(); err != nil { cw.logger.Log("during", "Send", "err", err) } case <-ctx.Done(): return } } }
go
func (cw *CloudWatch) WriteLoop(ctx context.Context, c <-chan time.Time) { for { select { case <-c: if err := cw.Send(); err != nil { cw.logger.Log("during", "Send", "err", err) } case <-ctx.Done(): return } } }
[ "func", "(", "cw", "*", "CloudWatch", ")", "WriteLoop", "(", "ctx", "context", ".", "Context", ",", "c", "<-", "chan", "time", ".", "Time", ")", "{", "for", "{", "select", "{", "case", "<-", "c", ":", "if", "err", ":=", "cw", ".", "Send", "(", ...
// WriteLoop is a helper method that invokes Send every time the passed // channel fires. This method blocks until ctx is canceled, so clients // probably want to run it in its own goroutine. For typical usage, create a // time.Ticker and pass its C channel to this method.
[ "WriteLoop", "is", "a", "helper", "method", "that", "invokes", "Send", "every", "time", "the", "passed", "channel", "fires", ".", "This", "method", "blocks", "until", "ctx", "is", "canceled", "so", "clients", "probably", "want", "to", "run", "it", "in", "i...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/cloudwatch2/cloudwatch2.go#L114-L125
126,741
go-kit/kit
examples/shipping/tracking/transport.go
MakeHandler
func MakeHandler(ts Service, logger kitlog.Logger) http.Handler { r := mux.NewRouter() opts := []kithttp.ServerOption{ kithttp.ServerErrorHandler(kittransport.NewLogErrorHandler(logger)), kithttp.ServerErrorEncoder(encodeError), } trackCargoHandler := kithttp.NewServer( makeTrackCargoEndpoint(ts), decodeT...
go
func MakeHandler(ts Service, logger kitlog.Logger) http.Handler { r := mux.NewRouter() opts := []kithttp.ServerOption{ kithttp.ServerErrorHandler(kittransport.NewLogErrorHandler(logger)), kithttp.ServerErrorEncoder(encodeError), } trackCargoHandler := kithttp.NewServer( makeTrackCargoEndpoint(ts), decodeT...
[ "func", "MakeHandler", "(", "ts", "Service", ",", "logger", "kitlog", ".", "Logger", ")", "http", ".", "Handler", "{", "r", ":=", "mux", ".", "NewRouter", "(", ")", "\n\n", "opts", ":=", "[", "]", "kithttp", ".", "ServerOption", "{", "kithttp", ".", ...
// MakeHandler returns a handler for the tracking service.
[ "MakeHandler", "returns", "a", "handler", "for", "the", "tracking", "service", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/tracking/transport.go#L19-L37
126,742
go-kit/kit
metrics/prometheus/prometheus.go
NewCounterFrom
func NewCounterFrom(opts prometheus.CounterOpts, labelNames []string) *Counter { cv := prometheus.NewCounterVec(opts, labelNames) prometheus.MustRegister(cv) return NewCounter(cv) }
go
func NewCounterFrom(opts prometheus.CounterOpts, labelNames []string) *Counter { cv := prometheus.NewCounterVec(opts, labelNames) prometheus.MustRegister(cv) return NewCounter(cv) }
[ "func", "NewCounterFrom", "(", "opts", "prometheus", ".", "CounterOpts", ",", "labelNames", "[", "]", "string", ")", "*", "Counter", "{", "cv", ":=", "prometheus", ".", "NewCounterVec", "(", "opts", ",", "labelNames", ")", "\n", "prometheus", ".", "MustRegis...
// NewCounterFrom constructs and registers a Prometheus CounterVec, // and returns a usable Counter object.
[ "NewCounterFrom", "constructs", "and", "registers", "a", "Prometheus", "CounterVec", "and", "returns", "a", "usable", "Counter", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/prometheus/prometheus.go#L22-L26
126,743
go-kit/kit
metrics/prometheus/prometheus.go
NewGaugeFrom
func NewGaugeFrom(opts prometheus.GaugeOpts, labelNames []string) *Gauge { gv := prometheus.NewGaugeVec(opts, labelNames) prometheus.MustRegister(gv) return NewGauge(gv) }
go
func NewGaugeFrom(opts prometheus.GaugeOpts, labelNames []string) *Gauge { gv := prometheus.NewGaugeVec(opts, labelNames) prometheus.MustRegister(gv) return NewGauge(gv) }
[ "func", "NewGaugeFrom", "(", "opts", "prometheus", ".", "GaugeOpts", ",", "labelNames", "[", "]", "string", ")", "*", "Gauge", "{", "gv", ":=", "prometheus", ".", "NewGaugeVec", "(", "opts", ",", "labelNames", ")", "\n", "prometheus", ".", "MustRegister", ...
// NewGaugeFrom construts and registers a Prometheus GaugeVec, // and returns a usable Gauge object.
[ "NewGaugeFrom", "construts", "and", "registers", "a", "Prometheus", "GaugeVec", "and", "returns", "a", "usable", "Gauge", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/prometheus/prometheus.go#L56-L60
126,744
go-kit/kit
metrics/prometheus/prometheus.go
Add
func (g *Gauge) Add(delta float64) { g.gv.With(makeLabels(g.lvs...)).Add(delta) }
go
func (g *Gauge) Add(delta float64) { g.gv.With(makeLabels(g.lvs...)).Add(delta) }
[ "func", "(", "g", "*", "Gauge", ")", "Add", "(", "delta", "float64", ")", "{", "g", ".", "gv", ".", "With", "(", "makeLabels", "(", "g", ".", "lvs", "...", ")", ")", ".", "Add", "(", "delta", ")", "\n", "}" ]
// Add is supported by Prometheus GaugeVecs.
[ "Add", "is", "supported", "by", "Prometheus", "GaugeVecs", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/prometheus/prometheus.go#L83-L85
126,745
go-kit/kit
metrics/prometheus/prometheus.go
NewSummaryFrom
func NewSummaryFrom(opts prometheus.SummaryOpts, labelNames []string) *Summary { sv := prometheus.NewSummaryVec(opts, labelNames) prometheus.MustRegister(sv) return NewSummary(sv) }
go
func NewSummaryFrom(opts prometheus.SummaryOpts, labelNames []string) *Summary { sv := prometheus.NewSummaryVec(opts, labelNames) prometheus.MustRegister(sv) return NewSummary(sv) }
[ "func", "NewSummaryFrom", "(", "opts", "prometheus", ".", "SummaryOpts", ",", "labelNames", "[", "]", "string", ")", "*", "Summary", "{", "sv", ":=", "prometheus", ".", "NewSummaryVec", "(", "opts", ",", "labelNames", ")", "\n", "prometheus", ".", "MustRegis...
// NewSummaryFrom constructs and registers a Prometheus SummaryVec, // and returns a usable Summary object.
[ "NewSummaryFrom", "constructs", "and", "registers", "a", "Prometheus", "SummaryVec", "and", "returns", "a", "usable", "Summary", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/prometheus/prometheus.go#L97-L101
126,746
go-kit/kit
metrics/prometheus/prometheus.go
NewHistogramFrom
func NewHistogramFrom(opts prometheus.HistogramOpts, labelNames []string) *Histogram { hv := prometheus.NewHistogramVec(opts, labelNames) prometheus.MustRegister(hv) return NewHistogram(hv) }
go
func NewHistogramFrom(opts prometheus.HistogramOpts, labelNames []string) *Histogram { hv := prometheus.NewHistogramVec(opts, labelNames) prometheus.MustRegister(hv) return NewHistogram(hv) }
[ "func", "NewHistogramFrom", "(", "opts", "prometheus", ".", "HistogramOpts", ",", "labelNames", "[", "]", "string", ")", "*", "Histogram", "{", "hv", ":=", "prometheus", ".", "NewHistogramVec", "(", "opts", ",", "labelNames", ")", "\n", "prometheus", ".", "M...
// NewHistogramFrom constructs and registers a Prometheus HistogramVec, // and returns a usable Histogram object.
[ "NewHistogramFrom", "constructs", "and", "registers", "a", "Prometheus", "HistogramVec", "and", "returns", "a", "usable", "Histogram", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/prometheus/prometheus.go#L133-L137
126,747
go-kit/kit
metrics/cloudwatch/cloudwatch.go
NewGauge
func (cw *CloudWatch) NewGauge(name string) metrics.Gauge { return &Gauge{ name: name, obs: cw.gauges.Observe, add: cw.gauges.Add, } }
go
func (cw *CloudWatch) NewGauge(name string) metrics.Gauge { return &Gauge{ name: name, obs: cw.gauges.Observe, add: cw.gauges.Add, } }
[ "func", "(", "cw", "*", "CloudWatch", ")", "NewGauge", "(", "name", "string", ")", "metrics", ".", "Gauge", "{", "return", "&", "Gauge", "{", "name", ":", "name", ",", "obs", ":", "cw", ".", "gauges", ".", "Observe", ",", "add", ":", "cw", ".", "...
// NewGauge returns an gauge.
[ "NewGauge", "returns", "an", "gauge", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/cloudwatch/cloudwatch.go#L123-L129
126,748
go-kit/kit
metrics/cloudwatch/cloudwatch.go
NewHistogram
func (cw *CloudWatch) NewHistogram(name string) metrics.Histogram { return &Histogram{ name: name, obs: cw.histograms.Observe, } }
go
func (cw *CloudWatch) NewHistogram(name string) metrics.Histogram { return &Histogram{ name: name, obs: cw.histograms.Observe, } }
[ "func", "(", "cw", "*", "CloudWatch", ")", "NewHistogram", "(", "name", "string", ")", "metrics", ".", "Histogram", "{", "return", "&", "Histogram", "{", "name", ":", "name", ",", "obs", ":", "cw", ".", "histograms", ".", "Observe", ",", "}", "\n", "...
// NewHistogram returns a histogram.
[ "NewHistogram", "returns", "a", "histogram", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/cloudwatch/cloudwatch.go#L132-L137
126,749
go-kit/kit
examples/shipping/tracking/service.go
NewService
func NewService(cargos cargo.Repository, events cargo.HandlingEventRepository) Service { return &service{ cargos: cargos, handlingEvents: events, } }
go
func NewService(cargos cargo.Repository, events cargo.HandlingEventRepository) Service { return &service{ cargos: cargos, handlingEvents: events, } }
[ "func", "NewService", "(", "cargos", "cargo", ".", "Repository", ",", "events", "cargo", ".", "HandlingEventRepository", ")", "Service", "{", "return", "&", "service", "{", "cargos", ":", "cargos", ",", "handlingEvents", ":", "events", ",", "}", "\n", "}" ]
// NewService returns a new instance of the default Service.
[ "NewService", "returns", "a", "new", "instance", "of", "the", "default", "Service", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/tracking/service.go#L40-L45
126,750
go-kit/kit
transport/http/jsonrpc/server.go
NewServer
func NewServer( ecm EndpointCodecMap, options ...ServerOption, ) *Server { s := &Server{ ecm: ecm, errorEncoder: DefaultErrorEncoder, logger: log.NewNopLogger(), } for _, option := range options { option(s) } return s }
go
func NewServer( ecm EndpointCodecMap, options ...ServerOption, ) *Server { s := &Server{ ecm: ecm, errorEncoder: DefaultErrorEncoder, logger: log.NewNopLogger(), } for _, option := range options { option(s) } return s }
[ "func", "NewServer", "(", "ecm", "EndpointCodecMap", ",", "options", "...", "ServerOption", ",", ")", "*", "Server", "{", "s", ":=", "&", "Server", "{", "ecm", ":", "ecm", ",", "errorEncoder", ":", "DefaultErrorEncoder", ",", "logger", ":", "log", ".", "...
// NewServer constructs a new server, which implements http.Server.
[ "NewServer", "constructs", "a", "new", "server", "which", "implements", "http", ".", "Server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/jsonrpc/server.go#L25-L38
126,751
go-kit/kit
transport/http/jsonrpc/server.go
ServerErrorEncoder
func ServerErrorEncoder(ee httptransport.ErrorEncoder) ServerOption { return func(s *Server) { s.errorEncoder = ee } }
go
func ServerErrorEncoder(ee httptransport.ErrorEncoder) ServerOption { return func(s *Server) { s.errorEncoder = ee } }
[ "func", "ServerErrorEncoder", "(", "ee", "httptransport", ".", "ErrorEncoder", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "errorEncoder", "=", "ee", "}", "\n", "}" ]
// ServerErrorEncoder is used to encode errors to the http.ResponseWriter // whenever they're encountered in the processing of a request. Clients can // use this to provide custom error formatting and response codes. By default, // errors will be written with the DefaultErrorEncoder.
[ "ServerErrorEncoder", "is", "used", "to", "encode", "errors", "to", "the", "http", ".", "ResponseWriter", "whenever", "they", "re", "encountered", "in", "the", "processing", "of", "a", "request", ".", "Clients", "can", "use", "this", "to", "provide", "custom",...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/jsonrpc/server.go#L59-L61
126,752
go-kit/kit
transport/http/jsonrpc/server.go
ServerErrorLogger
func ServerErrorLogger(logger log.Logger) ServerOption { return func(s *Server) { s.logger = logger } }
go
func ServerErrorLogger(logger log.Logger) ServerOption { return func(s *Server) { s.logger = logger } }
[ "func", "ServerErrorLogger", "(", "logger", "log", ".", "Logger", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "logger", "=", "logger", "}", "\n", "}" ]
// ServerErrorLogger is used to log non-terminal errors. By default, no errors // are logged. This is intended as a diagnostic measure. Finer-grained control // of error handling, including logging in more detail, should be performed in a // custom ServerErrorEncoder or ServerFinalizer, both of which have access to // ...
[ "ServerErrorLogger", "is", "used", "to", "log", "non", "-", "terminal", "errors", ".", "By", "default", "no", "errors", "are", "logged", ".", "This", "is", "intended", "as", "a", "diagnostic", "measure", ".", "Finer", "-", "grained", "control", "of", "erro...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/jsonrpc/server.go#L68-L70
126,753
go-kit/kit
transport/http/jsonrpc/server.go
ServerFinalizer
func ServerFinalizer(f httptransport.ServerFinalizerFunc) ServerOption { return func(s *Server) { s.finalizer = f } }
go
func ServerFinalizer(f httptransport.ServerFinalizerFunc) ServerOption { return func(s *Server) { s.finalizer = f } }
[ "func", "ServerFinalizer", "(", "f", "httptransport", ".", "ServerFinalizerFunc", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "finalizer", "=", "f", "}", "\n", "}" ]
// ServerFinalizer is executed at the end of every HTTP request. // By default, no finalizer is registered.
[ "ServerFinalizer", "is", "executed", "at", "the", "end", "of", "every", "HTTP", "request", ".", "By", "default", "no", "finalizer", "is", "registered", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/jsonrpc/server.go#L74-L76
126,754
go-kit/kit
tracing/opencensus/tracer_options.go
WithSampler
func WithSampler(sampler trace.Sampler) TracerOption { return func(o *TracerOptions) { o.Sampler = sampler } }
go
func WithSampler(sampler trace.Sampler) TracerOption { return func(o *TracerOptions) { o.Sampler = sampler } }
[ "func", "WithSampler", "(", "sampler", "trace", ".", "Sampler", ")", "TracerOption", "{", "return", "func", "(", "o", "*", "TracerOptions", ")", "{", "o", ".", "Sampler", "=", "sampler", "\n", "}", "\n", "}" ]
// WithSampler sets the sampler to use by our OpenCensus Tracer.
[ "WithSampler", "sets", "the", "sampler", "to", "use", "by", "our", "OpenCensus", "Tracer", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/opencensus/tracer_options.go#L25-L29
126,755
go-kit/kit
tracing/opencensus/tracer_options.go
WithHTTPPropagation
func WithHTTPPropagation(p propagation.HTTPFormat) TracerOption { return func(o *TracerOptions) { if p == nil { // reset to default OC HTTP format o.HTTPPropagate = defaultHTTPPropagate return } o.HTTPPropagate = p } }
go
func WithHTTPPropagation(p propagation.HTTPFormat) TracerOption { return func(o *TracerOptions) { if p == nil { // reset to default OC HTTP format o.HTTPPropagate = defaultHTTPPropagate return } o.HTTPPropagate = p } }
[ "func", "WithHTTPPropagation", "(", "p", "propagation", ".", "HTTPFormat", ")", "TracerOption", "{", "return", "func", "(", "o", "*", "TracerOptions", ")", "{", "if", "p", "==", "nil", "{", "// reset to default OC HTTP format", "o", ".", "HTTPPropagate", "=", ...
// WithHTTPPropagation sets the propagation handlers for the HTTP transport // middlewares. If used on a non HTTP transport this is a noop.
[ "WithHTTPPropagation", "sets", "the", "propagation", "handlers", "for", "the", "HTTP", "transport", "middlewares", ".", "If", "used", "on", "a", "non", "HTTP", "transport", "this", "is", "a", "noop", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/opencensus/tracer_options.go#L53-L62
126,756
go-kit/kit
sd/dnssrv/instancer.go
NewInstancer
func NewInstancer( name string, ttl time.Duration, logger log.Logger, ) *Instancer { return NewInstancerDetailed(name, time.NewTicker(ttl), net.LookupSRV, logger) }
go
func NewInstancer( name string, ttl time.Duration, logger log.Logger, ) *Instancer { return NewInstancerDetailed(name, time.NewTicker(ttl), net.LookupSRV, logger) }
[ "func", "NewInstancer", "(", "name", "string", ",", "ttl", "time", ".", "Duration", ",", "logger", "log", ".", "Logger", ",", ")", "*", "Instancer", "{", "return", "NewInstancerDetailed", "(", "name", ",", "time", ".", "NewTicker", "(", "ttl", ")", ",", ...
// NewInstancer returns a DNS SRV instancer.
[ "NewInstancer", "returns", "a", "DNS", "SRV", "instancer", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/dnssrv/instancer.go#L23-L29
126,757
go-kit/kit
sd/dnssrv/instancer.go
NewInstancerDetailed
func NewInstancerDetailed( name string, refresh *time.Ticker, lookup Lookup, logger log.Logger, ) *Instancer { p := &Instancer{ cache: instance.NewCache(), name: name, logger: logger, quit: make(chan struct{}), } instances, err := p.resolve(lookup) if err == nil { logger.Log("name", name, "insta...
go
func NewInstancerDetailed( name string, refresh *time.Ticker, lookup Lookup, logger log.Logger, ) *Instancer { p := &Instancer{ cache: instance.NewCache(), name: name, logger: logger, quit: make(chan struct{}), } instances, err := p.resolve(lookup) if err == nil { logger.Log("name", name, "insta...
[ "func", "NewInstancerDetailed", "(", "name", "string", ",", "refresh", "*", "time", ".", "Ticker", ",", "lookup", "Lookup", ",", "logger", "log", ".", "Logger", ",", ")", "*", "Instancer", "{", "p", ":=", "&", "Instancer", "{", "cache", ":", "instance", ...
// NewInstancerDetailed is the same as NewInstancer, but allows users to // provide an explicit lookup refresh ticker instead of a TTL, and specify the // lookup function instead of using net.LookupSRV.
[ "NewInstancerDetailed", "is", "the", "same", "as", "NewInstancer", "but", "allows", "users", "to", "provide", "an", "explicit", "lookup", "refresh", "ticker", "instead", "of", "a", "TTL", "and", "specify", "the", "lookup", "function", "instead", "of", "using", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/dnssrv/instancer.go#L34-L57
126,758
go-kit/kit
sd/endpointer.go
NewEndpointer
func NewEndpointer(src Instancer, f Factory, logger log.Logger, options ...EndpointerOption) *DefaultEndpointer { opts := endpointerOptions{} for _, opt := range options { opt(&opts) } se := &DefaultEndpointer{ cache: newEndpointCache(f, logger, opts), instancer: src, ch: make(chan Event), } go...
go
func NewEndpointer(src Instancer, f Factory, logger log.Logger, options ...EndpointerOption) *DefaultEndpointer { opts := endpointerOptions{} for _, opt := range options { opt(&opts) } se := &DefaultEndpointer{ cache: newEndpointCache(f, logger, opts), instancer: src, ch: make(chan Event), } go...
[ "func", "NewEndpointer", "(", "src", "Instancer", ",", "f", "Factory", ",", "logger", "log", ".", "Logger", ",", "options", "...", "EndpointerOption", ")", "*", "DefaultEndpointer", "{", "opts", ":=", "endpointerOptions", "{", "}", "\n", "for", "_", ",", "...
// NewEndpointer creates an Endpointer that subscribes to updates from Instancer src // and uses factory f to create Endpoints. If src notifies of an error, the Endpointer // keeps returning previously created Endpoints assuming they are still good, unless // this behavior is disabled via InvalidateOnError option.
[ "NewEndpointer", "creates", "an", "Endpointer", "that", "subscribes", "to", "updates", "from", "Instancer", "src", "and", "uses", "factory", "f", "to", "create", "Endpoints", ".", "If", "src", "notifies", "of", "an", "error", "the", "Endpointer", "keeps", "ret...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/endpointer.go#L28-L41
126,759
go-kit/kit
sd/endpointer.go
InvalidateOnError
func InvalidateOnError(timeout time.Duration) EndpointerOption { return func(opts *endpointerOptions) { opts.invalidateOnError = true opts.invalidateTimeout = timeout } }
go
func InvalidateOnError(timeout time.Duration) EndpointerOption { return func(opts *endpointerOptions) { opts.invalidateOnError = true opts.invalidateTimeout = timeout } }
[ "func", "InvalidateOnError", "(", "timeout", "time", ".", "Duration", ")", "EndpointerOption", "{", "return", "func", "(", "opts", "*", "endpointerOptions", ")", "{", "opts", ".", "invalidateOnError", "=", "true", "\n", "opts", ".", "invalidateTimeout", "=", "...
// InvalidateOnError returns EndpointerOption that controls how the Endpointer // behaves when then Instancer publishes an Event containing an error. // Without this option the Endpointer continues returning the last known // endpoints. With this option, the Endpointer continues returning the last // known endpoints un...
[ "InvalidateOnError", "returns", "EndpointerOption", "that", "controls", "how", "the", "Endpointer", "behaves", "when", "then", "Instancer", "publishes", "an", "Event", "containing", "an", "error", ".", "Without", "this", "option", "the", "Endpointer", "continues", "...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/endpointer.go#L53-L58
126,760
go-kit/kit
sd/endpointer.go
Close
func (de *DefaultEndpointer) Close() { de.instancer.Deregister(de.ch) close(de.ch) }
go
func (de *DefaultEndpointer) Close() { de.instancer.Deregister(de.ch) close(de.ch) }
[ "func", "(", "de", "*", "DefaultEndpointer", ")", "Close", "(", ")", "{", "de", ".", "instancer", ".", "Deregister", "(", "de", ".", "ch", ")", "\n", "close", "(", "de", ".", "ch", ")", "\n", "}" ]
// Close deregisters DefaultEndpointer from the Instancer and stops the internal go-routine.
[ "Close", "deregisters", "DefaultEndpointer", "from", "the", "Instancer", "and", "stops", "the", "internal", "go", "-", "routine", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/endpointer.go#L82-L85
126,761
go-kit/kit
log/deprecated_levels/levels.go
New
func New(logger log.Logger, options ...Option) Levels { l := Levels{ logger: logger, levelKey: "level", debugValue: "debug", infoValue: "info", warnValue: "warn", errorValue: "error", critValue: "crit", } for _, option := range options { option(&l) } return l }
go
func New(logger log.Logger, options ...Option) Levels { l := Levels{ logger: logger, levelKey: "level", debugValue: "debug", infoValue: "info", warnValue: "warn", errorValue: "error", critValue: "crit", } for _, option := range options { option(&l) } return l }
[ "func", "New", "(", "logger", "log", ".", "Logger", ",", "options", "...", "Option", ")", "Levels", "{", "l", ":=", "Levels", "{", "logger", ":", "logger", ",", "levelKey", ":", "\"", "\"", ",", "debugValue", ":", "\"", "\"", ",", "infoValue", ":", ...
// New creates a new leveled logger, wrapping the passed logger.
[ "New", "creates", "a", "new", "leveled", "logger", "wrapping", "the", "passed", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L35-L50
126,762
go-kit/kit
log/deprecated_levels/levels.go
With
func (l Levels) With(keyvals ...interface{}) Levels { return Levels{ logger: log.With(l.logger, keyvals...), levelKey: l.levelKey, debugValue: l.debugValue, infoValue: l.infoValue, warnValue: l.warnValue, errorValue: l.errorValue, critValue: l.critValue, } }
go
func (l Levels) With(keyvals ...interface{}) Levels { return Levels{ logger: log.With(l.logger, keyvals...), levelKey: l.levelKey, debugValue: l.debugValue, infoValue: l.infoValue, warnValue: l.warnValue, errorValue: l.errorValue, critValue: l.critValue, } }
[ "func", "(", "l", "Levels", ")", "With", "(", "keyvals", "...", "interface", "{", "}", ")", "Levels", "{", "return", "Levels", "{", "logger", ":", "log", ".", "With", "(", "l", ".", "logger", ",", "keyvals", "...", ")", ",", "levelKey", ":", "l", ...
// With returns a new leveled logger that includes keyvals in all log events.
[ "With", "returns", "a", "new", "leveled", "logger", "that", "includes", "keyvals", "in", "all", "log", "events", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L53-L63
126,763
go-kit/kit
log/deprecated_levels/levels.go
Debug
func (l Levels) Debug() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.debugValue) }
go
func (l Levels) Debug() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.debugValue) }
[ "func", "(", "l", "Levels", ")", "Debug", "(", ")", "log", ".", "Logger", "{", "return", "log", ".", "WithPrefix", "(", "l", ".", "logger", ",", "l", ".", "levelKey", ",", "l", ".", "debugValue", ")", "\n", "}" ]
// Debug returns a debug level logger.
[ "Debug", "returns", "a", "debug", "level", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L66-L68
126,764
go-kit/kit
log/deprecated_levels/levels.go
Info
func (l Levels) Info() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.infoValue) }
go
func (l Levels) Info() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.infoValue) }
[ "func", "(", "l", "Levels", ")", "Info", "(", ")", "log", ".", "Logger", "{", "return", "log", ".", "WithPrefix", "(", "l", ".", "logger", ",", "l", ".", "levelKey", ",", "l", ".", "infoValue", ")", "\n", "}" ]
// Info returns an info level logger.
[ "Info", "returns", "an", "info", "level", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L71-L73
126,765
go-kit/kit
log/deprecated_levels/levels.go
Warn
func (l Levels) Warn() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.warnValue) }
go
func (l Levels) Warn() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.warnValue) }
[ "func", "(", "l", "Levels", ")", "Warn", "(", ")", "log", ".", "Logger", "{", "return", "log", ".", "WithPrefix", "(", "l", ".", "logger", ",", "l", ".", "levelKey", ",", "l", ".", "warnValue", ")", "\n", "}" ]
// Warn returns a warning level logger.
[ "Warn", "returns", "a", "warning", "level", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L76-L78
126,766
go-kit/kit
log/deprecated_levels/levels.go
Error
func (l Levels) Error() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.errorValue) }
go
func (l Levels) Error() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.errorValue) }
[ "func", "(", "l", "Levels", ")", "Error", "(", ")", "log", ".", "Logger", "{", "return", "log", ".", "WithPrefix", "(", "l", ".", "logger", ",", "l", ".", "levelKey", ",", "l", ".", "errorValue", ")", "\n", "}" ]
// Error returns an error level logger.
[ "Error", "returns", "an", "error", "level", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L81-L83
126,767
go-kit/kit
log/deprecated_levels/levels.go
Crit
func (l Levels) Crit() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.critValue) }
go
func (l Levels) Crit() log.Logger { return log.WithPrefix(l.logger, l.levelKey, l.critValue) }
[ "func", "(", "l", "Levels", ")", "Crit", "(", ")", "log", ".", "Logger", "{", "return", "log", ".", "WithPrefix", "(", "l", ".", "logger", ",", "l", ".", "levelKey", ",", "l", ".", "critValue", ")", "\n", "}" ]
// Crit returns a critical level logger.
[ "Crit", "returns", "a", "critical", "level", "logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/deprecated_levels/levels.go#L86-L88
126,768
go-kit/kit
tracing/opentracing/http.go
ContextToHTTP
func ContextToHTTP(tracer opentracing.Tracer, logger log.Logger) kithttp.RequestFunc { return func(ctx context.Context, req *http.Request) context.Context { // Try to find a Span in the Context. if span := opentracing.SpanFromContext(ctx); span != nil { // Add standard OpenTracing tags. ext.HTTPMethod.Set(sp...
go
func ContextToHTTP(tracer opentracing.Tracer, logger log.Logger) kithttp.RequestFunc { return func(ctx context.Context, req *http.Request) context.Context { // Try to find a Span in the Context. if span := opentracing.SpanFromContext(ctx); span != nil { // Add standard OpenTracing tags. ext.HTTPMethod.Set(sp...
[ "func", "ContextToHTTP", "(", "tracer", "opentracing", ".", "Tracer", ",", "logger", "log", ".", "Logger", ")", "kithttp", ".", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "req", "*", "http", ".", "Request", ")", "co...
// ContextToHTTP returns an http RequestFunc that injects an OpenTracing Span // found in `ctx` into the http headers. If no such Span can be found, the // RequestFunc is a noop.
[ "ContextToHTTP", "returns", "an", "http", "RequestFunc", "that", "injects", "an", "OpenTracing", "Span", "found", "in", "ctx", "into", "the", "http", "headers", ".", "If", "no", "such", "Span", "can", "be", "found", "the", "RequestFunc", "is", "a", "noop", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/opentracing/http.go#L19-L47
126,769
go-kit/kit
examples/shipping/booking/service.go
NewService
func NewService(cargos cargo.Repository, locations location.Repository, events cargo.HandlingEventRepository, rs routing.Service) Service { return &service{ cargos: cargos, locations: locations, handlingEvents: events, routingService: rs, } }
go
func NewService(cargos cargo.Repository, locations location.Repository, events cargo.HandlingEventRepository, rs routing.Service) Service { return &service{ cargos: cargos, locations: locations, handlingEvents: events, routingService: rs, } }
[ "func", "NewService", "(", "cargos", "cargo", ".", "Repository", ",", "locations", "location", ".", "Repository", ",", "events", "cargo", ".", "HandlingEventRepository", ",", "rs", "routing", ".", "Service", ")", "Service", "{", "return", "&", "service", "{", ...
// NewService creates a booking service with necessary dependencies.
[ "NewService", "creates", "a", "booking", "service", "with", "necessary", "dependencies", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/booking/service.go#L161-L168
126,770
go-kit/kit
tracing/zipkin/options.go
Tags
func Tags(tags map[string]string) TracerOption { return func(o *tracerOptions) { for k, v := range tags { o.tags[k] = v } } }
go
func Tags(tags map[string]string) TracerOption { return func(o *tracerOptions) { for k, v := range tags { o.tags[k] = v } } }
[ "func", "Tags", "(", "tags", "map", "[", "string", "]", "string", ")", "TracerOption", "{", "return", "func", "(", "o", "*", "tracerOptions", ")", "{", "for", "k", ",", "v", ":=", "range", "tags", "{", "o", ".", "tags", "[", "k", "]", "=", "v", ...
// Tags adds default tags to our Zipkin transport spans.
[ "Tags", "adds", "default", "tags", "to", "our", "Zipkin", "transport", "spans", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/zipkin/options.go#L22-L28
126,771
go-kit/kit
examples/shipping/booking/instrumenting.go
NewInstrumentingService
func NewInstrumentingService(counter metrics.Counter, latency metrics.Histogram, s Service) Service { return &instrumentingService{ requestCount: counter, requestLatency: latency, Service: s, } }
go
func NewInstrumentingService(counter metrics.Counter, latency metrics.Histogram, s Service) Service { return &instrumentingService{ requestCount: counter, requestLatency: latency, Service: s, } }
[ "func", "NewInstrumentingService", "(", "counter", "metrics", ".", "Counter", ",", "latency", "metrics", ".", "Histogram", ",", "s", "Service", ")", "Service", "{", "return", "&", "instrumentingService", "{", "requestCount", ":", "counter", ",", "requestLatency", ...
// NewInstrumentingService returns an instance of an instrumenting Service.
[ "NewInstrumentingService", "returns", "an", "instance", "of", "an", "instrumenting", "Service", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/booking/instrumenting.go#L19-L25
126,772
go-kit/kit
metrics/internal/lv/space.go
Observe
func (s *Space) Observe(name string, lvs LabelValues, value float64) { s.nodeFor(name).observe(lvs, value) }
go
func (s *Space) Observe(name string, lvs LabelValues, value float64) { s.nodeFor(name).observe(lvs, value) }
[ "func", "(", "s", "*", "Space", ")", "Observe", "(", "name", "string", ",", "lvs", "LabelValues", ",", "value", "float64", ")", "{", "s", ".", "nodeFor", "(", "name", ")", ".", "observe", "(", "lvs", ",", "value", ")", "\n", "}" ]
// Observe locates the time series identified by the name and label values in // the vector space, and appends the value to the list of observations.
[ "Observe", "locates", "the", "time", "series", "identified", "by", "the", "name", "and", "label", "values", "in", "the", "vector", "space", "and", "appends", "the", "value", "to", "the", "list", "of", "observations", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/internal/lv/space.go#L20-L22
126,773
go-kit/kit
metrics/internal/lv/space.go
Add
func (s *Space) Add(name string, lvs LabelValues, delta float64) { s.nodeFor(name).add(lvs, delta) }
go
func (s *Space) Add(name string, lvs LabelValues, delta float64) { s.nodeFor(name).add(lvs, delta) }
[ "func", "(", "s", "*", "Space", ")", "Add", "(", "name", "string", ",", "lvs", "LabelValues", ",", "delta", "float64", ")", "{", "s", ".", "nodeFor", "(", "name", ")", ".", "add", "(", "lvs", ",", "delta", ")", "\n", "}" ]
// Add locates the time series identified by the name and label values in // the vector space, and appends the delta to the last value in the list of // observations.
[ "Add", "locates", "the", "time", "series", "identified", "by", "the", "name", "and", "label", "values", "in", "the", "vector", "space", "and", "appends", "the", "delta", "to", "the", "last", "value", "in", "the", "list", "of", "observations", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/internal/lv/space.go#L27-L29
126,774
go-kit/kit
metrics/internal/lv/space.go
Walk
func (s *Space) Walk(fn func(name string, lvs LabelValues, observations []float64) bool) { s.mtx.RLock() defer s.mtx.RUnlock() for name, node := range s.nodes { f := func(lvs LabelValues, observations []float64) bool { return fn(name, lvs, observations) } if !node.walk(LabelValues{}, f) { return } } }
go
func (s *Space) Walk(fn func(name string, lvs LabelValues, observations []float64) bool) { s.mtx.RLock() defer s.mtx.RUnlock() for name, node := range s.nodes { f := func(lvs LabelValues, observations []float64) bool { return fn(name, lvs, observations) } if !node.walk(LabelValues{}, f) { return } } }
[ "func", "(", "s", "*", "Space", ")", "Walk", "(", "fn", "func", "(", "name", "string", ",", "lvs", "LabelValues", ",", "observations", "[", "]", "float64", ")", "bool", ")", "{", "s", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "s", ".", ...
// Walk traverses the vector space and invokes fn for each non-empty time series // which is encountered. Return false to abort the traversal.
[ "Walk", "traverses", "the", "vector", "space", "and", "invokes", "fn", "for", "each", "non", "-", "empty", "time", "series", "which", "is", "encountered", ".", "Return", "false", "to", "abort", "the", "traversal", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/internal/lv/space.go#L33-L42
126,775
go-kit/kit
metrics/internal/lv/space.go
Reset
func (s *Space) Reset() *Space { s.mtx.Lock() defer s.mtx.Unlock() n := NewSpace() n.nodes, s.nodes = s.nodes, n.nodes return n }
go
func (s *Space) Reset() *Space { s.mtx.Lock() defer s.mtx.Unlock() n := NewSpace() n.nodes, s.nodes = s.nodes, n.nodes return n }
[ "func", "(", "s", "*", "Space", ")", "Reset", "(", ")", "*", "Space", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mtx", ".", "Unlock", "(", ")", "\n", "n", ":=", "NewSpace", "(", ")", "\n", "n", ".", "nodes", ",",...
// Reset empties the current space and returns a new Space with the old // contents. Reset a Space to get an immutable copy suitable for walking.
[ "Reset", "empties", "the", "current", "space", "and", "returns", "a", "new", "Space", "with", "the", "old", "contents", ".", "Reset", "a", "Space", "to", "get", "an", "immutable", "copy", "suitable", "for", "walking", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/internal/lv/space.go#L46-L52
126,776
go-kit/kit
transport/amqp/subscriber.go
NewSubscriber
func NewSubscriber( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...SubscriberOption, ) *Subscriber { s := &Subscriber{ e: e, dec: dec, enc: enc, responsePublisher: DefaultResponsePublisher, errorEncoder: DefaultErrorEncoder,...
go
func NewSubscriber( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...SubscriberOption, ) *Subscriber { s := &Subscriber{ e: e, dec: dec, enc: enc, responsePublisher: DefaultResponsePublisher, errorEncoder: DefaultErrorEncoder,...
[ "func", "NewSubscriber", "(", "e", "endpoint", ".", "Endpoint", ",", "dec", "DecodeRequestFunc", ",", "enc", "EncodeResponseFunc", ",", "options", "...", "SubscriberOption", ",", ")", "*", "Subscriber", "{", "s", ":=", "&", "Subscriber", "{", "e", ":", "e", ...
// NewSubscriber constructs a new subscriber, which provides a handler // for AMQP Delivery messages.
[ "NewSubscriber", "constructs", "a", "new", "subscriber", "which", "provides", "a", "handler", "for", "AMQP", "Delivery", "messages", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L28-L46
126,777
go-kit/kit
transport/amqp/subscriber.go
SubscriberBefore
func SubscriberBefore(before ...RequestFunc) SubscriberOption { return func(s *Subscriber) { s.before = append(s.before, before...) } }
go
func SubscriberBefore(before ...RequestFunc) SubscriberOption { return func(s *Subscriber) { s.before = append(s.before, before...) } }
[ "func", "SubscriberBefore", "(", "before", "...", "RequestFunc", ")", "SubscriberOption", "{", "return", "func", "(", "s", "*", "Subscriber", ")", "{", "s", ".", "before", "=", "append", "(", "s", ".", "before", ",", "before", "...", ")", "}", "\n", "}...
// SubscriberBefore functions are executed on the publisher delivery object // before the request is decoded.
[ "SubscriberBefore", "functions", "are", "executed", "on", "the", "publisher", "delivery", "object", "before", "the", "request", "is", "decoded", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L53-L55
126,778
go-kit/kit
transport/amqp/subscriber.go
SubscriberAfter
func SubscriberAfter(after ...SubscriberResponseFunc) SubscriberOption { return func(s *Subscriber) { s.after = append(s.after, after...) } }
go
func SubscriberAfter(after ...SubscriberResponseFunc) SubscriberOption { return func(s *Subscriber) { s.after = append(s.after, after...) } }
[ "func", "SubscriberAfter", "(", "after", "...", "SubscriberResponseFunc", ")", "SubscriberOption", "{", "return", "func", "(", "s", "*", "Subscriber", ")", "{", "s", ".", "after", "=", "append", "(", "s", ".", "after", ",", "after", "...", ")", "}", "\n"...
// SubscriberAfter functions are executed on the subscriber reply after the // endpoint is invoked, but before anything is published to the reply.
[ "SubscriberAfter", "functions", "are", "executed", "on", "the", "subscriber", "reply", "after", "the", "endpoint", "is", "invoked", "but", "before", "anything", "is", "published", "to", "the", "reply", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L59-L61
126,779
go-kit/kit
transport/amqp/subscriber.go
SubscriberErrorHandler
func SubscriberErrorHandler(errorHandler transport.ErrorHandler) SubscriberOption { return func(s *Subscriber) { s.errorHandler = errorHandler } }
go
func SubscriberErrorHandler(errorHandler transport.ErrorHandler) SubscriberOption { return func(s *Subscriber) { s.errorHandler = errorHandler } }
[ "func", "SubscriberErrorHandler", "(", "errorHandler", "transport", ".", "ErrorHandler", ")", "SubscriberOption", "{", "return", "func", "(", "s", "*", "Subscriber", ")", "{", "s", ".", "errorHandler", "=", "errorHandler", "}", "\n", "}" ]
// SubscriberErrorHandler is used to handle non-terminal errors. By default, non-terminal errors // are ignored. This is intended as a diagnostic measure. Finer-grained control // of error handling, including logging in more detail, should be performed in a // custom SubscriberErrorEncoder which has access to the conte...
[ "SubscriberErrorHandler", "is", "used", "to", "handle", "non", "-", "terminal", "errors", ".", "By", "default", "non", "-", "terminal", "errors", "are", "ignored", ".", "This", "is", "intended", "as", "a", "diagnostic", "measure", ".", "Finer", "-", "grained...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L91-L93
126,780
go-kit/kit
transport/amqp/subscriber.go
EncodeJSONResponse
func EncodeJSONResponse( ctx context.Context, pub *amqp.Publishing, response interface{}, ) error { b, err := json.Marshal(response) if err != nil { return err } pub.Body = b return nil }
go
func EncodeJSONResponse( ctx context.Context, pub *amqp.Publishing, response interface{}, ) error { b, err := json.Marshal(response) if err != nil { return err } pub.Body = b return nil }
[ "func", "EncodeJSONResponse", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "response", "interface", "{", "}", ",", ")", "error", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "response", ")", "\n", ...
// EncodeJSONResponse marshals the response as JSON as part of the // payload of the AMQP Publishing object.
[ "EncodeJSONResponse", "marshals", "the", "response", "as", "JSON", "as", "part", "of", "the", "payload", "of", "the", "AMQP", "Publishing", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L144-L155
126,781
go-kit/kit
transport/amqp/subscriber.go
EncodeNopResponse
func EncodeNopResponse( ctx context.Context, pub *amqp.Publishing, response interface{}, ) error { return nil }
go
func EncodeNopResponse( ctx context.Context, pub *amqp.Publishing, response interface{}, ) error { return nil }
[ "func", "EncodeNopResponse", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "response", "interface", "{", "}", ",", ")", "error", "{", "return", "nil", "\n", "}" ]
// EncodeNopResponse is a response function that does nothing.
[ "EncodeNopResponse", "is", "a", "response", "function", "that", "does", "nothing", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L158-L164
126,782
go-kit/kit
transport/amqp/subscriber.go
DefaultResponsePublisher
func DefaultResponsePublisher( ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) error { if pub.CorrelationId == "" { pub.CorrelationId = deliv.CorrelationId } replyExchange := getPublishExchange(ctx) replyTo := getPublishKey(ctx) if replyTo == "" { replyTo = deliv.ReplyTo } ...
go
func DefaultResponsePublisher( ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) error { if pub.CorrelationId == "" { pub.CorrelationId = deliv.CorrelationId } replyExchange := getPublishExchange(ctx) replyTo := getPublishKey(ctx) if replyTo == "" { replyTo = deliv.ReplyTo } ...
[ "func", "DefaultResponsePublisher", "(", "ctx", "context", ".", "Context", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing", ",", ")", "error", "{", "if", "pub", ".", "CorrelationId", "==", "\""...
// DefaultResponsePublisher extracts the reply exchange and reply key // from the request, and sends the response object to that destination.
[ "DefaultResponsePublisher", "extracts", "the", "reply", "exchange", "and", "reply", "key", "from", "the", "request", "and", "sends", "the", "response", "object", "to", "that", "destination", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L180-L203
126,783
go-kit/kit
transport/amqp/subscriber.go
NopResponsePublisher
func NopResponsePublisher( ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) error { return nil }
go
func NopResponsePublisher( ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) error { return nil }
[ "func", "NopResponsePublisher", "(", "ctx", "context", ".", "Context", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing", ",", ")", "error", "{", "return", "nil", "\n", "}" ]
// NopResponsePublisher does not deliver a response to the original sender. // This response publisher is used when the user wants the subscriber to // receive and forget.
[ "NopResponsePublisher", "does", "not", "deliver", "a", "response", "to", "the", "original", "sender", ".", "This", "response", "publisher", "is", "used", "when", "the", "user", "wants", "the", "subscriber", "to", "receive", "and", "forget", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L208-L215
126,784
go-kit/kit
transport/amqp/subscriber.go
SingleNackRequeueErrorEncoder
func SingleNackRequeueErrorEncoder(ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing) { deliv.Nack( false, //multiple true, //requeue ) duration := getNackSleepDuration(ctx) time.Sleep(duration) }
go
func SingleNackRequeueErrorEncoder(ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing) { deliv.Nack( false, //multiple true, //requeue ) duration := getNackSleepDuration(ctx) time.Sleep(duration) }
[ "func", "SingleNackRequeueErrorEncoder", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing", ")", "{", "deliv", ".", "Nack", "(", "false...
// SingleNackRequeueErrorEncoder issues a Nack to the delivery with multiple flag set as false // and requeue flag set as true. It does not reply the message.
[ "SingleNackRequeueErrorEncoder", "issues", "a", "Nack", "to", "the", "delivery", "with", "multiple", "flag", "set", "as", "false", "and", "requeue", "flag", "set", "as", "true", ".", "It", "does", "not", "reply", "the", "message", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L232-L240
126,785
go-kit/kit
transport/amqp/subscriber.go
ReplyErrorEncoder
func ReplyErrorEncoder( ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) { if pub.CorrelationId == "" { pub.CorrelationId = deliv.CorrelationId } replyExchange := getPublishExchange(ctx) replyTo := getPublishKey(ctx) if replyTo == "" { replyTo = deliv.ReplyTo } ...
go
func ReplyErrorEncoder( ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) { if pub.CorrelationId == "" { pub.CorrelationId = deliv.CorrelationId } replyExchange := getPublishExchange(ctx) replyTo := getPublishKey(ctx) if replyTo == "" { replyTo = deliv.ReplyTo } ...
[ "func", "ReplyErrorEncoder", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing", ",", ")", "{", "if", "pub", ".", "CorrelationId", "==...
// ReplyErrorEncoder serializes the error message as a DefaultErrorResponse // JSON and sends the message to the ReplyTo address.
[ "ReplyErrorEncoder", "serializes", "the", "error", "message", "as", "a", "DefaultErrorResponse", "JSON", "and", "sends", "the", "message", "to", "the", "ReplyTo", "address", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L244-L277
126,786
go-kit/kit
transport/amqp/subscriber.go
ReplyAndAckErrorEncoder
func ReplyAndAckErrorEncoder(ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing) { ReplyErrorEncoder(ctx, err, deliv, ch, pub) deliv.Ack(false) }
go
func ReplyAndAckErrorEncoder(ctx context.Context, err error, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing) { ReplyErrorEncoder(ctx, err, deliv, ch, pub) deliv.Ack(false) }
[ "func", "ReplyAndAckErrorEncoder", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing", ")", "{", "ReplyErrorEncoder", "(", "ctx", ",", "...
// ReplyAndAckErrorEncoder serializes the error message as a DefaultErrorResponse // JSON and sends the message to the ReplyTo address then Acks the original // message.
[ "ReplyAndAckErrorEncoder", "serializes", "the", "error", "message", "as", "a", "DefaultErrorResponse", "JSON", "and", "sends", "the", "message", "to", "the", "ReplyTo", "address", "then", "Acks", "the", "original", "message", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/subscriber.go#L282-L285
126,787
go-kit/kit
metrics/influxstatsd/influxstatsd.go
New
func New(prefix string, logger log.Logger, lvs ...string) *Influxstatsd { if len(lvs)%2 != 0 { panic("odd number of LabelValues; programmer error!") } return &Influxstatsd{ prefix: prefix, rates: ratemap.New(), counters: lv.NewSpace(), gauges: map[string]*gaugeNode{}, // https://github.com/g...
go
func New(prefix string, logger log.Logger, lvs ...string) *Influxstatsd { if len(lvs)%2 != 0 { panic("odd number of LabelValues; programmer error!") } return &Influxstatsd{ prefix: prefix, rates: ratemap.New(), counters: lv.NewSpace(), gauges: map[string]*gaugeNode{}, // https://github.com/g...
[ "func", "New", "(", "prefix", "string", ",", "logger", "log", ".", "Logger", ",", "lvs", "...", "string", ")", "*", "Influxstatsd", "{", "if", "len", "(", "lvs", ")", "%", "2", "!=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "re...
// New returns a Influxstatsd object that may be used to create metrics. Prefix is // applied to all created metrics. Callers must ensure that regular calls to // WriteTo are performed, either manually or with one of the helper methods.
[ "New", "returns", "a", "Influxstatsd", "object", "that", "may", "be", "used", "to", "create", "metrics", ".", "Prefix", "is", "applied", "to", "all", "created", "metrics", ".", "Callers", "must", "ensure", "that", "regular", "calls", "to", "WriteTo", "are", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L55-L69
126,788
go-kit/kit
metrics/influxstatsd/influxstatsd.go
NewCounter
func (d *Influxstatsd) NewCounter(name string, sampleRate float64) *Counter { d.rates.Set(name, sampleRate) return &Counter{ name: name, obs: d.counters.Observe, } }
go
func (d *Influxstatsd) NewCounter(name string, sampleRate float64) *Counter { d.rates.Set(name, sampleRate) return &Counter{ name: name, obs: d.counters.Observe, } }
[ "func", "(", "d", "*", "Influxstatsd", ")", "NewCounter", "(", "name", "string", ",", "sampleRate", "float64", ")", "*", "Counter", "{", "d", ".", "rates", ".", "Set", "(", "name", ",", "sampleRate", ")", "\n", "return", "&", "Counter", "{", "name", ...
// NewCounter returns a counter, sending observations to this Influxstatsd object.
[ "NewCounter", "returns", "a", "counter", "sending", "observations", "to", "this", "Influxstatsd", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L72-L78
126,789
go-kit/kit
metrics/influxstatsd/influxstatsd.go
NewGauge
func (d *Influxstatsd) NewGauge(name string) *Gauge { d.mtx.Lock() n, ok := d.gauges[name] if !ok { n = &gaugeNode{gauge: &Gauge{g: generic.NewGauge(name), influx: d}} d.gauges[name] = n } d.mtx.Unlock() return n.gauge }
go
func (d *Influxstatsd) NewGauge(name string) *Gauge { d.mtx.Lock() n, ok := d.gauges[name] if !ok { n = &gaugeNode{gauge: &Gauge{g: generic.NewGauge(name), influx: d}} d.gauges[name] = n } d.mtx.Unlock() return n.gauge }
[ "func", "(", "d", "*", "Influxstatsd", ")", "NewGauge", "(", "name", "string", ")", "*", "Gauge", "{", "d", ".", "mtx", ".", "Lock", "(", ")", "\n", "n", ",", "ok", ":=", "d", ".", "gauges", "[", "name", "]", "\n", "if", "!", "ok", "{", "n", ...
// NewGauge returns a gauge, sending observations to this Influxstatsd object.
[ "NewGauge", "returns", "a", "gauge", "sending", "observations", "to", "this", "Influxstatsd", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L81-L90
126,790
go-kit/kit
metrics/influxstatsd/influxstatsd.go
NewTiming
func (d *Influxstatsd) NewTiming(name string, sampleRate float64) *Timing { d.rates.Set(name, sampleRate) return &Timing{ name: name, obs: d.timings.Observe, } }
go
func (d *Influxstatsd) NewTiming(name string, sampleRate float64) *Timing { d.rates.Set(name, sampleRate) return &Timing{ name: name, obs: d.timings.Observe, } }
[ "func", "(", "d", "*", "Influxstatsd", ")", "NewTiming", "(", "name", "string", ",", "sampleRate", "float64", ")", "*", "Timing", "{", "d", ".", "rates", ".", "Set", "(", "name", ",", "sampleRate", ")", "\n", "return", "&", "Timing", "{", "name", ":"...
// NewTiming returns a histogram whose observations are interpreted as // millisecond durations, and are forwarded to this Influxstatsd object.
[ "NewTiming", "returns", "a", "histogram", "whose", "observations", "are", "interpreted", "as", "millisecond", "durations", "and", "are", "forwarded", "to", "this", "Influxstatsd", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L94-L100
126,791
go-kit/kit
metrics/influxstatsd/influxstatsd.go
NewHistogram
func (d *Influxstatsd) NewHistogram(name string, sampleRate float64) *Histogram { d.rates.Set(name, sampleRate) return &Histogram{ name: name, obs: d.histograms.Observe, } }
go
func (d *Influxstatsd) NewHistogram(name string, sampleRate float64) *Histogram { d.rates.Set(name, sampleRate) return &Histogram{ name: name, obs: d.histograms.Observe, } }
[ "func", "(", "d", "*", "Influxstatsd", ")", "NewHistogram", "(", "name", "string", ",", "sampleRate", "float64", ")", "*", "Histogram", "{", "d", ".", "rates", ".", "Set", "(", "name", ",", "sampleRate", ")", "\n", "return", "&", "Histogram", "{", "nam...
// NewHistogram returns a histogram whose observations are of an unspecified // unit, and are forwarded to this Influxstatsd object.
[ "NewHistogram", "returns", "a", "histogram", "whose", "observations", "are", "of", "an", "unspecified", "unit", "and", "are", "forwarded", "to", "this", "Influxstatsd", "object", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L104-L110
126,792
go-kit/kit
metrics/influxstatsd/influxstatsd.go
With
func (t *Timing) With(labelValues ...string) metrics.Histogram { return &Timing{ name: t.name, lvs: t.lvs.With(labelValues...), obs: t.obs, } }
go
func (t *Timing) With(labelValues ...string) metrics.Histogram { return &Timing{ name: t.name, lvs: t.lvs.With(labelValues...), obs: t.obs, } }
[ "func", "(", "t", "*", "Timing", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Histogram", "{", "return", "&", "Timing", "{", "name", ":", "t", ".", "name", ",", "lvs", ":", "t", ".", "lvs", ".", "With", "(", "labelValues"...
// With implements metrics.Timing.
[ "With", "implements", "metrics", ".", "Timing", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influxstatsd/influxstatsd.go#L304-L310
126,793
go-kit/kit
sd/consul/registrar.go
NewRegistrar
func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger log.Logger) *Registrar { return &Registrar{ client: client, registration: r, logger: log.With(logger, "service", r.Name, "tags", fmt.Sprint(r.Tags), "address", r.Address), } }
go
func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger log.Logger) *Registrar { return &Registrar{ client: client, registration: r, logger: log.With(logger, "service", r.Name, "tags", fmt.Sprint(r.Tags), "address", r.Address), } }
[ "func", "NewRegistrar", "(", "client", "Client", ",", "r", "*", "stdconsul", ".", "AgentServiceRegistration", ",", "logger", "log", ".", "Logger", ")", "*", "Registrar", "{", "return", "&", "Registrar", "{", "client", ":", "client", ",", "registration", ":",...
// NewRegistrar returns a Consul Registrar acting on the provided catalog // registration.
[ "NewRegistrar", "returns", "a", "Consul", "Registrar", "acting", "on", "the", "provided", "catalog", "registration", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/consul/registrar.go#L20-L26
126,794
go-kit/kit
sd/consul/registrar.go
Register
func (p *Registrar) Register() { if err := p.client.Register(p.registration); err != nil { p.logger.Log("err", err) } else { p.logger.Log("action", "register") } }
go
func (p *Registrar) Register() { if err := p.client.Register(p.registration); err != nil { p.logger.Log("err", err) } else { p.logger.Log("action", "register") } }
[ "func", "(", "p", "*", "Registrar", ")", "Register", "(", ")", "{", "if", "err", ":=", "p", ".", "client", ".", "Register", "(", "p", ".", "registration", ")", ";", "err", "!=", "nil", "{", "p", ".", "logger", ".", "Log", "(", "\"", "\"", ",", ...
// Register implements sd.Registrar interface.
[ "Register", "implements", "sd", ".", "Registrar", "interface", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/consul/registrar.go#L29-L35
126,795
go-kit/kit
metrics/provider/graphite.go
NewGraphiteProvider
func NewGraphiteProvider(g *graphite.Graphite, stop func()) Provider { return &graphiteProvider{ g: g, stop: stop, } }
go
func NewGraphiteProvider(g *graphite.Graphite, stop func()) Provider { return &graphiteProvider{ g: g, stop: stop, } }
[ "func", "NewGraphiteProvider", "(", "g", "*", "graphite", ".", "Graphite", ",", "stop", "func", "(", ")", ")", "Provider", "{", "return", "&", "graphiteProvider", "{", "g", ":", "g", ",", "stop", ":", "stop", ",", "}", "\n", "}" ]
// NewGraphiteProvider wraps the given Graphite object and stop func and returns // a Provider that produces Graphite metrics. A typical stop function would be // ticker.Stop from the ticker passed to the SendLoop helper method.
[ "NewGraphiteProvider", "wraps", "the", "given", "Graphite", "object", "and", "stop", "func", "and", "returns", "a", "Provider", "that", "produces", "Graphite", "metrics", ".", "A", "typical", "stop", "function", "would", "be", "ticker", ".", "Stop", "from", "t...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/graphite.go#L16-L21
126,796
go-kit/kit
auth/casbin/middleware.go
NewEnforcer
func NewEnforcer( subject string, object interface{}, action string, ) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) ( response interface{}, err error, ) { casbinModel := ctx.Value(CasbinModelContextKey) casbinPolicy :=...
go
func NewEnforcer( subject string, object interface{}, action string, ) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) ( response interface{}, err error, ) { casbinModel := ctx.Value(CasbinModelContextKey) casbinPolicy :=...
[ "func", "NewEnforcer", "(", "subject", "string", ",", "object", "interface", "{", "}", ",", "action", "string", ",", ")", "endpoint", ".", "Middleware", "{", "return", "func", "(", "next", "endpoint", ".", "Endpoint", ")", "endpoint", ".", "Endpoint", "{",...
// NewEnforcer checks whether the subject is authorized to do the specified // action on the given object. If a valid access control model and policy // is given, then the generated casbin Enforcer is stored in the context // with CasbinEnforcer as the key.
[ "NewEnforcer", "checks", "whether", "the", "subject", "is", "authorized", "to", "do", "the", "specified", "action", "on", "the", "given", "object", ".", "If", "a", "valid", "access", "control", "model", "and", "policy", "is", "given", "then", "the", "generat...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/auth/casbin/middleware.go#L47-L65
126,797
go-kit/kit
metrics/provider/statsd.go
NewStatsdProvider
func NewStatsdProvider(s *statsd.Statsd, stop func()) Provider { return &statsdProvider{ s: s, stop: stop, } }
go
func NewStatsdProvider(s *statsd.Statsd, stop func()) Provider { return &statsdProvider{ s: s, stop: stop, } }
[ "func", "NewStatsdProvider", "(", "s", "*", "statsd", ".", "Statsd", ",", "stop", "func", "(", ")", ")", "Provider", "{", "return", "&", "statsdProvider", "{", "s", ":", "s", ",", "stop", ":", "stop", ",", "}", "\n", "}" ]
// NewStatsdProvider wraps the given Statsd object and stop func and returns a // Provider that produces Statsd metrics. A typical stop function would be // ticker.Stop from the ticker passed to the SendLoop helper method.
[ "NewStatsdProvider", "wraps", "the", "given", "Statsd", "object", "and", "stop", "func", "and", "returns", "a", "Provider", "that", "produces", "Statsd", "metrics", ".", "A", "typical", "stop", "function", "would", "be", "ticker", ".", "Stop", "from", "the", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/statsd.go#L16-L21
126,798
go-kit/kit
metrics/provider/statsd.go
NewHistogram
func (p *statsdProvider) NewHistogram(name string, _ int) metrics.Histogram { return p.s.NewTiming(name, 1.0) }
go
func (p *statsdProvider) NewHistogram(name string, _ int) metrics.Histogram { return p.s.NewTiming(name, 1.0) }
[ "func", "(", "p", "*", "statsdProvider", ")", "NewHistogram", "(", "name", "string", ",", "_", "int", ")", "metrics", ".", "Histogram", "{", "return", "p", ".", "s", ".", "NewTiming", "(", "name", ",", "1.0", ")", "\n", "}" ]
// NewHistogram implements Provider, returning a StatsD Timing that accepts // observations in milliseconds. The sample rate is fixed at 1.0. The bucket // parameter is ignored.
[ "NewHistogram", "implements", "Provider", "returning", "a", "StatsD", "Timing", "that", "accepts", "observations", "in", "milliseconds", ".", "The", "sample", "rate", "is", "fixed", "at", "1", ".", "0", ".", "The", "bucket", "parameter", "is", "ignored", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/statsd.go#L36-L38
126,799
go-kit/kit
transport/awslambda/handler.go
NewHandler
func NewHandler( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...HandlerOption, ) *Handler { h := &Handler{ e: e, dec: dec, enc: enc, errorEncoder: DefaultErrorEncoder, errorHandler: transport.NewLogErrorHandler(log.NewNopLogger()), } for _, o...
go
func NewHandler( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...HandlerOption, ) *Handler { h := &Handler{ e: e, dec: dec, enc: enc, errorEncoder: DefaultErrorEncoder, errorHandler: transport.NewLogErrorHandler(log.NewNopLogger()), } for _, o...
[ "func", "NewHandler", "(", "e", "endpoint", ".", "Endpoint", ",", "dec", "DecodeRequestFunc", ",", "enc", "EncodeResponseFunc", ",", "options", "...", "HandlerOption", ",", ")", "*", "Handler", "{", "h", ":=", "&", "Handler", "{", "e", ":", "e", ",", "de...
// NewHandler constructs a new handler, which implements // the AWS lambda.Handler interface.
[ "NewHandler", "constructs", "a", "new", "handler", "which", "implements", "the", "AWS", "lambda", ".", "Handler", "interface", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/awslambda/handler.go#L25-L42