MCPcopy
hub / github.com/elastic/go-elasticsearch / main

Function main

_examples/customization.go:74–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74func main() {
75 var wg sync.WaitGroup
76
77 // Create the custom transport.
78 //
79 tp := CountingTransport{}
80
81 // Pass the custom transport to the client.
82 //
83 es, _ := elasticsearch.New(
84 elasticsearch.WithTransportOptions(elastictransport.WithTransport(&tp)),
85 )
86
87 for i := 0; i < 25; i++ {
88 wg.Add(1)
89 go func() {
90 defer wg.Done()
91 es.Info()
92 }()
93 }
94 wg.Wait()
95
96 fmt.Println(strings.Repeat("=", 80))
97 fmt.Printf("%80s\n", fmt.Sprintf("Total Requests: %d", atomic.LoadUint64(&tp.count)))
98}

Callers

nothing calls this directly

Calls 3

PrintfMethod · 0.80
AddMethod · 0.65
InfoMethod · 0.45

Tested by

no test coverage detected