Update Go dependencies (#2878)

* Update Go dependencies
* Pin all github workflows dependencies

---------

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-11-21 16:15:49 +05:30
committed by GitHub
parent b85ba9e419
commit efeb6951dc
9 changed files with 150 additions and 154 deletions
+7
View File
@@ -5,6 +5,7 @@ import (
"os"
"strconv"
"strings"
"time"
"go.opentelemetry.io/contrib/propagators/autoprop"
"go.opentelemetry.io/otel"
@@ -96,6 +97,12 @@ func InitProvider(ctx context.Context, logger *zap.Logger, serviceName string) (
otel.SetTextMapPropagator(autoprop.NewTextMapPropagator())
// Shutdown will flush any remaining spans and shut down the exporter.
return func(ctx context.Context) {
if ctx.Err() != nil {
// if the context is already cancelled, create a new one with a timeout of 30 seconds
ctxwithTimeout, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
ctx = ctxwithTimeout
}
err := tracerProvider.Shutdown(ctx)
if err != nil && logger != nil {
logger.Error("error shutting down trace provider", zap.Error(err))