Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Integrate Elasticsearch with Atatus Go Agent to monitor search queries in Go apps. Track spans and performance for improved observability.
go get go.atatus.com/agent go get go.atatus.com/agent/module/atelasticsearch
import ( "github.com/olivere/elastic" "go.atatus.com/agent" "go.atatus.com/agent/module/atelasticsearch" ) var client, _ = elastic.NewClient(elastic.SetHttpClient(&http.Client{ Transport: atelasticsearch.WrapRoundTripper(http.DefaultTransport), })) func main() { tracer := atatus.DefaultTracer tracer.Service.LicenseKey = os.Getenv("ATATUS_LICENSE_KEY") tracer.Service.AppName = os.Getenv("ATATUS_APP_NAME") tracer.Service.Tracing = os.Getenv("ATATUS_TRACING") tracer.Service.Analytics = os.Getenv("ATATUS_ANALYTICS") } func handleRequest(w http.ResponseWriter, req *http.Request) { // req.Context() should be propagated to downstream operations such as database queries , http external API calls. result, err := client.Search("index").Query(elastic.NewMatchAllQuery()).Do(req.Context()) ... }
go mod tidy
go run main.go