Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
02f013e
rename features built with on test file
JingboWang1997-1 Jun 17, 2020
5c1bdfc
modified files to enable easier dev testing
JingboWang1997-1 Jun 18, 2020
13469a9
functionaing update and insert rename metric name
JingboWang1997-1 Jun 18, 2020
f16433e
finished implementation and testing 100% coverage
JingboWang1997-1 Jun 18, 2020
9f6284c
function comment
JingboWang1997-1 Jun 19, 2020
a5658bd
cleanup repo for PR
JingboWang1997-1 Jun 19, 2020
6145298
code cleanup
JingboWang1997-1 Jun 19, 2020
56771e6
label rename and update
JingboWang1997-1 Jun 19, 2020
d7ea1ab
rename label feature in dev looks good, so merge into rename to prepare
JingboWang1997-1 Jun 19, 2020
f8c62ab
fix lint build issue
JingboWang1997-1 Jun 19, 2020
f6278a4
minor revision based on PR comments and lint checks
JingboWang1997-1 Jun 22, 2020
60eec93
change import order for lint check
JingboWang1997-1 Jun 22, 2020
dd12425
make it a go module
JingboWang1997-1 Jun 23, 2020
da04adf
setup chek, add local makefile
JingboWang1997-1 Jun 23, 2020
18e9bce
tidy module on root level
JingboWang1997-1 Jun 23, 2020
2055801
comments and metric name adjustment
JingboWang1997-1 Jun 23, 2020
9504432
formatting and variable names
JingboWang1997-1 Jun 23, 2020
fbc0001
clean up tests to address PR comments
JingboWang1997-1 Jun 23, 2020
a7551f5
error logging formatting and benchmark test
JingboWang1997-1 Jun 24, 2020
29d9b9c
able to perform transformations on multiple metrics
JingboWang1997-1 Jun 24, 2020
a32a45a
fix lint
JingboWang1997-1 Jun 24, 2020
4512455
readme
JingboWang1997-1 Jun 25, 2020
b877123
remove hardcoding like transforms[0]
JingboWang1997-1 Jun 25, 2020
060116f
unchange the root level module files
JingboWang1997-1 Jun 25, 2020
7490a37
code cleanup with some optimization
JingboWang1997-1 Jun 25, 2020
06e12b0
setup for aggregation
JingboWang1997-1 Jun 25, 2020
5bb23b1
clear empty branches
JingboWang1997-1 Jun 26, 2020
3753f8c
merge abort
JingboWang1997-1 Jun 30, 2020
a6a7f9a
address PR comments, cleanup code
JingboWang1997-1 Jun 30, 2020
97b6351
Revert "clear empty branches"
JingboWang1997-1 Jun 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 34 additions & 101 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2.1
parameters:
run-build-publish:
type: boolean
default: true
type: boolean
default: true
run-stability-tests:
type: boolean
type: boolean
default: false
collector-sha:
type: string
Expand All @@ -14,38 +14,8 @@ executors:
golang:
docker:
- image: cimg/go:1.14
machine:
machine:
image: ubuntu-1604:201903-01

commands:
setup:
steps:
- checkout
- restore_module_cache
- run:
name: Install deps
command: make -j8 for-all-target TARGET=dep
- run:
name: Install tools
command: make install-tools
- run:
name: Install testbed tools
command: make -C testbed install-tools
- save_module_cache

setup_go:
steps:
- run:
name: Install Go 1.14
command: |
sudo rm -rf /usr/local/go
curl -L https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz | sudo tar xz -C /usr/local
- run:
name: Add ~/go/bin to PATH
command: |
echo 'export PATH=$HOME/go/bin:$PATH' >> $BASH_ENV

restore_workspace:
steps:
- attach_to_workspace
Expand Down Expand Up @@ -111,7 +81,7 @@ workflows:
- build
- publish-dev:
requires:
- run-stability-tests
- run-stability-tests

build-publish:
when: << pipeline.parameters.run-build-publish >>
Expand All @@ -132,7 +102,7 @@ workflows:
filters:
tags:
only: /.*/
- build-examples:
- build-examples-tracing:
requires:
- setup
filters:
Expand All @@ -150,7 +120,7 @@ workflows:
filters:
tags:
only: /.*/
- unit-tests:
- test:
requires:
- setup
filters:
Expand All @@ -159,8 +129,7 @@ workflows:
- publish-stable:
requires:
- lint
- unit-tests
- integration-tests
- test
- build
- cross-compile
filters:
Expand All @@ -171,24 +140,30 @@ workflows:
- spawn-stability-tests-job:
requires:
- lint
- unit-tests
- integration-tests
- test
- build
filters:
branches:
only: /master|release\/.+/
tags:
ignore: /.*/
- integration-tests:
filters:
tags:
only: /.*/

jobs:
setup:
executor: golang
steps:
- setup
- checkout
- restore_module_cache
- run:
name: Install deps
command: make -j8 for-all-target TARGET='dep'
- run:
name: Install tools
command: make install-tools
- run:
name: Install testbed tools
command: make -C testbed install-tools
- save_module_cache
- persist_to_workspace:
root: ~/
paths:
Expand All @@ -200,7 +175,7 @@ jobs:
- restore_workspace
- run:
name: Lint
command: make -j8 for-all-target TARGET=lint
command: make -j8 for-all-target TARGET="lint"
- run:
name: Checks
command: make -j4 checklicense impi misspell
Expand All @@ -216,15 +191,15 @@ jobs:
root: ~/
paths: project/bin

build-examples:
build-examples-tracing:
docker:
- image: cimg/go:1.14
steps:
- restore_workspace
- setup_remote_docker
- run:
name: Build examples
command: make build-examples
name: Build trace example
command: docker-compose -f examples/tracing/docker-compose.yml build

cross-compile:
executor: golang
Expand All @@ -238,16 +213,16 @@ jobs:
root: ~/
paths: project/bin

unit-tests:
test:
executor: golang
steps:
- restore_workspace
- run:
name: Unit test coverage
command: make unit-tests-with-cover
name: Coverage tests
command: make test-with-cover
- run:
name: Upload unit test coverage
command: bash <(curl -s https://codecov.io/bash) -F unit
name: Code coverage
command: bash <(curl -s https://codecov.io/bash)

loadtest:
executor: golang
Expand All @@ -256,7 +231,7 @@ jobs:
- restore_workspace
- run:
name: Loadtest
command: make e2e-test
command: make -C testbed runtests
- store_artifacts:
path: testbed/tests/results
- store_test_results:
Expand All @@ -272,7 +247,7 @@ jobs:
repo: opentelemetry-collector-contrib
tag: ${CIRCLE_TAG:1}
- run:
name: Calculate checksums
name: Calculate checksums
command: cd bin && shasum -a 256 * > checksums.txt
- run:
name: Create Github release and upload artifacts
Expand All @@ -281,7 +256,7 @@ jobs:
publish-dev:
executor: golang
steps:
- restore_workspace
- restore_workspace
- setup_remote_docker
- publish_docker_images:
repo: opentelemetry-collector-contrib-dev
Expand Down Expand Up @@ -309,33 +284,12 @@ jobs:
git status

run-stability-tests:
parameters:
# Number of runners must be always in sync with number of stability tests,
# so every node runs exactly one stability test.
runners-number:
type: integer
default: 9
executor: golang
resource_class: medium+
parallelism: << parameters.runners-number >>
steps:
- restore_workspace
- restore_workspace
- run:
no_output_timeout: 70m
name: Run stability tests
command: |
export TESTS=$(make -C testbed -s list-stability-tests)
export TEST_NUM=$(echo ${TESTS} | wc -w | tr -d '[:space:]')
if [ "${TEST_NUM}" -ne "<< parameters.runners-number >>" ]; then \
echo "ERROR: Number of stability tests must match number of CircleCI runners. Update runners-number parameter"; exit 2; \
fi
export TEST_NAME=$(echo ${TESTS} | sed 's/ /\n/g' | circleci tests split --total=${TEST_NUM})
echo "Running ${TEST_NAME}..."
TEST_ARGS="-test.run=${TEST_NAME}" make stability-tests
- store_artifacts:
path: testbed/stabilitytests/results
- store_test_results:
path: testbed/stabilitytests/results/junit
command: make stability-tests
- run:
name: Run on fail status
command: |
Expand All @@ -348,24 +302,3 @@ jobs:
"body": "Link to failed job: '"${CIRCLE_BUILD_URL}"'."
}'
when: on_fail

integration-tests:
executor: machine
environment:
GOPATH: /home/circleci/go
steps:
- setup_go
- setup
- run:
name: Integration tests with coverage
command: |
mkdir -p test-results/junit
trap "go-junit-report -set-exit-code < test-results/go-integration-tests.out > test-results/junit/results.xml" EXIT
make integration-tests-with-cover | tee test-results/go-integration-tests.out
- run:
name: Upload integration test coverage
command: bash <(curl -s https://codecov.io/bash) -F integration
- store_test_results:
path: test-results/junit
- store_artifacts:
path: test-results
4 changes: 1 addition & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
codecov:
notify:
require_ci_to_pass: yes
# wait for unit and integration test builds.
after_n_builds: 2
strict_yaml_branch: master # only use the latest copy on master branch

coverage:
Expand All @@ -17,4 +15,4 @@ coverage:
patch:
default:
enabled: yes
target: 95%
target: 95%
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ bin/

# Coverage
coverage.txt
integration-coverage.txt
coverage.html
integration-coverage.html
47 changes: 20 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,40 @@ BUILD_X1=-X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA)
ifdef VERSION
BUILD_X2=-X $(BUILD_INFO_IMPORT_PATH).Version=$(VERSION)
endif
BUILD_X3=-X go.opentelemetry.io/collector/internal/version.BuildType=$(BUILD_TYPE)
BUILD_X3=-X github.com/open-telemetry/opentelemetry-collector/internal/version.BuildType=$(BUILD_TYPE)
BUILD_INFO=-ldflags "${BUILD_X1} ${BUILD_X2} ${BUILD_X3}"
STATIC_CHECK=staticcheck
OTEL_VERSION=master

# Modules to run integration tests on.
# XXX: Find a way to automatically populate this. Too slow to run across all modules when there are just a few.
INTEGRATION_TEST_MODULES := \
receiver/redisreceiver \
internal/common

.DEFAULT_GOAL := all

.PHONY: all
all: common otelcontribcol

.PHONY: e2e-test
e2e-test: otelcontribcol
$(MAKE) -C testbed run-tests
$(MAKE) -C testbed runtests

.PHONY: precommit
precommit:
$(MAKE) gotidy
$(MAKE) ci

.PHONY: test-with-cover
unit-tests-with-cover:
test-with-cover:
@echo Verifying that all packages have test files to count in coverage
@scripts/check-test-files.sh $(subst github.com/open-telemetry/opentelemetry-collector-contrib/,./,$(ALL_PKGS))
@$(MAKE) for-all CMD="make do-unit-tests-with-cover"

.PHONY: integration-tests-with-cover
integration-tests-with-cover:
@echo $(INTEGRATION_TEST_MODULES)
@$(MAKE) for-all CMD="make do-integration-tests-with-cover" ALL_MODULES="$(INTEGRATION_TEST_MODULES)"
@echo pre-compiling tests
set -e; for dir in $(ALL_MODULES); do \
echo "go test ./... + coverage in $${dir}"; \
(cd "$${dir}" && \
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./... && \
go tool cover -html=coverage.txt -o coverage.html ); \
done

# Long-running e2e tests
.PHONY: stability-tests
stability-tests: otelcontribcol
$(MAKE) -C testbed run-stability-tests
stability-tests:
@echo Stability tests have not been implemented yet

.PHONY: gotidy
gotidy:
Expand Down Expand Up @@ -85,19 +84,18 @@ GOMODULES = $(ALL_MODULES) $(PWD)
.PHONY: $(GOMODULES)
MODULEDIRS = $(GOMODULES:%=for-all-target-%)
for-all-target: $(MODULEDIRS)
$(MODULEDIRS):
$(MAKE) -C $(@:for-all-target-%=%) $(TARGET)
$(MODULEDIRS):
$(MAKE) -C $(@:for-all-target-%=%) $(TARGET)
.PHONY: for-all-target

.PHONY: install-tools
install-tools:
go install github.com/client9/misspell/cmd/misspell
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go install github.com/google/addlicense
go install github.com/jstemmer/go-junit-report
go install honnef.co/go/tools/cmd/staticcheck
go install github.com/pavius/impi/cmd/impi
go install github.com/tcnksm/ghr
go install honnef.co/go/tools/cmd/staticcheck

.PHONY: run
run:
Expand Down Expand Up @@ -170,8 +168,3 @@ otel-from-tree:
otel-from-lib:
# Sets opentelemetry core to be not be pulled from local source tree. (Undoes otel-from-tree.)
$(MAKE) for-all CMD="go mod edit -dropreplace go.opentelemetry.io/collector"

.PHONY: build-examples
build-examples:
docker-compose -f examples/tracing/docker-compose.yml build
docker-compose -f exporter/splunkhecexporter/example/docker-compose.yml build
Loading