Skip to content

megaease/easeagent-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easeagent-sdk-go

A lightweight & opening Go SDK for Cloud-Native and APM system

Overview

  • EaseAgent SDK can collect distributed application tracing, which could be used in the APM system and improve the observability of a distributed system. for the tracing, EaseAgent SDK follows the Google Dapper paper and use zipkin-go core library.
  • EaseAgent SDK also can work with Cloud-Native architecture. For example, it can help Service Mesh (especially for EaseMesh ) to do some control panel work.
  • EaseAgent SDK also can work with MegaEase Cloud. For example, it can monitor for service by Go Docker APP.

Principles

  • Safe to Go application/service.
  • Lightweight and very low CPU, memory, and I/O resource usage.
  • Highly extensible, users can easily do extensions through the api
  • Design for Micro-Service architecture, collecting the data from a service perspective.

Features

  • Easy to use. It is right out of the box for HTTP Server Tracing.

    • Collecting Tracing Logs.
      • HTTP Server
      • HTTP Client
      • Supplying the health check endpoint
    • Decorate the Span API for Middleware
  • Data Reports

    • Console Reporter.
    • HTTP Reporter.
  • Standardization

    • The tracing data format is fully compatible with the Zipkin data format.

QuickStart

Init Agent

1. Get SDK

go get github.com/megaease/easeagent-sdk-go

2. Import package

import (
    "github.com/megaease/easeagent-sdk-go/agent"
    "github.com/megaease/easeagent-sdk-go/plugins/zipkin"
)

3. New Agent

// new tracing agent from yaml file and sets host and port of Span.localEndpoint
// By default, use yamlFile="" is use easemesh.DefaultSpec() and Console Reporter for tracing.
// By default, use localHostPort="" is not set host and port of Span.localEndpoint.
var easeagent, _ = agent.NewWithOptions(agent.WithYAML(os.Getenv("EASEAGENT_CONFIG"), ":8090"))

Wrapping HTTP Server

func main() {
	// initialize router
	router := http.NewServeMux()
	http.ListenAndServe(":8090", easeagent.WrapUserHandler(router))
}

Documentation

About Config

Example

  1. HTTP example

  2. mesh example

About MegaEase Cloud

  1. Use SDK in MegaEase Cloud
  2. Get MegaEase Cloud Config. About MegaEase Cloud Config
  3. Decorate the Span. please use api: zipkin.Tracing.StartMWSpan and zipkin.Tracing.StartMWSpanFromCtx for decorate Span.

Community

If you have any questions, welcome to discuss them in our community. Welcome to join!

Licenses

EaseAgent Go SDK is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

About

EaseAgent SDK for the Go programming language.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages