All Projects → SkyAPM → Go2sky

SkyAPM / Go2sky

Licence: apache-2.0
Distributed tracing and monitor SDK in Go for Apache SkyWalking APM

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Go2sky

gateway
A proxy to buffer and forward metrics, events, and traces.
Stars: ✭ 94 (-59.83%)
Mutual labels:  metrics, tracing, observability, distributed-tracing
uptrace
Open source APM: OpenTelemetry traces, metrics, and logs
Stars: ✭ 1,187 (+407.26%)
Mutual labels:  tracing, observability, distributed-tracing
Opencensus Node
A stats collection and distributed tracing framework
Stars: ✭ 249 (+6.41%)
Mutual labels:  metrics, tracing, distributed-tracing
Opencensus Web
A stats collection and distributed tracing framework
Stars: ✭ 168 (-28.21%)
Mutual labels:  metrics, tracing, distributed-tracing
Zipkin
Zipkin is a distributed tracing system
Stars: ✭ 14,969 (+6297.01%)
Mutual labels:  tracing, distributed-tracing, observability
Opstrace
Secure observability, deployed in your own network. An open source alternative to SaaS solutions like Datadog, SignalFx, ...
Stars: ✭ 743 (+217.52%)
Mutual labels:  metrics, tracing, observability
easeagent
An agent component for the Java system
Stars: ✭ 437 (+86.75%)
Mutual labels:  tracing, observability, distributed-tracing
Haystack
Top level repository for Haystack, containing documentation and deployment scripts
Stars: ✭ 261 (+11.54%)
Mutual labels:  metrics, tracing, distributed-tracing
Opencensus Java
A stats collection and distributed tracing framework
Stars: ✭ 640 (+173.5%)
Mutual labels:  metrics, tracing, distributed-tracing
Skywalking
APM, Application Performance Monitoring System
Stars: ✭ 18,341 (+7738.03%)
Mutual labels:  metrics, distributed-tracing, observability
Kamon
Distributed Tracing, Metrics and Context Propagation for application running on the JVM
Stars: ✭ 1,280 (+447.01%)
Mutual labels:  metrics, tracing, distributed-tracing
Hubble
Hubble - Network, Service & Security Observability for Kubernetes using eBPF
Stars: ✭ 1,245 (+432.05%)
Mutual labels:  metrics, tracing, observability
Opencensus Csharp
Distributed tracing and stats collecting framework
Stars: ✭ 126 (-46.15%)
Mutual labels:  metrics, tracing, distributed-tracing
Applicationinsights Java
Application Insights for Java
Stars: ✭ 172 (-26.5%)
Mutual labels:  distributed-tracing, observability
Kspan
Turning Kubernetes Events into spans
Stars: ✭ 187 (-20.09%)
Mutual labels:  distributed-tracing, observability
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+874.79%)
Mutual labels:  metrics, observability
Brave
Java distributed tracing implementation compatible with Zipkin backend services.
Stars: ✭ 2,117 (+804.7%)
Mutual labels:  tracing, distributed-tracing
Spf4j
Simple performance framework for java
Stars: ✭ 184 (-21.37%)
Mutual labels:  metrics, tracing
Graphite exporter
Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Stars: ✭ 217 (-7.26%)
Mutual labels:  metrics, observability
Anode
Utility for analyzing graphite metrics. Experimental package.
Stars: ✭ 188 (-19.66%)
Mutual labels:  metrics, observability

GO2Sky

Build Coverage GoDoc

GO2Sky is an instrument SDK library, written in Go, by following Apache SkyWalking tracing and metrics formats.

Installation

$ go get -u github.com/SkyAPM/go2sky

The API of this project is still evolving. The use of vendoring tool is recommended.

Quickstart

By completing this quickstart, you will learn how to trace local methods. For more details, please view the example.

Configuration

GO2Sky can export traces to Apache SkyWalking OAP server or local logger. In the following example, we configure GO2Sky to export to OAP server, which is listening on oap-skywalking port 11800, and all the spans from this program will be associated with a service name example. reporter.GRPCReporter can also adjust the behavior through reporter.GRPCReporterOption, view all.

r, err := reporter.NewGRPCReporter("oap-skywalking:11800")
if err != nil {
    log.Fatalf("new reporter error %v \n", err)
}
defer r.Close()
tracer, err := go2sky.NewTracer("example", go2sky.WithReporter(r))
// create with sampler
// tracer, err := go2sky.NewTracer("example", go2sky.WithReporter(r), go2sky.WithSampler(0.5))

You can also create tracer with sampling rate.

....
tracer, err := go2sky.NewTracer("example", go2sky.WithReporter(r), go2sky.WithSampler(0.5))

Also could customize correlation context config.

tracer, err := go2sky.NewTracer("example", go2sky.WithReporter(r), go2sky.WithSampler(0.5), go2sky.WithCorrelation(3, 128))

Create span

To create a span in a trace, we used the Tracer to start a new span. We indicate this as the root span because of passing context.Background(). We must also be sure to end this span, which will be show in End span.

span, ctx, err := tracer.CreateLocalSpan(context.Background())

Get Global TraceID

Get the TraceID of the activeSpan in the Context.

go2sky.TraceID(ctx)

Create a sub span

A sub span created as the children of root span links to its parent with Context.

subSpan, newCtx, err := tracer.CreateLocalSpan(ctx)

Get correlation

Get custom data from tracing context.

value := go2sky.GetCorrelation(ctx, key)

Put correlation

Put custom data to tracing context.

success := go2sky.PutCorrelation(ctx, key, value)

End span

We must end the spans so they becomes available for sending to the backend by a reporter.

subSpan.End()
span.End()

Advanced Concepts

We cover some advanced topics about GO2Sky.

Context propagation

Trace links spans belong to it by using context propagation which varies between different scenario.

In process

We use context package to link spans. The root span usually pick context.Background(), and sub spans will inject the context generated by its parent.

//Create a new context
entrySpan, entryCtx, err := tracer.CreateEntrySpan(context.Background(), ...)

// Some operation
...

// Link two spans by injecting entrySpan context into exitSpan
exitSpan, err := tracer.CreateExitSpan(entryCtx, ...)

Crossing process

We use Entry span to extract context from downstream service, and use Exit span to inject context to upstream service.

Entry and Exit spans make sense to OAP analysis which generates topology map and service metrics.

//Extract context from HTTP request header `sw8`
span, ctx, err := tracer.CreateEntrySpan(r.Context(), "/api/login", func(key string) (string, error) {
		return r.Header.Get(key), nil
})

// Some operation
...

// Inject context into HTTP request header `sw8`
span, err := tracer.CreateExitSpan(req.Context(), "/service/validate", "tomcat-service:8080", func(key, value string) error {
		req.Header.Set(key, value)
		return nil
})

Tag

We set tags into a span which is stored in the backend, but some tags have special purpose. OAP server may use them to aggregate metrics, generate topology map and etc.

They are defined as constant in root package with prefix Tag.

Plugins

Go to go2sky-plugins repo to see all the plugins, click here.

License

Apache License 2.0. See LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].