Skip to content

Commit

Permalink
Merge branch 'main' into output_version_of_binary
Browse files Browse the repository at this point in the history
  • Loading branch information
devoc09 authored Dec 9, 2023
2 parents 5a399ea + b79a7c9 commit 3d5d4ef
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 61 deletions.
8 changes: 4 additions & 4 deletions .chloggen/remove_noisy_log.yaml → .chloggen/http2ping.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: exporterhelper
component: config/confighttp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove noisy log
note: Exposes http/2 transport settings to enable health check and workaround golang http/2 issue https://github.com/golang/go/issues/59690

# One or more tracking issues or pull requests related to the change
issues: [9017]
issues: [9022]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12

# Generate apidiff states of Main
- name: Generate-States
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
uses: actions/cache@v3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
unittest-matrix:
strategy:
matrix:
go-version: ["~1.21.4", "~1.20.11"] # 1.20 needs quotes otherwise it's interpreted as 1.2
go-version: ["~1.21.5", "~1.20.12"] # 1.20 needs quotes otherwise it's interpreted as 1.2
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/builder-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
- name: Test
run: make builder-integration-test
2 changes: 1 addition & 1 deletion .github/workflows/builder-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
- name: Cache Go
id: go-cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Run Contrib Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12

- name: Run benchmark
run: make gobenchmark
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
# Prepare Core for release.
# - Update CHANGELOG.md file, this is done via chloggen
# - Run make prepare-release PREVIOUS_VERSION=1.0.0 RELEASE_CANDIDATE=1.1.0 MODSET=stable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tidy-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-go@v4
with:
go-version: ~1.20.11
go-version: ~1.20.12
cache: false
- name: Cache Go
id: go-cache
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,14 @@ genpdata:
$(MAKE) fmt

# Generate semantic convention constants. Requires a clone of the opentelemetry-specification repo
gensemconv:
gensemconv: $(SEMCONVGEN) $(SEMCONVKIT)
@[ "${SPECPATH}" ] || ( echo ">> env var SPECPATH is not set"; exit 1 )
@[ "${SPECTAG}" ] || ( echo ">> env var SPECTAG is not set"; exit 1 )
@echo "Generating semantic convention constants from specification version ${SPECTAG} at ${SPECPATH}"
semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=resource -p conventionType=resource -f generated_resource.go
semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=event -p conventionType=event -f generated_event.go
semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=span -p conventionType=trace -f generated_trace.go
$(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=resource -p conventionType=resource -f generated_resource.go
$(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=event -p conventionType=event -f generated_event.go
$(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=span -p conventionType=trace -f generated_trace.go
$(SEMCONVKIT) -output "semconv/$(SPECTAG)" -tag "$(SPECTAG)"

# Checks that the HEAD of the contrib repo checked out in CONTRIB_PATH compiles
# against the current version of this repo.
Expand Down
2 changes: 2 additions & 0 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ IMPI := $(TOOLS_BIN_DIR)/impi
MISSPELL := $(TOOLS_BIN_DIR)/misspell
MULTIMOD := $(TOOLS_BIN_DIR)/multimod
PORTO := $(TOOLS_BIN_DIR)/porto
SEMCONVGEN := $(TOOLS_BIN_DIR)/semconvgen
SEMCONVKIT := $(TOOLS_BIN_DIR)/semconvkit
YQ := $(TOOLS_BIN_DIR)/yq

.PHONY: install-tools
Expand Down
2 changes: 2 additions & 0 deletions config/confighttp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ README](../configtls/README.md).
- [`idle_conn_timeout`](https://golang.org/pkg/net/http/#Transport)
- [`auth`](../configauth/README.md)
- [`disable_keep_alives`](https://golang.org/pkg/net/http/#Transport)
- [`http2_read_idle_timeout`](https://pkg.go.dev/golang.org/x/net/http2#Transport)
- [`http2_ping_timeout`](https://pkg.go.dev/golang.org/x/net/http2#Transport)

Example:

Expand Down
20 changes: 20 additions & 0 deletions config/confighttp/confighttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package confighttp // import "go.opentelemetry.io/collector/config/confighttp"
import (
"crypto/tls"
"errors"
"fmt"
"io"
"net"
"net/http"
Expand Down Expand Up @@ -86,6 +87,16 @@ type HTTPClientSettings struct {
// connection for every request. Before enabling this option please consider whether changes
// to idle connection settings can achieve your goal.
DisableKeepAlives bool `mapstructure:"disable_keep_alives"`

// This is needed in case you run into
// https://github.com/golang/go/issues/59690
// https://github.com/golang/go/issues/36026
// HTTP2ReadIdleTimeout if the connection has been idle for the configured value send a ping frame for health check
// 0s means no health check will be performed.
HTTP2ReadIdleTimeout time.Duration `mapstructure:"http2_read_idle_timeout"`
// HTTP2PingTimeout if there's no response to the ping within the configured value, the connection will be closed.
// If not set or set to 0, it defaults to 15s.
HTTP2PingTimeout time.Duration `mapstructure:"http2_ping_timeout"`
}

// NewDefaultHTTPClientSettings returns HTTPClientSettings type object with
Expand Down Expand Up @@ -147,6 +158,15 @@ func (hcs *HTTPClientSettings) ToClient(host component.Host, settings component.

transport.DisableKeepAlives = hcs.DisableKeepAlives

if hcs.HTTP2ReadIdleTimeout > 0 {
transport2, transportErr := http2.ConfigureTransports(transport)
if transportErr != nil {
return nil, fmt.Errorf("failed to configure http2 transport: %w", transportErr)
}
transport2.ReadIdleTimeout = hcs.HTTP2ReadIdleTimeout
transport2.PingTimeout = hcs.HTTP2PingTimeout
}

clientTransport := (http.RoundTripper)(transport)

// The Auth RoundTripper should always be the innermost to ensure that
Expand Down
82 changes: 55 additions & 27 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestAllHTTPClientSettings(t *testing.T) {
maxIdleConnsPerHost := 40
maxConnsPerHost := 45
idleConnTimeout := 30 * time.Second
http2PingTimeout := 5 * time.Second
tests := []struct {
name string
settings HTTPClientSettings
Expand All @@ -65,15 +66,17 @@ func TestAllHTTPClientSettings(t *testing.T) {
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
},
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "",
DisableKeepAlives: true,
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "",
DisableKeepAlives: true,
HTTP2ReadIdleTimeout: idleConnTimeout,
HTTP2PingTimeout: http2PingTimeout,
},
shouldError: false,
},
Expand All @@ -84,15 +87,17 @@ func TestAllHTTPClientSettings(t *testing.T) {
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
},
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "none",
DisableKeepAlives: true,
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "none",
DisableKeepAlives: true,
HTTP2ReadIdleTimeout: idleConnTimeout,
HTTP2PingTimeout: http2PingTimeout,
},
shouldError: false,
},
Expand All @@ -103,15 +108,38 @@ func TestAllHTTPClientSettings(t *testing.T) {
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
},
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "gzip",
DisableKeepAlives: true,
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "gzip",
DisableKeepAlives: true,
HTTP2ReadIdleTimeout: idleConnTimeout,
HTTP2PingTimeout: http2PingTimeout,
},
shouldError: false,
},
{
name: "all_valid_settings_http2_health_check",
settings: HTTPClientSettings{
Endpoint: "localhost:1234",
TLSSetting: configtls.TLSClientSetting{
Insecure: false,
},
ReadBufferSize: 1024,
WriteBufferSize: 512,
MaxIdleConns: &maxIdleConns,
MaxIdleConnsPerHost: &maxIdleConnsPerHost,
MaxConnsPerHost: &maxConnsPerHost,
IdleConnTimeout: &idleConnTimeout,
CustomRoundTripper: func(next http.RoundTripper) (http.RoundTripper, error) { return next, nil },
Compression: "gzip",
DisableKeepAlives: true,
HTTP2ReadIdleTimeout: idleConnTimeout,
HTTP2PingTimeout: http2PingTimeout,
},
shouldError: false,
},
Expand Down
Loading

0 comments on commit 3d5d4ef

Please sign in to comment.