Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth authored Dec 19, 2023
2 parents 4a300fd + 64853f2 commit b7d2a42
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 34 deletions.
27 changes: 27 additions & 0 deletions .chloggen/zipkinexporter_clientsettings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: zipkinexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Use default client HTTP settings in zipkinexporter, move validation to config validation

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [29931]

# (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.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ jobs:
- name: Run Unit Tests With Coverage
if: startsWith( matrix.go-version, '~1.20' ) # only run coverage on one version
run: make gotest-with-cover GROUP=${{ matrix.group }}
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
if: startsWith( matrix.go-version, '~1.20' ) # only run coverage on one version
with:
name: coverage-artifacts
Expand Down Expand Up @@ -453,7 +453,7 @@ jobs:
- name: Build Collector ${{ matrix.binary }}
run: make GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} GOARM=${{ matrix.arm }} otelcontribcol
- name: Upload Collector Binaries
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: collector-binaries
path: ./bin/*
Expand Down Expand Up @@ -501,7 +501,7 @@ jobs:
./internal/buildscripts/packaging/fpm/test.sh dist/otel-contrib-collector*x86_64.rpm examples/demo/otel-collector-config.yaml
fi
- name: Upload Packages
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: collector-packages
path: ./dist/*
Expand Down Expand Up @@ -536,7 +536,7 @@ jobs:
- name: Validate MSI
run: .\internal\buildscripts\packaging\msi\make.ps1 Confirm-MSI
- name: Upload MSI
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: collector-packages
path: ./dist/*.msi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Build Collector
run: make otelcontribcol
- name: Upload Collector Binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: collector-binary
path: ./bin/*
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
docker save otelcontribcol:latest > /tmp/otelcontribcol.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: otelcontribcol
path: /tmp/otelcontribcol.tar
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: make install-tools
- run: make oteltestbedcol
- name: Upload Collector Binaries
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: collector-binaries
path: ./bin/*
Expand Down Expand Up @@ -103,12 +103,12 @@ jobs:
- name: Upload Test Results
if: ${{ failure() || success() }}
continue-on-error: true
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
path: ./*.tar
- run: cp testbed/tests/results/benchmarks.json testbed/tests/results/${{steps.filename.outputs.name}}.json
- name: Upload benchmarks.json
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: testbed/tests/results/${{steps.filename.outputs.name}}.json
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/telemetrygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ jobs:
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build telemetrygen
uses: docker/build-push-action@v5
with:
context: cmd/telemetrygen
push: false
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:dev
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le

publish-latest:
runs-on: ubuntu-latest
Expand All @@ -31,6 +36,10 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -43,6 +52,7 @@ jobs:
context: cmd/telemetrygen
push: true
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le

publish-stable:
runs-on: ubuntu-latest
Expand All @@ -51,6 +61,10 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Release Tag
id: github_tag
run: ./.github/workflows/scripts/set_release_tag.sh
Expand All @@ -61,8 +75,9 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push telemetrygen to Github packages
run: |
docker build cmd/telemetrygen -t ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:$RELEASE_TAG
docker push ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:$RELEASE_TAG
env:
RELEASE_TAG: ${{ steps.github_tag.outputs.tag }}
uses: docker/build-push-action@v5
with:
context: cmd/telemetrygen
push: true
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:${{ steps.github_tag.outputs.tag }}
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
5 changes: 5 additions & 0 deletions exporter/zipkinexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package zipkinexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/zipkinexporter"

import (
"errors"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/exporter/exporterhelper"
Expand All @@ -27,5 +29,8 @@ var _ component.Config = (*Config)(nil)

// Validate checks if the exporter configuration is valid
func (cfg *Config) Validate() error {
if cfg.HTTPClientSettings.Endpoint == "" {
return errors.New("endpoint required")
}
return nil
}
4 changes: 4 additions & 0 deletions exporter/zipkinexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func TestLoadConfig(t *testing.T) {
// URL doesn't have a default value so set it directly.
defaultCfg := createDefaultConfig().(*Config)
defaultCfg.Endpoint = "http://some.location.org:9411/api/v2/spans"
maxIdleConns := 50
idleConnTimeout := 5 * time.Second

tests := []struct {
id component.ID
Expand Down Expand Up @@ -61,6 +63,8 @@ func TestLoadConfig(t *testing.T) {
TLSSetting: configtls.TLSClientSetting{
InsecureSkipVerify: true,
},
MaxIdleConns: &maxIdleConns,
IdleConnTimeout: &idleConnTimeout,
},
Format: "proto",
DefaultServiceName: "test_name",
Expand Down
19 changes: 6 additions & 13 deletions exporter/zipkinexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package zipkinexporter // import "github.com/open-telemetry/opentelemetry-collec

import (
"context"
"errors"
"time"

"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -33,14 +32,13 @@ func NewFactory() exporter.Factory {
}

func createDefaultConfig() component.Config {
defaultClientHTTPSettings := confighttp.NewDefaultHTTPClientSettings()
defaultClientHTTPSettings.Timeout = defaultTimeout
defaultClientHTTPSettings.WriteBufferSize = 512 * 1024
return &Config{
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
HTTPClientSettings: confighttp.HTTPClientSettings{
Timeout: defaultTimeout,
// We almost read 0 bytes, so no need to tune ReadBufferSize.
WriteBufferSize: 512 * 1024,
},
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
HTTPClientSettings: defaultClientHTTPSettings,
Format: defaultFormat,
DefaultServiceName: defaultServiceName,
}
Expand All @@ -53,11 +51,6 @@ func createTracesExporter(
) (exporter.Traces, error) {
zc := cfg.(*Config)

if zc.Endpoint == "" {
// TODO https://github.com/open-telemetry/opentelemetry-collector/issues/215
return nil, errors.New("exporter config requires a non-empty 'endpoint'")
}

ze, err := createZipkinExporter(zc, set.TelemetrySettings)
if err != nil {
return nil, err
Expand Down
8 changes: 1 addition & 7 deletions exporter/zipkinexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ func TestCreateDefaultConfig(t *testing.T) {
func TestCreateInstanceViaFactory(t *testing.T) {
cfg := createDefaultConfig()

// Default config doesn't have default endpoint so creating from it should
// fail.
ze, err := createTracesExporter(context.Background(), exportertest.NewNopCreateSettings(), cfg)
assert.Error(t, err)
assert.Nil(t, ze)

// URL doesn't have a default value so set it directly.
zeCfg := cfg.(*Config)
zeCfg.Endpoint = "http://some.location.org:9411/api/v2/spans"
ze, err = createTracesExporter(context.Background(), exportertest.NewNopCreateSettings(), cfg)
ze, err := createTracesExporter(context.Background(), exportertest.NewNopCreateSettings(), cfg)
assert.NoError(t, err)
assert.NotNil(t, ze)
}
2 changes: 2 additions & 0 deletions exporter/zipkinexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ zipkin/2:
endpoint: "https://somedest:1234/api/v2/spans"
format: proto
default_service_name: test_name
idle_conn_timeout: 5s
max_idle_conns: 50
sending_queue:
enabled: true
num_consumers: 2
Expand Down

0 comments on commit b7d2a42

Please sign in to comment.