Skip to content

Commit

Permalink
Merge branch 'main' into fix-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mahadzaryab1 authored Nov 11, 2024
2 parents 8c53039 + 851a1f8 commit 6e15089
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Alauda
* Official site: [en](https://www.alauda.io/), [cn](https://www.alauda.cn/)
* [Base CRM](https://getbase.com/)
* [Circonus](https://www.circonus.com/)
* [ContaAzul](https://contaazul.com/)
Expand Down
1 change: 1 addition & 0 deletions cmd/agent/app/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func TestCreateCollectorProxy(t *testing.T) {

for _, test := range tests {
t.Run("", func(t *testing.T) {
t.Parallel()
flags := &flag.FlagSet{}
grpc.AddFlags(flags)
reporter.AddFlags(flags)
Expand Down
6 changes: 4 additions & 2 deletions cmd/agent/app/reporter/grpc/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,12 @@ func TestProxyClientTLS(t *testing.T) {
expectError: false,
},
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var opts []grpc.ServerOption
if test.serverTLS.Enabled {
tlsCfg, err := test.serverTLS.Config(zap.NewNop())
Expand Down
12 changes: 11 additions & 1 deletion pkg/jtracer/jtracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package jtracer

import (
"context"
"os"
"strings"
"sync"

"go.opentelemetry.io/otel"
Expand Down Expand Up @@ -109,9 +111,17 @@ func otelResource(ctx context.Context, svc string) (*resource.Resource, error) {
)
}

func defaultGRPCOptions() []otlptracegrpc.Option {
var options []otlptracegrpc.Option
if !(strings.HasPrefix(os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT"), "https://") || strings.ToLower(os.Getenv("OTEL_EXPORTER_OTLP_INSECURE")) == "false") {
options = append(options, otlptracegrpc.WithInsecure())
}
return options
}

func otelExporter(ctx context.Context) (sdktrace.SpanExporter, error) {
client := otlptracegrpc.NewClient(
otlptracegrpc.WithInsecure(),
defaultGRPCOptions()...,
)
return otlptrace.New(ctx, client)
}
Expand Down

0 comments on commit 6e15089

Please sign in to comment.