Skip to content

Commit

Permalink
Merge branch 'main' into clear-batch
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Nov 8, 2024
2 parents 358ff87 + d2b0663 commit c173782
Show file tree
Hide file tree
Showing 22 changed files with 223 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/links-fail-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
restore-keys: cache-lychee-

- name: Link Checker
uses: lycheeverse/lychee-action@v2.0.2
uses: lycheeverse/lychee-action@v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2.0.2
uses: lycheeverse/lychee-action@v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- Global MeterProvider registration unwraps global instrument Observers, the undocumented Unwrap() methods are now private. (#5881)
- Fix `go.opentelemetry.io/otel/exporters/prometheus` trying to add exemplars to Gauge metrics, which is unsupported. (#5912)
- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#5944)
- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5944)
- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5944)
- Fix `WithEndpointURL` to always use a secure connection when an https URL is passed in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5944)

### Changed

Expand Down
6 changes: 3 additions & 3 deletions bridge/opentracing/test/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/otel/bridge/opentracing/test

go 1.22
go 1.22.7

replace go.opentelemetry.io/otel => ../../..

Expand All @@ -9,12 +9,12 @@ replace go.opentelemetry.io/otel/bridge/opentracing => ../
replace go.opentelemetry.io/otel/trace => ../../../trace

require (
github.com/opentracing-contrib/go-grpc v0.0.0-20240724223109-9dec25a38fa8
github.com/opentracing-contrib/go-grpc v0.0.0-20241107172107-e3cbcab5b6a5
github.com/opentracing/opentracing-go v1.2.0
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/otel v1.31.0
go.opentelemetry.io/otel/bridge/opentracing v1.31.0
google.golang.org/grpc v1.67.1
google.golang.org/grpc v1.68.0
)

require (
Expand Down
8 changes: 4 additions & 4 deletions bridge/opentracing/test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/opentracing-contrib/go-grpc v0.0.0-20240724223109-9dec25a38fa8 h1:gHTSPFezGeYzTWCvpPM6lBanwXfuksik5Hy5MEHtvUA=
github.com/opentracing-contrib/go-grpc v0.0.0-20240724223109-9dec25a38fa8/go.mod h1:z1k3YVSdAPSXtMUPS1TBWG5DaNWlT+VCbB0Qm3QJe74=
github.com/opentracing-contrib/go-grpc v0.0.0-20241107172107-e3cbcab5b6a5 h1:GQPLM1ycxWm9P+JosdyDP/jMP5BuJuOj8XkUYyv09lQ=
github.com/opentracing-contrib/go-grpc v0.0.0-20241107172107-e3cbcab5b6a5/go.mod h1:qrKVX6K42O2HvkCHYCMw/1Ca1hndihEIFkwgAnKG6Nw=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -28,8 +28,8 @@ golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0=
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
30 changes: 30 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ func TestNewConfig(t *testing.T) {
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "WithEndpointURL secure when Environment Endpoint is set insecure",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "http://env.endpoint:8080/prefix",
},
options: []Option{
WithEndpointURL("https://test:8080/path"),
},
want: config{
endpoint: newSetting("test:8080"),
insecure: newSetting(false),
timeout: newSetting(defaultTimeout),
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "LogEnvironmentVariables",
envars: map[string]string{
Expand Down Expand Up @@ -235,6 +250,21 @@ func TestNewConfig(t *testing.T) {
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "WithEndpointURL secure when Environment insecure is set false",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_INSECURE": "true",
},
options: []Option{
WithEndpointURL("https://test:8080/path"),
},
want: config{
endpoint: newSetting("test:8080"),
insecure: newSetting(false),
timeout: newSetting(defaultTimeout),
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "EnvironmentVariablesPrecedence",
envars: map[string]string{
Expand Down
6 changes: 1 addition & 5 deletions exporters/otlp/otlplog/otlploghttp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ func WithEndpointURL(rawURL string) Option {
return fnOpt(func(c config) config {
c.endpoint = newSetting(u.Host)
c.path = newSetting(u.Path)
if u.Scheme != "https" {
c.insecure = newSetting(true)
} else {
c.insecure = newSetting(false)
}
c.insecure = newSetting(u.Scheme != "https")
return c
})
}
Expand Down
32 changes: 32 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,38 @@ func TestNewConfig(t *testing.T) {
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "WithEndpointURL secure when Environment Endpoint is set insecure",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "http://env.endpoint:8080/prefix",
},
options: []Option{
WithEndpointURL("https://test:8080/path"),
},
want: config{
endpoint: newSetting("test:8080"),
path: newSetting("/path"),
insecure: newSetting(false),
timeout: newSetting(defaultTimeout),
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "WithEndpointURL secure when Environment insecure is set false",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_INSECURE": "true",
},
options: []Option{
WithEndpointURL("https://test:8080/path"),
},
want: config{
endpoint: newSetting("test:8080"),
path: newSetting("/path"),
insecure: newSetting(false),
timeout: newSetting(defaultTimeout),
retryCfg: newSetting(defaultRetryCfg),
},
},
{
name: "LogEnvironmentVariables",
envars: map[string]string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Metrics.Endpoint = u.Host
cfg.Metrics.URLPath = u.Path
if u.Scheme != "https" {
cfg.Metrics.Insecure = true
}
cfg.Metrics.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ func TestConfigs(t *testing.T) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
},
},
{
name: "Test With WithEndpointURL secure when Environment Endpoint is set insecure",
env: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint/prefix",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test With WithEndpointURL secure when Environment insecure is set true",
env: map[string]string{
"OTEL_EXPORTER_OTLP_INSECURE": "true",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test Environment Endpoint",
env: map[string]string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Metrics.Endpoint = u.Host
cfg.Metrics.URLPath = u.Path
if u.Scheme != "https" {
cfg.Metrics.Insecure = true
}
cfg.Metrics.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ func TestConfigs(t *testing.T) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
},
},
{
name: "Test With WithEndpointURL secure when Environment Endpoint is set insecure",
env: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint/prefix",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test With WithEndpointURL secure when Environment insecure is set true",
env: map[string]string{
"OTEL_EXPORTER_OTLP_INSECURE": "true",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test Environment Endpoint",
env: map[string]string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Traces.Endpoint = u.Host
cfg.Traces.URLPath = u.Path
if u.Scheme != "https" {
cfg.Traces.Insecure = true
}
cfg.Traces.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ func TestConfigs(t *testing.T) {
assert.Equal(t, "someendpoint", c.Traces.Endpoint)
},
},
{
name: "Test With WithEndpointURL secure when Environment Endpoint is set insecure",
env: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint/prefix",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Traces.Endpoint)
assert.Equal(t, "/somepath", c.Traces.URLPath)
assert.False(t, c.Traces.Insecure)
},
},
{
name: "Test Environment Endpoint",
env: map[string]string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Traces.Endpoint = u.Host
cfg.Traces.URLPath = u.Path
if u.Scheme != "https" {
cfg.Traces.Insecure = true
}
cfg.Traces.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ func TestConfigs(t *testing.T) {
assert.Equal(t, "someendpoint", c.Traces.Endpoint)
},
},
{
name: "Test With WithEndpointURL secure when Environment Endpoint is set insecure",
env: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint/prefix",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Traces.Endpoint)
assert.Equal(t, "/somepath", c.Traces.URLPath)
assert.False(t, c.Traces.Insecure)
},
},
{
name: "Test Environment Endpoint",
env: map[string]string{
Expand Down
4 changes: 1 addition & 3 deletions internal/shared/otlp/otlpmetric/oconf/options.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Metrics.Endpoint = u.Host
cfg.Metrics.URLPath = u.Path
if u.Scheme != "https" {
cfg.Metrics.Insecure = true
}
cfg.Metrics.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
28 changes: 28 additions & 0 deletions internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ func TestConfigs(t *testing.T) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
},
},
{
name: "Test With WithEndpointURL secure when Environment Endpoint is set insecure",
env: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint/prefix",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test With WithEndpointURL secure when Environment insecure is set true",
env: map[string]string{
"OTEL_EXPORTER_OTLP_INSECURE": "true",
},
opts: []GenericOption{
WithEndpointURL("https://someendpoint/somepath"),
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
assert.Equal(t, "someendpoint", c.Metrics.Endpoint)
assert.Equal(t, "/somepath", c.Metrics.URLPath)
assert.False(t, c.Metrics.Insecure)
},
},
{
name: "Test Environment Endpoint",
env: map[string]string{
Expand Down
4 changes: 1 addition & 3 deletions internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ func WithEndpointURL(v string) GenericOption {

cfg.Traces.Endpoint = u.Host
cfg.Traces.URLPath = u.Path
if u.Scheme != "https" {
cfg.Traces.Insecure = true
}
cfg.Traces.Insecure = u.Scheme != "https"

return cfg
})
Expand Down
Loading

0 comments on commit c173782

Please sign in to comment.