Skip to content

Commit

Permalink
feat(scheduler): Disable gRPC logs when creating OTLP exporter (#151)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT authored Oct 12, 2022
1 parent 0be89a5 commit d0f69b9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scheduler/cmd/scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ package main
import (
"context"
"fmt"
"log"
"net"
"os"
"time"

"github.com/kelseyhightower/envconfig"
"go.opentelemetry.io/otel/exporters/otlp"
"go.opentelemetry.io/otel/exporters/otlp/otlpgrpc"
"google.golang.org/grpc"
"k8s.io/klog/v2"
"log"
"os"
"time"

"github.com/keptn-sandbox/lifecycle-controller/scheduler/pkg/klcpermit"
"k8s.io/apimachinery/pkg/util/rand"
Expand Down Expand Up @@ -122,9 +124,14 @@ func newStdOutExporter() (sdktrace.SpanExporter, error) {
}

func newOTelExporter(env envConfig) (sdktrace.SpanExporter, error) {
ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second)
ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second)
defer cancel()

_, err := net.DialTimeout("tcp", env.OTelCollectorURL, 2*time.Second)
if err != nil {
return nil, err
}

driver := otlpgrpc.NewDriver(
otlpgrpc.WithInsecure(),
otlpgrpc.WithEndpoint(env.OTelCollectorURL),
Expand Down

0 comments on commit d0f69b9

Please sign in to comment.