Trace back everything (tested)
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
package drivers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/meilisearch/meilisearch-go"
|
||||
"github.com/spf13/viper"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
|
||||
func MeiliSearch(dsn MeiliDSN) meilisearch.ServiceManager {
|
||||
otelTransport := otelhttp.NewTransport(http.DefaultTransport)
|
||||
serviceName := viper.GetString("search.service_name")
|
||||
|
||||
otelTransport := otelhttp.NewTransport(
|
||||
http.DefaultTransport,
|
||||
otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string {
|
||||
return fmt.Sprintf("%s %s", serviceName, r.Method)
|
||||
}),
|
||||
)
|
||||
|
||||
httpClient := &http.Client{
|
||||
Transport: otelTransport,
|
||||
|
||||
Reference in New Issue
Block a user