Skip to content

Commit bf37c5a

Browse files
authored
Revert the usage of go.opentelemetry.io/proto/slim (#5253)
* Revert "otlpmetrichttp: Use go.opentelemetry.io/proto/slim/otlp (#5222)" This reverts commit 6e92163. * Revert "otlploghttp: Use go.opentelemetry.io/proto/slim/otlp (#5216)" This reverts commit fe3de70. * Remove slim dep * Fix CI
1 parent b34cfc4 commit bf37c5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2970
-300
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2929

3030
- Update `go.opentelemetry.io/proto/otlp` from v1.1.0 to v1.2.0. (#5177)
3131
- Improve performance of baggage member character validation in `go.opentelemetry.io/otel/baggage`. (#5214)
32-
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` no longer depends on `google.golang.org/grpc`. (#5222)
3332

3433
## [1.25.0/0.47.0/0.0.8/0.1.0-alpha] 2024-04-05
3534

exporters/otlp/otlplog/otlploghttp/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"google.golang.org/protobuf/proto"
2121

2222
"go.opentelemetry.io/otel"
23-
collogpb "go.opentelemetry.io/proto/slim/otlp/collector/logs/v1"
24-
logpb "go.opentelemetry.io/proto/slim/otlp/logs/v1"
23+
collogpb "go.opentelemetry.io/proto/otlp/collector/logs/v1"
24+
logpb "go.opentelemetry.io/proto/otlp/logs/v1"
2525

2626
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp/internal/retry"
2727
)

exporters/otlp/otlplog/otlploghttp/client_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ import (
3232
"google.golang.org/protobuf/proto"
3333

3434
"go.opentelemetry.io/otel"
35-
collogpb "go.opentelemetry.io/proto/slim/otlp/collector/logs/v1"
36-
cpb "go.opentelemetry.io/proto/slim/otlp/common/v1"
37-
lpb "go.opentelemetry.io/proto/slim/otlp/logs/v1"
38-
rpb "go.opentelemetry.io/proto/slim/otlp/resource/v1"
35+
collogpb "go.opentelemetry.io/proto/otlp/collector/logs/v1"
36+
cpb "go.opentelemetry.io/proto/otlp/common/v1"
37+
lpb "go.opentelemetry.io/proto/otlp/logs/v1"
38+
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
3939

4040
"go.opentelemetry.io/otel/sdk/log"
4141
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"

exporters/otlp/otlplog/otlploghttp/exporter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/stretchr/testify/require"
1616

1717
"go.opentelemetry.io/otel/sdk/log"
18-
logpb "go.opentelemetry.io/proto/slim/otlp/logs/v1"
18+
logpb "go.opentelemetry.io/proto/otlp/logs/v1"
1919
)
2020

2121
func TestExporterExportErrors(t *testing.T) {

exporters/otlp/otlplog/otlploghttp/go.mod

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,25 @@ require (
1111
go.opentelemetry.io/otel/sdk v1.24.0
1212
go.opentelemetry.io/otel/sdk/log v0.0.0-20240403115316-6c6e1e7416e9
1313
go.opentelemetry.io/otel/trace v1.25.0
14-
go.opentelemetry.io/proto/slim/otlp v1.2.0
14+
go.opentelemetry.io/proto/otlp v1.2.0
1515
google.golang.org/protobuf v1.33.0
1616
)
1717

1818
require (
1919
github.com/davecgh/go-spew v1.1.1 // indirect
2020
github.com/go-logr/logr v1.4.1 // indirect
2121
github.com/go-logr/stdr v1.2.2 // indirect
22+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
23+
github.com/kr/text v0.2.0 // indirect
2224
github.com/pmezard/go-difflib v1.0.0 // indirect
25+
github.com/rogpeppe/go-internal v1.12.0 // indirect
2326
go.opentelemetry.io/otel/metric v1.25.0 // indirect
27+
golang.org/x/net v0.23.0 // indirect
2428
golang.org/x/sys v0.19.0 // indirect
29+
golang.org/x/text v0.14.0 // indirect
30+
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
31+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
32+
google.golang.org/grpc v1.63.0 // indirect
2533
gopkg.in/yaml.v3 v3.0.1 // indirect
2634
)
2735

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
22
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
3+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
34
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
45
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
56
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -9,17 +10,38 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
910
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
1011
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
1112
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
13+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
14+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
15+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
16+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
17+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
18+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1219
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1320
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
21+
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
22+
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
1423
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
1524
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
16-
go.opentelemetry.io/proto/slim/otlp v1.2.0 h1:90eMxPHyObsdi/dB1ZP8FP3s3txzxVXjArYqLxPuLZg=
17-
go.opentelemetry.io/proto/slim/otlp v1.2.0/go.mod h1:DeSHUkdUaCemrUs/Nmnsdo8BtM+XmdTEVjYWYFiLQhU=
25+
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
26+
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
27+
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
28+
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
1829
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
1930
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
31+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
32+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
33+
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY=
34+
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
35+
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0=
36+
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8=
37+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
38+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
39+
google.golang.org/grpc v1.63.0 h1:WjKe+dnvABXyPJMD7KDNLxtoGk5tgk+YFWN6cBWjZE8=
40+
google.golang.org/grpc v1.63.0/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
2041
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
2142
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
22-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2343
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
44+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
45+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
2446
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2547
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

exporters/otlp/otlplog/otlploghttp/internal/transform/attr_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/stretchr/testify/assert"
1010

1111
"go.opentelemetry.io/otel/attribute"
12-
cpb "go.opentelemetry.io/proto/slim/otlp/common/v1"
12+
cpb "go.opentelemetry.io/proto/otlp/common/v1"
1313
)
1414

1515
var (

exporters/otlp/otlplog/otlploghttp/internal/transform/log.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlplog/otl
88
import (
99
"time"
1010

11-
cpb "go.opentelemetry.io/proto/slim/otlp/common/v1"
12-
lpb "go.opentelemetry.io/proto/slim/otlp/logs/v1"
13-
rpb "go.opentelemetry.io/proto/slim/otlp/resource/v1"
11+
cpb "go.opentelemetry.io/proto/otlp/common/v1"
12+
lpb "go.opentelemetry.io/proto/otlp/logs/v1"
13+
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
1414

1515
"go.opentelemetry.io/otel/attribute"
1616
api "go.opentelemetry.io/otel/log"

exporters/otlp/otlplog/otlploghttp/internal/transform/log_attr_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/stretchr/testify/assert"
1010

1111
"go.opentelemetry.io/otel/log"
12-
cpb "go.opentelemetry.io/proto/slim/otlp/common/v1"
12+
cpb "go.opentelemetry.io/proto/otlp/common/v1"
1313
)
1414

1515
var (

exporters/otlp/otlplog/otlploghttp/internal/transform/log_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99

1010
"github.com/stretchr/testify/assert"
1111

12-
cpb "go.opentelemetry.io/proto/slim/otlp/common/v1"
13-
lpb "go.opentelemetry.io/proto/slim/otlp/logs/v1"
12+
cpb "go.opentelemetry.io/proto/otlp/common/v1"
13+
lpb "go.opentelemetry.io/proto/otlp/logs/v1"
1414

1515
api "go.opentelemetry.io/otel/log"
1616
"go.opentelemetry.io/otel/sdk/log"

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/o
1212
//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go
1313
//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go
1414

15+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/envconfig.go
16+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl "--data={}" --out=oconf/envconfig_test.go
17+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry\"}" --out=oconf/options.go
18+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/options_test.go
1519
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl "--data={}" --out=oconf/optiontypes.go
1620
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl "--data={}" --out=oconf/tls.go
1721

18-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=otest/client.go
19-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\", \"internalImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal\"}" --out=otest/client_test.go
22+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client.go.tmpl "--data={}" --out=otest/client.go
23+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl "--data={\"internalImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal\"}" --out=otest/client_test.go
24+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/collector.go.tmpl "--data={\"oconfImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf\"}" --out=otest/collector.go
2025

21-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=transform/attribute.go
22-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=transform/attribute_test.go
23-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=transform/error.go
26+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl "--data={}" --out=transform/attribute.go
27+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl "--data={}" --out=transform/attribute_test.go
28+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error.go.tmpl "--data={}" --out=transform/error.go
2429
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl "--data={}" --out=transform/error_test.go
25-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=transform/metricdata.go
26-
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl "--data={\"protoImportPrefix\": \"go.opentelemetry.io/proto\"}" --out=transform/metricdata_test.go
30+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl "--data={}" --out=transform/metricdata.go
31+
//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl "--data={}" --out=transform/metricdata_test.go

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go

+37-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Code created by gotmpl. DO NOT MODIFY.
2+
// source: internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl
3+
14
// Copyright The OpenTelemetry Authors
25
// SPDX-License-Identifier: Apache-2.0
36

@@ -34,18 +37,46 @@ func ApplyGRPCEnvConfigs(cfg Config) Config {
3437
return cfg
3538
}
3639

37-
func getOptionsFromEnv() []GRPCOption {
38-
opts := []GRPCOption{}
40+
// ApplyHTTPEnvConfigs applies the env configurations for HTTP.
41+
func ApplyHTTPEnvConfigs(cfg Config) Config {
42+
opts := getOptionsFromEnv()
43+
for _, opt := range opts {
44+
cfg = opt.ApplyHTTPOption(cfg)
45+
}
46+
return cfg
47+
}
48+
49+
func getOptionsFromEnv() []GenericOption {
50+
opts := []GenericOption{}
3951

4052
tlsConf := &tls.Config{}
4153
DefaultEnvOptionsReader.Apply(
4254
envconfig.WithURL("ENDPOINT", func(u *url.URL) {
4355
opts = append(opts, withEndpointScheme(u))
44-
opts = append(opts, NewGRPCOption(withEndpointForGRPC(u)))
56+
opts = append(opts, newSplitOption(func(cfg Config) Config {
57+
cfg.Metrics.Endpoint = u.Host
58+
// For OTLP/HTTP endpoint URLs without a per-signal
59+
// configuration, the passed endpoint is used as a base URL
60+
// and the signals are sent to these paths relative to that.
61+
cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath)
62+
return cfg
63+
}, withEndpointForGRPC(u)))
4564
}),
4665
envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) {
4766
opts = append(opts, withEndpointScheme(u))
48-
opts = append(opts, NewGRPCOption(withEndpointForGRPC(u)))
67+
opts = append(opts, newSplitOption(func(cfg Config) Config {
68+
cfg.Metrics.Endpoint = u.Host
69+
// For endpoint URLs for OTLP/HTTP per-signal variables, the
70+
// URL MUST be used as-is without any modification. The only
71+
// exception is that if an URL contains no path part, the root
72+
// path / MUST be used.
73+
path := u.Path
74+
if path == "" {
75+
path = "/"
76+
}
77+
cfg.Metrics.URLPath = path
78+
return cfg
79+
}, withEndpointForGRPC(u)))
4980
}),
5081
envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }),
5182
envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }),
@@ -90,7 +121,7 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt
90121
}
91122
}
92123

93-
func withEndpointScheme(u *url.URL) GRPCOption {
124+
func withEndpointScheme(u *url.URL) GenericOption {
94125
switch strings.ToLower(u.Scheme) {
95126
case "http", "unix":
96127
return WithInsecure()
@@ -100,7 +131,7 @@ func withEndpointScheme(u *url.URL) GRPCOption {
100131
}
101132

102133
// revive:disable-next-line:flag-parameter
103-
func withInsecure(b bool) GRPCOption {
134+
func withInsecure(b bool) GenericOption {
104135
if b {
105136
return WithInsecure()
106137
}

exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Code created by gotmpl. DO NOT MODIFY.
2+
// source: internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl
3+
14
// Copyright The OpenTelemetry Authors
25
// SPDX-License-Identifier: Apache-2.0
36

0 commit comments

Comments
 (0)