- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"module name","license","repository" | |
"[email protected]","MIT","https://github.com/chalk/ansi-regex" | |
"[email protected]","MIT","https://github.com/chalk/ansi-styles" | |
"[email protected]","MIT","https://github.com/chalk/ansi-styles" | |
"[email protected]","MIT","https://github.com/ryanhefner/Array.prototype.findIndex" | |
"[email protected]","MIT","https://github.com/kriskowal/asap" | |
"[email protected]","MIT","https://github.com/benjamn/ast-types" | |
"[email protected]","MIT","https://github.com/benjamn/ast-types" | |
"[email protected]","MIT","https://github.com/babel/babel/tree/master/packages/babel-code-frame" | |
"[email protected]","MIT","https://github.com/babel/babylon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jaeger | |
// go test -bench=. | |
// BenchmarkByValue-8 2000000000 0.56 ns/op | |
// BenchmarkByPointer-8 2000000000 0.28 ns/op | |
import "testing" | |
func BenchmarkByValue(b *testing.B) { | |
b1 := b1{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Jaeger test | |
Cf. https://github.com/gogo/protobuf/blob/master/extensions.md | |
Based on https://github.com/gogo/grpc-example | |
The JSON is generated with the help of "github.com/cockroachdb/cockroach/pkg/util/protoutil" | |
with `EmitDefaults: false` setting | |
jsonpb := &protoutil.JSONPb{ | |
EmitDefaults: false, | |
Indent: " ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type traceLogger { | |
span opentracing.Span | |
zl *zap.Logger | |
l *Logger | |
} | |
func (l *Logger) Trace(ctx context.Context) (*zap.Logger, context.Context) { | |
span := opentracing.SpanFromContext(ctx) | |
if span == nil { | |
return l.NoTrace(), ctx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cassandra | |
import ( | |
"errors" | |
"sync" | |
"sync/atomic" | |
"github.com/jaegertracing/jaeger/pkg/cassandra" | |
"go.uber.org/zap" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from opentelemetry import trace | |
from opentelemetry.sdk.trace import TracerProvider | |
from opentelemetry.sdk.trace.export import BatchSpanProcessor | |
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter | |
trace.set_tracer_provider(TracerProvider()) | |
trace.get_tracer_provider().add_span_processor( | |
BatchSpanProcessor(OTLPSpanExporter()) | |
) | |
tracer = trace.get_tracer(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Init initializes OpenTelemetry SDK and uses OTel-OpenTracing Bridge | |
// to return an OpenTracing-compatible tracer. | |
func Init( | |
serviceName string, | |
exporterType string, | |
metricsFactory metrics.Factory, | |
logger log.Factory | |
) opentracing.Tracer { | |
exp, err := createOtelExporter(exporterType) | |
if err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createOtelExporter(exporterType string) (sdktrace.SpanExporter, error) { | |
var exporter sdktrace.SpanExporter | |
var err error | |
switch exporterType { | |
case "jaeger": | |
exporter, err = jaeger.New( | |
jaeger.WithCollectorEndpoint(), | |
) | |
case "otlp": | |
client := otlptracehttp.NewClient( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var once sync.Once | |
// Init initializes OpenTelemetry SDK and uses OTel-OpenTracing Bridge | |
// to return an OpenTracing-compatible tracer. | |
func Init(serviceName string, exporterType string, ...) opentracing.Tracer { | |
once.Do(func() { | |
propagation.NewCompositeTextMapPropagator( | |
propagation.TraceContext{}, | |
propagation.Baggage{}, | |
)) |
OlderNewer