repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/endpointer.go | sd/endpointer.go | package sd
import (
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/log"
)
// Endpointer listens to a service discovery system and yields a set of
// identical endpoints on demand. An error indicates a problem with connectivity
// to the service discovery system, or within the system itself; an Endpoin... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/endpoint_cache.go | sd/endpoint_cache.go | package sd
import (
"io"
"sort"
"sync"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/log"
)
// endpointCache collects the most recent set of instances from a service discovery
// system, creates endpoints for them using a factory function, and makes
// them available to consumers.
type endpointCac... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/endpoint_cache_test.go | sd/endpoint_cache_test.go | package sd
import (
"errors"
"io"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/log"
)
func TestEndpointCache(t *testing.T) {
var (
ca = make(closer)
cb = make(closer)
c = map[string]io.Closer{"a": ca, "b": cb}
f = func(instance string) (endpoint.Endpoint, io.Close... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/factory.go | sd/factory.go | package sd
import (
"io"
"github.com/go-kit/kit/endpoint"
)
// Factory is a function that converts an instance string (e.g. host:port) to a
// specific endpoint. Instances that provide multiple endpoints require multiple
// factories. A factory also returns an io.Closer that's invoked when the
// instance goes awa... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/benchmark_test.go | sd/benchmark_test.go | package sd
import (
"io"
"testing"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/log"
)
func BenchmarkEndpoints(b *testing.B) {
var (
ca = make(closer)
cb = make(closer)
cmap = map[string]io.Closer{"a": ca, "b": cb}
factory = func(instance string) (endpoint.Endpoint, io.Closer, error)... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/registrar.go | sd/registrar.go | package sd
// Registrar registers instance information to a service discovery system when
// an instance becomes alive and healthy, and deregisters that information when
// the service becomes unhealthy or goes away.
//
// Registrar implementations exist for various service discovery systems. Note
// that identifying ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/doc.go | sd/doc.go | // Package sd provides utilities related to service discovery. That includes the
// client-side loadbalancer pattern, where a microservice subscribes to a
// service discovery system in order to reach remote instances; as well as the
// registrator pattern, where a microservice registers itself in a service
// discover... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/endpointer_test.go | sd/endpointer_test.go | package sd_test
import (
"io"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
func TestDefaultEndpointer(t *testing.T) {
var (
ca = make(closer)
cb = make(closer)
c = map[string]io.Closer{"a": ca, "b": ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/instancer.go | sd/consul/instancer.go | package consul
import (
"errors"
"fmt"
"time"
consul "github.com/hashicorp/consul/api"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/kit/util/conn"
"github.com/go-kit/log"
)
const defaultIndex = 0
// errStopped notifies the loop to quit. aka stopped via quitc
va... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/client.go | sd/consul/client.go | package consul
import (
consul "github.com/hashicorp/consul/api"
)
// Client is a wrapper around the Consul API.
type Client interface {
// Register a service with the local agent.
Register(r *consul.AgentServiceRegistration) error
// Deregister a service with the local agent.
Deregister(r *consul.AgentServiceR... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/registrar_test.go | sd/consul/registrar_test.go | package consul
import (
"testing"
stdconsul "github.com/hashicorp/consul/api"
"github.com/go-kit/log"
)
func TestRegistrar(t *testing.T) {
client := newTestClient([]*stdconsul.ServiceEntry{})
p := NewRegistrar(client, testRegistration, log.NewNopLogger())
if want, have := 0, len(client.entries); want != have ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/client_test.go | sd/consul/client_test.go | package consul
import (
"context"
"errors"
"io"
"reflect"
"testing"
stdconsul "github.com/hashicorp/consul/api"
"github.com/go-kit/kit/endpoint"
)
func TestClientRegistration(t *testing.T) {
c := newTestClient(nil)
services, _, err := c.Service(testRegistration.Name, "", true, &stdconsul.QueryOptions{})
... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/instancer_test.go | sd/consul/instancer_test.go | package consul
import (
"context"
"fmt"
"io"
"testing"
"time"
consul "github.com/hashicorp/consul/api"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
var consulState = []*consul.ServiceEntry{
{
Node: &consul.Node{
Address: "10.0.0.0",
Node:... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/integration_test.go | sd/consul/integration_test.go | //go:build integration
// +build integration
package consul
import (
"io"
"os"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
stdconsul "github.com/hashicorp/consul/api"
)
func TestIntegration(t *testing.T) {
consulAddr := os.Getenv("CONSUL_ADDR")
if c... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/registrar.go | sd/consul/registrar.go | package consul
import (
"fmt"
stdconsul "github.com/hashicorp/consul/api"
"github.com/go-kit/log"
)
// Registrar registers service instance liveness information to Consul.
type Registrar struct {
client Client
registration *stdconsul.AgentServiceRegistration
logger log.Logger
}
// NewRegistrar re... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/consul/doc.go | sd/consul/doc.go | // Package consul provides Instancer and Registrar implementations for Consul.
package consul
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/dnssrv/instancer.go | sd/dnssrv/instancer.go | package dnssrv
import (
"errors"
"fmt"
"net"
"time"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
// ErrPortZero is returned by the resolve machinery
// when a DNS resolver returns an SRV record with its
// port set to zero.
var ErrPortZero = errors.New("res... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/dnssrv/instancer_test.go | sd/dnssrv/instancer_test.go | package dnssrv
import (
"net"
"sync/atomic"
"testing"
"time"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
func TestRefresh(t *testing.T) {
name := "some.service.internal"
ticker := time.NewTicker(time.Second)
ticker.Stop()
tickc := make(chan tim... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/dnssrv/lookup.go | sd/dnssrv/lookup.go | package dnssrv
import "net"
// Lookup is a function that resolves a DNS SRV record to multiple addresses.
// It has the same signature as net.LookupSRV.
type Lookup func(service, proto, name string) (cname string, addrs []*net.SRV, err error)
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/dnssrv/doc.go | sd/dnssrv/doc.go | // Package dnssrv provides an Instancer implementation for DNS SRV records.
package dnssrv
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/instancer.go | sd/eureka/instancer.go | package eureka
import (
"fmt"
"github.com/hudl/fargo"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
// Instancer yields instances stored in the Eureka registry for the given app.
// Changes in that app are watched and will update the subscribers.
type Instanc... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/registrar_test.go | sd/eureka/registrar_test.go | package eureka
import (
"testing"
"time"
)
func TestRegistrar(t *testing.T) {
connection := &testConnection{
errHeartbeat: errTest,
}
registrar1 := NewRegistrar(connection, instanceTest1, loggerTest)
registrar2 := NewRegistrar(connection, instanceTest2, loggerTest)
// Not registered.
registrar1.Deregister... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/instancer_test.go | sd/eureka/instancer_test.go | package eureka
import (
"testing"
"time"
"github.com/hudl/fargo"
"github.com/go-kit/kit/sd"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
func TestInstancer(t *testing.T) {
connection := &testConnection{
instances: []*fargo.Instance{instanceTest1, instanceTest2},
errApplication: nil,
}
ins... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/integration_test.go | sd/eureka/integration_test.go | //go:build integration
// +build integration
package eureka
import (
"os"
"testing"
"time"
"github.com/hudl/fargo"
"github.com/go-kit/log"
)
// Package sd/eureka provides a wrapper around the Netflix Eureka service
// registry by way of the Fargo library. This test assumes the user has an
// instance of Eurek... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/registrar.go | sd/eureka/registrar.go | package eureka
import (
"fmt"
"net/http"
"sync"
"time"
"github.com/hudl/fargo"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
// Matches official Netflix Java client default.
const defaultRenewalInterval = 30 * time.Second
// The methods of fargo.Connection used in this package.
type fargoConnection i... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/doc.go | sd/eureka/doc.go | // Package eureka provides Instancer and Registrar implementations for Netflix OSS's Eureka
package eureka
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/eureka/util_test.go | sd/eureka/util_test.go | package eureka
import (
"errors"
"fmt"
"reflect"
"sync"
"time"
"github.com/go-kit/log"
"github.com/hudl/fargo"
)
type testConnection struct {
mu sync.RWMutex
instances []*fargo.Instance
errApplication error
errHeartbeat error
errRegister error
errDeregister error
}
var (
errTest = ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/instancer.go | sd/zk/instancer.go | package zk
import (
"github.com/go-zookeeper/zk"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
// Instancer yield instances stored in a certain ZooKeeper path. Any kind of
// change in that path is watched and will update the subscribers.
type Instancer struct ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/client.go | sd/zk/client.go | package zk
import (
"errors"
"net"
"strings"
"time"
"github.com/go-zookeeper/zk"
"github.com/go-kit/log"
)
// DefaultACL is the default ACL to use for creating znodes.
var (
DefaultACL = zk.WorldACL(zk.PermAll)
ErrInvalidCredentials = errors.New("invalid credentials provided")
ErrClientClosed ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/logwrapper.go | sd/zk/logwrapper.go | package zk
import (
"fmt"
"github.com/go-zookeeper/zk"
"github.com/go-kit/log"
)
// wrapLogger wraps a Go kit logger so we can use it as the logging service for
// the ZooKeeper library, which expects a Printf method to be available.
type wrapLogger struct {
log.Logger
}
func (logger wrapLogger) Printf(format ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/client_test.go | sd/zk/client_test.go | package zk
import (
"bytes"
"testing"
"time"
stdzk "github.com/go-zookeeper/zk"
"github.com/go-kit/log"
)
func TestNewClient(t *testing.T) {
var (
acl = stdzk.WorldACL(stdzk.PermRead)
connectTimeout = 3 * time.Second
sessionTimeout = 20 * time.Second
payload = [][]byte{[]byte("Payloa... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/instancer_test.go | sd/zk/instancer_test.go | package zk
import (
"testing"
"time"
"github.com/go-kit/kit/sd"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
func TestInstancer(t *testing.T) {
client := newFakeClient()
instancer, err := NewInstancer(client, path, logger)
if err != nil {
t.Fatalf("failed to create new Instancer: %v", err)
}
def... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/integration_test.go | sd/zk/integration_test.go | // +build integration
package zk
import (
"bytes"
"os"
"testing"
"time"
stdzk "github.com/go-zookeeper/zk"
)
var (
host []string
)
func TestMain(m *testing.M) {
zkAddr := os.Getenv("ZK_ADDR")
if zkAddr != "" {
host = []string{zkAddr}
}
m.Run()
}
func TestCreateParentNodesOnServer(t *testing.T) {
if l... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/registrar.go | sd/zk/registrar.go | package zk
import "github.com/go-kit/log"
// Registrar registers service instance liveness information to ZooKeeper.
type Registrar struct {
client Client
service Service
logger log.Logger
}
// Service holds the root path, service name and instance identifying data you
// want to publish to ZooKeeper.
type Serv... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/doc.go | sd/zk/doc.go | // Package zk provides Instancer and Registrar implementations for ZooKeeper.
package zk
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/zk/util_test.go | sd/zk/util_test.go | package zk
import (
"errors"
"fmt"
"io"
"sync"
"time"
"github.com/go-zookeeper/zk"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var (
path = "/gokit.test/service.name"
logger = log.NewNopLogger()
)
type fakeClient struct {
mtx sync.Mutex
ch chan ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/instancer.go | sd/etcdv3/instancer.go | package etcdv3
import (
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
// Instancer yields instances stored in a certain etcd keyspace. Any kind of
// change in that keyspace is watched and will update the Instancer's Instancers.
type Instancer struct {
cache *i... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/client.go | sd/etcdv3/client.go | package etcdv3
import (
"context"
"crypto/tls"
"errors"
"time"
"go.etcd.io/etcd/client/pkg/v3/transport"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
)
var (
// ErrNoKey indicates a client method needs a key but receives none.
ErrNoKey = errors.New("no key provided")
// ErrNoValue indicat... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/registrar_test.go | sd/etcdv3/registrar_test.go | package etcdv3
import (
"bytes"
"errors"
"testing"
"github.com/go-kit/log"
)
// testClient is a basic implementation of Client
type testClient struct {
registerRes error // value returned when Register or Deregister is called
}
func (tc *testClient) GetEntries(prefix string) ([]string, error) {
return nil, ni... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/client_test.go | sd/etcdv3/client_test.go | package etcdv3
import (
"context"
"testing"
"time"
"google.golang.org/grpc"
)
const (
// irrelevantEndpoint is an address which does not exists.
irrelevantEndpoint = "http://irrelevant:12345"
)
func TestNewClient(t *testing.T) {
client, err := NewClient(
context.Background(),
[]string{irrelevantEndpoint}... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/example_test.go | sd/etcdv3/example_test.go | package etcdv3
import (
"context"
"io"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/lb"
"github.com/go-kit/log"
"google.golang.org/grpc"
)
func Example() {
// Let's say this is a service that means to register itself.
// First, we will set up some context.
v... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/instancer_test.go | sd/etcdv3/instancer_test.go | package etcdv3
import (
"errors"
"testing"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
type testKV struct {
Key []byte
Value []byte
}
type testResponse struct {
Kvs []testKV
}
var (
fakeResponse = testResponse{
Kvs: []testKV{
{
Key: ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/integration_test.go | sd/etcdv3/integration_test.go | //go:build flaky_integration
// +build flaky_integration
package etcdv3
import (
"context"
"io"
"os"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
func runIntegration(settings integrationSettings, client Client, service Service, t *testing.T) {
// Ve... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/registrar.go | sd/etcdv3/registrar.go | package etcdv3
import (
"sync"
"time"
"github.com/go-kit/log"
)
const minHeartBeatTime = 500 * time.Millisecond
// Registrar registers service instance liveness information to etcd.
type Registrar struct {
client Client
service Service
logger log.Logger
quitmtx sync.Mutex
quit chan struct{}
}
// Serv... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcdv3/doc.go | sd/etcdv3/doc.go | // Package etcdv3 provides an Instancer and Registrar implementation for etcd v3. If
// you use etcd v3 as your service discovery system, this package will help you
// implement the registration and client-side load balancing patterns.
package etcdv3
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/internal/instance/cache.go | sd/internal/instance/cache.go | package instance
import (
"reflect"
"sort"
"sync"
"github.com/go-kit/kit/sd"
)
// Cache keeps track of resource instances provided to it via Update method
// and implements the Instancer interface
type Cache struct {
mtx sync.RWMutex
state sd.Event
reg registry
}
// NewCache creates a new Cache.
func New... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/internal/instance/cache_test.go | sd/internal/instance/cache_test.go | package instance
import (
"context"
"fmt"
"io"
"reflect"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var _ sd.Instancer = (*Cache)(nil) // API check
// The test verifies the following:
// registering causes initial notification of the current sta... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/random_test.go | sd/lb/random_test.go | package lb
import (
"context"
"math"
"testing"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
)
func TestRandom(t *testing.T) {
var (
n = 7
endpoints = make([]endpoint.Endpoint, n)
counts = make([]int, n)
seed = int64(12345)
iterations = 1000000
want = iterati... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/balancer.go | sd/lb/balancer.go | package lb
import (
"errors"
"github.com/go-kit/kit/endpoint"
)
// Balancer yields endpoints according to some heuristic.
type Balancer interface {
Endpoint() (endpoint.Endpoint, error)
}
// ErrNoEndpoints is returned when no qualifying endpoints are available.
var ErrNoEndpoints = errors.New("no endpoints avail... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/round_robin_test.go | sd/lb/round_robin_test.go | package lb
import (
"context"
"reflect"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
)
func TestRoundRobin(t *testing.T) {
var (
counts = []int{0, 0, 0}
endpoints = []endpoint.Endpoint{
func(context.Context, interface{}) (interface{}, error) { c... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/retry_test.go | sd/lb/retry_test.go | package lb_test
import (
"context"
"errors"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/lb"
)
func TestRetryMaxTotalFail(t *testing.T) {
var (
endpoints = sd.FixedEndpointer{} // no endpoints
rr = lb.NewRoundRobin(endpoints)
retry = ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/retry.go | sd/lb/retry.go | package lb
import (
"context"
"fmt"
"strings"
"time"
"github.com/go-kit/kit/endpoint"
)
// RetryError is an error wrapper that is used by the retry mechanism. All
// errors returned by the retry mechanism via its endpoint will be RetryErrors.
type RetryError struct {
RawErrors []error // all errors encountered... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/round_robin.go | sd/lb/round_robin.go | package lb
import (
"sync/atomic"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
)
// NewRoundRobin returns a load balancer that returns services in sequence.
func NewRoundRobin(s sd.Endpointer) Balancer {
return &roundRobin{
s: s,
c: 0,
}
}
type roundRobin struct {
s sd.Endpointer
c uint64
... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/doc.go | sd/lb/doc.go | // Package lb implements the client-side load balancer pattern. When combined
// with a service discovery system of record, it enables a more decentralized
// architecture, removing the need for separate load balancers like HAProxy.
package lb
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/lb/random.go | sd/lb/random.go | package lb
import (
"math/rand"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
)
// NewRandom returns a load balancer that selects services randomly.
func NewRandom(s sd.Endpointer, seed int64) Balancer {
return &random{
s: s,
r: rand.New(rand.NewSource(seed)),
}
}
type random struct {
s sd.E... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/instancer.go | sd/etcd/instancer.go | package etcd
import (
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/internal/instance"
"github.com/go-kit/log"
)
// Instancer yields instances stored in a certain etcd keyspace. Any kind of
// change in that keyspace is watched and will update the Instancer's Instancers.
type Instancer struct {
cache *ins... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/client.go | sd/etcd/client.go | package etcd
import (
"context"
"crypto/tls"
"crypto/x509"
"errors"
"io/ioutil"
"net"
"net/http"
"time"
etcd "go.etcd.io/etcd/client/v2"
)
var (
// ErrNoKey indicates a client method needs a key but receives none.
ErrNoKey = errors.New("no key provided")
// ErrNoValue indicates a client method needs a v... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/registrar_test.go | sd/etcd/registrar_test.go | package etcd
import (
"bytes"
"errors"
"testing"
"github.com/go-kit/log"
)
// testClient is a basic implementation of Client
type testClient struct {
registerRes error // value returned when Register or Deregister is called
}
func (tc *testClient) GetEntries(prefix string) ([]string, error) {
return nil, nil
... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/client_test.go | sd/etcd/client_test.go | package etcd
import (
"context"
"errors"
"reflect"
"testing"
"time"
etcd "go.etcd.io/etcd/client/v2"
)
func TestNewClient(t *testing.T) {
client, err := NewClient(
context.Background(),
[]string{"http://irrelevant:12345"},
ClientOptions{
DialTimeout: 2 * time.Second,
DialKeepAlive: ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/example_test.go | sd/etcd/example_test.go | package etcd
import (
"context"
"io"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/lb"
"github.com/go-kit/log"
)
func Example() {
// Let's say this is a service that means to register itself.
// First, we will set up some context.
var (
etcdServer = "http://... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/instancer_test.go | sd/etcd/instancer_test.go | package etcd
import (
"errors"
"testing"
stdetcd "go.etcd.io/etcd/client/v2"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
var _ sd.Instancer = (*Instancer)(nil) // API check
var (
node = &stdetcd.Node{
Key: "/foo",
Nodes: []*stdetcd.Node{
{Key: "/foo/1", Value: "1:1"},
{Key: "/foo/2", Value... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/integration_test.go | sd/etcd/integration_test.go | //go:build flaky_integration
// +build flaky_integration
package etcd
import (
"context"
"io"
"os"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/log"
)
// Package sd/etcd provides a wrapper around the etcd key/value store. This
// example assumes the user ha... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/registrar.go | sd/etcd/registrar.go | package etcd
import (
"sync"
"time"
etcd "go.etcd.io/etcd/client/v2"
"github.com/go-kit/log"
)
const minHeartBeatTime = 500 * time.Millisecond
// Registrar registers service instance liveness information to etcd.
type Registrar struct {
client Client
service Service
logger log.Logger
quitmtx sync.Mutex
... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/sd/etcd/doc.go | sd/etcd/doc.go | // Package etcd provides an Instancer and Registrar implementation for etcd. If
// you use etcd as your service discovery system, this package will help you
// implement the registration and client-side load balancing patterns.
package etcd
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/doc.go | tracing/doc.go | // Package tracing provides helpers and bindings for distributed tracing.
//
// As your infrastructure grows, it becomes important to be able to trace a
// request, as it travels through multiple services and back to the user.
// Package tracing provides endpoints and transport helpers and middlewares to
// capture and... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/endpoint_options.go | tracing/opencensus/endpoint_options.go | package opencensus
import (
"context"
"go.opencensus.io/trace"
)
// EndpointOptions holds the options for tracing an endpoint
type EndpointOptions struct {
// IgnoreBusinessError if set to true will not treat a business error
// identified through the endpoint.Failer interface as a span error.
IgnoreBusinessErr... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/grpc_test.go | tracing/opencensus/grpc_test.go | package opencensus_test
import (
"context"
"errors"
"testing"
"go.opencensus.io/trace"
"go.opencensus.io/trace/propagation"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"github.com/go-kit/kit/endpoint"
ockit "github.com/go-kit/kit/tracing/opencensus"
grpctransp... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/grpc.go | tracing/opencensus/grpc.go | package opencensus
import (
"context"
"go.opencensus.io/trace"
"go.opencensus.io/trace/propagation"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
kitgrpc "github.com/go-kit/kit/transport/grpc"
)
const propagationKey = "grpc-trace-bin"
// GRPCClientTrace ena... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/jsonrpc_test.go | tracing/opencensus/jsonrpc_test.go | package opencensus_test
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/b3"
"go.opencensus.io/plugin/ochttp/propagation/tracecontext"
"go.opencensus.io/trace"
"go.ope... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/endpoint_test.go | tracing/opencensus/endpoint_test.go | package opencensus_test
import (
"context"
"errors"
"testing"
"time"
"go.opencensus.io/trace"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd"
"github.com/go-kit/kit/sd/lb"
"github.com/go-kit/kit/tracing/opencensus"
)
const (
span1 = ""
span2 = "SPAN-2"
span3 = "SPAN-3"
span4 = "SPAN-4"
spa... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/opencensus_test.go | tracing/opencensus/opencensus_test.go | package opencensus_test
import (
"sync"
"go.opencensus.io/trace"
)
type recordingExporter struct {
mu sync.Mutex
data []*trace.SpanData
}
func (e *recordingExporter) ExportSpan(d *trace.SpanData) {
e.mu.Lock()
defer e.mu.Unlock()
e.data = append(e.data, d)
}
func (e *recordingExporter) Flush() (data []*t... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/http_test.go | tracing/opencensus/http_test.go | package opencensus_test
import (
"context"
"errors"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/b3"
"go.opencensus.io/plugin/ochttp/propagation/tracecontext"
"go.opencensus.io/trace"
"go.opencensus.io/trace/propagation"
"... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/http.go | tracing/opencensus/http.go | package opencensus
import (
"context"
"net/http"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/b3"
"go.opencensus.io/trace"
kithttp "github.com/go-kit/kit/transport/http"
)
// HTTPClientTrace enables OpenCensus tracing of a Go kit HTTP transport client.
func HTTPClientTrace(opti... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/endpoint.go | tracing/opencensus/endpoint.go | package opencensus
import (
"context"
"strconv"
"go.opencensus.io/trace"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd/lb"
)
// TraceEndpointDefaultName is the default endpoint span name to use.
const TraceEndpointDefaultName = "gokit/endpoint"
// TraceEndpoint returns an Endpoint middleware, tra... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/doc.go | tracing/opencensus/doc.go | // Package opencensus provides Go kit integration to the OpenCensus project.
// OpenCensus is a single distribution of libraries for metrics and distributed
// tracing with minimal overhead that allows you to export data to multiple
// backends. The Go kit OpenCencus package as provided here contains middlewares
// for... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/tracer_options.go | tracing/opencensus/tracer_options.go | package opencensus
import (
"go.opencensus.io/plugin/ochttp/propagation/b3"
"go.opencensus.io/trace"
"go.opencensus.io/trace/propagation"
)
// defaultHTTPPropagate holds OpenCensus' default HTTP propagation format which
// currently is Zipkin's B3.
var defaultHTTPPropagate propagation.HTTPFormat = &b3.HTTPFormat{}... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opencensus/jsonrpc.go | tracing/opencensus/jsonrpc.go | package opencensus
import (
"context"
"net/http"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/b3"
"go.opencensus.io/trace"
kithttp "github.com/go-kit/kit/transport/http"
jsonrpc "github.com/go-kit/kit/transport/http/jsonrpc"
)
// JSONRPCClientTrace enables OpenCensus tracing o... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/endpoint_options.go | tracing/opentracing/endpoint_options.go | package opentracing
import (
"context"
"github.com/opentracing/opentracing-go"
)
// EndpointOptions holds the options for tracing an endpoint
type EndpointOptions struct {
// IgnoreBusinessError if set to true will not treat a business error
// identified through the endpoint.Failer interface as a span error.
I... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/grpc_test.go | tracing/opentracing/grpc_test.go | package opentracing_test
import (
"context"
"testing"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/mocktracer"
"google.golang.org/grpc/metadata"
kitot "github.com/go-kit/kit/tracing/opentracing"
"github.com/go-kit/log"
)
func TestTraceGRPCRequestRoundtrip(t *testing.T) {
lo... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/grpc.go | tracing/opentracing/grpc.go | package opentracing
import (
"context"
"encoding/base64"
"strings"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"google.golang.org/grpc/metadata"
"github.com/go-kit/log"
)
// ContextToGRPC returns a grpc RequestFunc that injects an OpenTracing Span
// found in `ctx` int... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/endpoint_test.go | tracing/opentracing/endpoint_test.go | package opentracing_test
import (
"context"
"errors"
"fmt"
"reflect"
"testing"
"time"
"github.com/opentracing/opentracing-go"
otext "github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/opentracing/opentracing-go/mocktracer"
"github.com/go-kit/kit/endpoi... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/http_test.go | tracing/opentracing/http_test.go | package opentracing_test
import (
"context"
"net/http"
"reflect"
"testing"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/mocktracer"
kitot "github.com/go-kit/kit/tracing/opentracing"
"github.com/go-kit/log"
)
func Test... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/http.go | tracing/opentracing/http.go | package opentracing
import (
"context"
"net"
"net/http"
"strconv"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
kithttp "github.com/go-kit/kit/transport/http"
"github.com/go-kit/log"
)
// ContextToHTTP returns an http RequestFunc that injects an OpenTracing ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/endpoint.go | tracing/opentracing/endpoint.go | package opentracing
import (
"context"
"strconv"
"github.com/opentracing/opentracing-go"
otext "github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/sd/lb"
)
// TraceEndpoint returns a Middleware that wraps the `n... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/opentracing/doc.go | tracing/opentracing/doc.go | // Package opentracing provides Go kit integration to the OpenTracing project.
// OpenTracing implements a general purpose interface that microservices can
// program against, and which adapts to all major distributed tracing systems.
package opentracing
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/grpc_test.go | tracing/zipkin/grpc_test.go | package zipkin_test
import (
"context"
"testing"
zipkin "github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/propagation/b3"
"github.com/openzipkin/zipkin-go/reporter/recorder"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.com/go-kit/kit/endpoint"
kitzipkin "github.com/go-... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/grpc.go | tracing/zipkin/grpc.go | package zipkin
import (
"context"
"strconv"
zipkin "github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/model"
"github.com/openzipkin/zipkin-go/propagation/b3"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
kitgrpc "github.com/go-kit/kit/transport/grpc"
"github.com/go-kit/lo... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/endpoint_test.go | tracing/zipkin/endpoint_test.go | package zipkin_test
import (
"context"
"testing"
"github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/reporter/recorder"
"github.com/go-kit/kit/endpoint"
zipkinkit "github.com/go-kit/kit/tracing/zipkin"
)
const spanName = "test"
func TestTraceEndpoint(t *testing.T) {
rec := recorder.NewReporte... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/http_test.go | tracing/zipkin/http_test.go | package zipkin_test
import (
"context"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"reflect"
"testing"
zipkin "github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/model"
"github.com/openzipkin/zipkin-go/propagation/b3"
"github.com/openzipkin/zipkin-go/reporter/recorder"
"github... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/http.go | tracing/zipkin/http.go | package zipkin
import (
"context"
"net/http"
"strconv"
zipkin "github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/model"
"github.com/openzipkin/zipkin-go/propagation/b3"
kithttp "github.com/go-kit/kit/transport/http"
"github.com/go-kit/log"
)
// HTTPClientTrace enables native Zipkin tracing o... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/options.go | tracing/zipkin/options.go | package zipkin
import (
"net/http"
"github.com/go-kit/log"
)
// TracerOption allows for functional options to our Zipkin tracing middleware.
type TracerOption func(o *tracerOptions)
// Name sets the name for an instrumented transport endpoint. If name is omitted
// at tracing middleware creation, the method of th... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/endpoint.go | tracing/zipkin/endpoint.go | package zipkin
import (
"context"
"github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go/model"
"github.com/go-kit/kit/endpoint"
)
// TraceEndpoint returns an Endpoint middleware, tracing a Go kit endpoint.
// This endpoint tracer should be used in combination with a Go kit Transport
// tracing midd... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/tracing/zipkin/doc.go | tracing/zipkin/doc.go | // Package zipkin provides Go kit integration to the OpenZipkin project through
// the use of zipkin-go, the official OpenZipkin tracer implementation for Go.
// OpenZipkin is the most used open source distributed tracing ecosystem with
// many different libraries and interoperability options.
package zipkin
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/metrics.go | metrics/metrics.go | package metrics
// Counter describes a metric that accumulates values monotonically.
// An example of a counter is the number of received HTTP requests.
type Counter interface {
With(labelValues ...string) Counter
Add(delta float64)
}
// Gauge describes a metric that takes specific values over time.
// An example o... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/timer.go | metrics/timer.go | package metrics
import "time"
// Timer acts as a stopwatch, sending observations to a wrapped histogram.
// It's a bit of helpful syntax sugar for h.Observe(time.Since(x)).
type Timer struct {
h Histogram
t time.Time
u time.Duration
}
// NewTimer wraps the given histogram and records the current time.
func NewTim... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/timer_test.go | metrics/timer_test.go | package metrics_test
import (
"math"
"testing"
"time"
"github.com/go-kit/kit/metrics"
"github.com/go-kit/kit/metrics/generic"
)
func TestTimerFast(t *testing.T) {
h := generic.NewSimpleHistogram()
metrics.NewTimer(h).ObserveDuration()
tolerance := 0.050
if want, have := 0.000, h.ApproximateMovingAverage()... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/doc.go | metrics/doc.go | // Package metrics provides a framework for application instrumentation. It's
// primarily designed to help you get started with good and robust
// instrumentation, and to help you migrate from a less-capable system like
// Graphite to a more-capable system like Prometheus. If your organization has
// already standardi... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/cloudwatch2/cloudwatch2_test.go | metrics/cloudwatch2/cloudwatch2_test.go | package cloudwatch2
import (
"context"
"strings"
"testing"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch/types"
)
func TestStats(t *testing.T) {
testCases := []struct {
name string
vals []float64
xMin float64
xMax float64
xSum float64
xCt float6... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/cloudwatch2/cloudwatch2.go | metrics/cloudwatch2/cloudwatch2.go | // Package cloudwatch2 emits all data as a StatisticsSet (rather than
// a singular Value) to CloudWatch via the aws-sdk-go-v2 SDK.
package cloudwatch2
import (
"context"
"math"
"sync"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
"github.com/aws/aws-sdk-go-v2/serv... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/metrics/influx/influx.go | metrics/influx/influx.go | // Package influx provides an InfluxDB implementation for metrics. The model is
// similar to other push-based instrumentation systems. Observations are
// aggregated locally and emitted to the Influx server on regular intervals.
package influx
import (
"context"
"time"
influxdb "github.com/influxdata/influxdb1-cl... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.