Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate checkout action in GitHub workflow #6

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ci
on:
push:
branches: [master]
pull_request:
env:
TEST_RESULTS: /tmp/test-results # path to where test results will be saved
jobs:
go:
strategy:
fail-fast: false
matrix:
go_version: [1.14, 1.15]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2.1.3
with:
go-version: ${{ matrix.go_version }}
- name: Setup Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: restore cache
uses: actions/cache@v2
env:
cache-name: cache-go-mod
with:
path: /home/runner/go/pkg/mod
key: go-pkg-mod-{{ checksum "go.sum" }}
- name: Precommit and Coverage Report
run: |
make ci
mkdir $TEST_RESULTS
cp coverage.out $TEST_RESULTS
cp coverage.txt $TEST_RESULTS
cp coverage.html $TEST_RESULTS
- uses: codecov/codecov-action@v1
with:
file: ./coverage.txt
fail_ci_if_error: true
verbose: true
- name: store test output
uses: actions/upload-artifact@v2
with:
name: opentelemetry-go-test-output
path: ${{ env.TEST_RESULTS }}
4 changes: 2 additions & 2 deletions .github/workflows/protogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '^1.14.0'
- run: sudo apt-get -y install pax
- run: make -f Makefile.proto protobuf
- run: sudo apt-get -y install rsync wget unzip
- run: make -f Makefile.proto protobuf clean
- uses: stefanzweifel/git-auto-commit-action@v4
id: commit-changes
with:
Expand Down
36 changes: 33 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,39 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- Add the `ReadOnlySpan` and `ReadWriteSpan` interfaces to provide better control for accessing span data. (#1360)

### Changed

- Move the OpenCensus example into `example` directory. (#1359)
- Rename `export.SpanData` to `export.SpanSnapshot` and use it only for exporting spans. (#1360)
- Store the parent's full `SpanContext` rather than just its span ID in the `span` struct. (#1360)
- Improve span duration accuracy. (#1360)
- Migrated CI/CD from CircleCI to GitHub Actions (#1382)
### Removed

- Remove `errUninitializedSpan` as its only usage is now obsolete. (#1360)

## [0.15.0] - 2020-12-10

### Added

- The `WithIDGenerator` `TracerProviderOption` is added to the `go.opentelemetry.io/otel/trace` package to configure an `IDGenerator` for the `TracerProvider`. (#1363)

### Changed

- The Zipkin exporter now uses the Span status code to determine. (#1328)
- `NewExporter` and `Start` functions in `go.opentelemetry.io/otel/exporters/otlp` now receive `context.Context` as a first parameter. (#1357)
- Move the OpenCensus example into `example` directory. (#1359)
- Moved the SDK's `internal.IDGenerator` interface in to the `sdk/trace` package to enable support for externally-defined ID generators. (#1363)
- Bump `github.com/google/go-cmp` from 0.5.3 to 0.5.4 (#1374)
- Bump `github.com/golangci/golangci-lint` in `/internal/tools` (#1375)


### Fixed

- Metric SDK `SumObserver` and `UpDownSumObserver` instruments correctness fixes. (#1381)

## [0.14.0] - 2020-11-19

Expand Down Expand Up @@ -72,7 +101,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The `go.opentelemetry.io/otel/api/global` packages global TextMapPropagator now delegates functionality to a globally set delegate for all previously returned propagators. (#1258)
- Fix condition in `label.Any`. (#1299)
- Fix global `TracerProvider` to pass options to its configured provider. (#1329)
- Fix missing handler for `ExactKind` aggregator in OTLP metrics transformer (#1309)
- Fix missing handler for `ExactKind` aggregator in OTLP metrics transformer (#1309)

## [0.13.0] - 2020-10-08

Expand Down Expand Up @@ -965,7 +994,8 @@ It contains api and sdk for trace and meter.
- CODEOWNERS file to track owners of this project.


[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.14.0...HEAD
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.15.0...HEAD
[0.15.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.15.0
[0.14.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.14.0
[0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.13.0
[0.12.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.12.0
Expand Down
135 changes: 96 additions & 39 deletions Makefile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,117 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This Makefile.proto has rules to generate *.pb.go files in
# `exporters/otlp/internal/opentelemetry-proto-gen` from the .proto files in
# `exporters/otlp/internal/opentelemetry-proto` using protoc with a go plugin.
# This Makefile.proto has rules to generate go code for otlp
# exporter. It does it by copying the proto files from
# `exporters/otlp/internal/opentelemetry-proto` (which is a
# submodule that needs to be checked out) into `gen/proto`, changing
# the go_package option to a valid string, generating the go files and
# finally copying the files into the module. The files are not
# generated in place, because protoc generates a too-deep directory
# structure.
#
# The protoc binary and other tools are sourced from a docker image
# `PROTOC_IMAGE`.
# Currently, all the generated code is in
# `exporters/otlp/internal/opentelemetry-proto-gen`.
#
# Prereqs: The archiving utility `pax` is installed.
# Prereqs: wget (for downloading the zip file with protoc binary),
# unzip (for unpacking the archive), rsync (for copying back the
# generated files).

PROTOC_IMAGE := namely/protoc-all:1.29_2
PROTOBUF_VERSION := v1
OTEL_PROTO_SUBMODULE := exporters/otlp/internal/opentelemetry-proto
PROTOBUF_GEN_DIR := exporters/otlp/internal/opentelemetry-proto-gen
PROTOBUF_TEMP_DIR := gen/pb-go
PROTO_SOURCE_DIR := gen/proto
SUBMODULE_PROTO_FILES := $(wildcard $(OTEL_PROTO_SUBMODULE)/opentelemetry/proto/*/$(PROTOBUF_VERSION)/*.proto \
$(OTEL_PROTO_SUBMODULE)/opentelemetry/proto/collector/*/$(PROTOBUF_VERSION)/*.proto)
SOURCE_PROTO_FILES := $(subst $(OTEL_PROTO_SUBMODULE),$(PROTO_SOURCE_DIR),$(SUBMODULE_PROTO_FILES))
PROTOC_VERSION := 3.14.0

default: protobuf
TOOLS_DIR := $(abspath ./.tools)
TOOLS_MOD_DIR := ./internal/tools
PROTOBUF_VERSION := v1
OTEL_PROTO_SUBMODULE := exporters/otlp/internal/opentelemetry-proto
GEN_TEMP_DIR := gen
SUBMODULE_PROTO_FILES := $(wildcard $(OTEL_PROTO_SUBMODULE)/opentelemetry/proto/*/$(PROTOBUF_VERSION)/*.proto) $(wildcard $(OTEL_PROTO_SUBMODULE)/opentelemetry/proto/collector/*/$(PROTOBUF_VERSION)/*.proto)

.PHONY: protobuf protobuf-source gen-protobuf copy-protobufs
protobuf: protobuf-source gen-protobuf copy-protobufs
ifeq ($(strip $(SUBMODULE_PROTO_FILES)),)
$(error Submodule at $(OTEL_PROTO_SUBMODULE) is not checked out, use "git submodule update --init")
endif

protobuf-source: $(SOURCE_PROTO_FILES) | $(PROTO_SOURCE_DIR)/
PROTOBUF_GEN_DIR := exporters/otlp/internal/opentelemetry-proto-gen
PROTOBUF_TEMP_DIR := $(GEN_TEMP_DIR)/pb-go
PROTO_SOURCE_DIR := $(GEN_TEMP_DIR)/proto
SOURCE_PROTO_FILES := $(subst $(OTEL_PROTO_SUBMODULE),$(PROTO_SOURCE_DIR),$(SUBMODULE_PROTO_FILES))

# Changes go_package in .proto file to point to repo-local location
define exec-replace-pkgname
sed 's,go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go,go_package = "go.opentelemetry.io/otel/exporters/otlp/internal/opentelemetry-proto-gen,' < $(1) > $(2)
.DEFAULT_GOAL := protobuf

endef
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

ifeq ($(UNAME_S),Linux)

PROTOC_OS := linux
PROTOC_ARCH := $(UNAME_M)

else ifeq ($(UNAME_S),Darwin)

PROTOC_OS := osx
PROTOC_ARCH := x86_64

endif

# replace opentelemetry-proto package name by go.opentelemetry.io/otel specific version
$(SOURCE_PROTO_FILES): $(PROTO_SOURCE_DIR)/%.proto: $(OTEL_PROTO_SUBMODULE)/%.proto
@mkdir -p $(@D)
$(call exec-replace-pkgname,$<,$@)
PROTOC_ZIP_URL := https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PROTOC_OS)-$(PROTOC_ARCH).zip

# Command to run protoc using docker image
define exec-protoc-all
docker run -v `pwd`:/defs $(PROTOC_IMAGE) $(1)
$(TOOLS_DIR)/PROTOC_$(PROTOC_VERSION):
@rm -f "$(TOOLS_DIR)"/PROTOC_* && \
touch "$@"

# Depend on a versioned file (like PROTOC_3.14.0), so when version
# gets bumped, we will depend on a nonexistent file and thus download
# a newer version.
$(TOOLS_DIR)/protoc/bin/protoc: $(TOOLS_DIR)/PROTOC_$(PROTOC_VERSION)
echo "Fetching protoc $(PROTOC_VERSION)" && \
rm -rf $(TOOLS_DIR)/protoc && \
wget -O $(TOOLS_DIR)/protoc.zip $(PROTOC_ZIP_URL) && \
unzip $(TOOLS_DIR)/protoc.zip -d $(TOOLS_DIR)/protoc-tmp && \
rm $(TOOLS_DIR)/protoc.zip && \
touch $(TOOLS_DIR)/protoc-tmp/bin/protoc && \
mv $(TOOLS_DIR)/protoc-tmp $(TOOLS_DIR)/protoc

$(TOOLS_DIR)/protoc-gen-gogofast: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/protoc-gen-gogofast github.com/gogo/protobuf/protoc-gen-gogofast && \
go mod tidy

# Return a sed expression for replacing the go_package option in proto
# file with a one that's valid for us.
#
# Example: $(call get-sed-expr,$(PROTOBUF_GEN_DIR))
define get-sed-expr
's,go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go,go_package = "go.opentelemetry.io/otel/$(1),'
endef

gen-protobuf: $(SOURCE_PROTO_FILES) | $(PROTOBUF_GEN_DIR)/
$(foreach file,$(subst ${PROTO_SOURCE_DIR}/,,$(SOURCE_PROTO_FILES)),$(call exec-protoc-all, -i $(PROTO_SOURCE_DIR) -f ${file} -l gogo -o ${PROTOBUF_TEMP_DIR}))
.PHONY: protobuf
protobuf: protobuf-source gen-protobuf copy-protobufs

.PHONY: protobuf-source
protobuf-source: $(SOURCE_PROTO_FILES)

# This copies proto files from submodule into $(PROTO_SOURCE_DIR),
# thus satisfying the $(SOURCE_PROTO_FILES) prerequisite. The copies
# have their package name replaced by go.opentelemetry.io/otel.
$(PROTO_SOURCE_DIR)/%.proto: $(OTEL_PROTO_SUBMODULE)/%.proto
@ \
mkdir -p $(@D); \
sed -e $(call get-sed-expr,$(PROTOBUF_GEN_DIR)) "$<" >"$@.tmp"; \
mv "$@.tmp" "$@"

# requires `pax` to be installed, as it has consistent options for both BSD (Darwin) and Linux
copy-protobufs: | $(PROTOBUF_GEN_DIR)/
find ./$(PROTOBUF_TEMP_DIR)/go.opentelemetry.io/otel/$(PROTOBUF_GEN_DIR) -type f -print0 | \
pax -0 -s ',^./$(PROTOBUF_TEMP_DIR)/go.opentelemetry.io/otel/$(PROTOBUF_GEN_DIR),,' -rw ./$(PROTOBUF_GEN_DIR)
.PHONY: gen-protobuf
gen-protobuf: $(SOURCE_PROTO_FILES) $(TOOLS_DIR)/protoc-gen-gogofast $(TOOLS_DIR)/protoc/bin/protoc
@ \
mkdir -p "$(PROTOBUF_TEMP_DIR)"; \
set -e; for f in $^; do \
if [[ "$${f}" == $(TOOLS_DIR)/* ]]; then continue; fi; \
echo "protoc $${f#"$(PROTO_SOURCE_DIR)/"}"; \
PATH="$(TOOLS_DIR):$${PATH}" $(TOOLS_DIR)/protoc/bin/protoc --proto_path="$(PROTO_SOURCE_DIR)" --gogofast_out="plugins=grpc:$(PROTOBUF_TEMP_DIR)" "$${f}"; \
done

$(PROTO_SOURCE_DIR)/ $(PROTOBUF_GEN_DIR)/:
mkdir -p $@
.PHONY: copy-protobufs
copy-protobufs:
@rsync -a $(PROTOBUF_TEMP_DIR)/go.opentelemetry.io/otel/exporters .

.PHONY: clean
clean:
rm -rf ./gen
rm -rf $(GEN_TEMP_DIR)
2 changes: 1 addition & 1 deletion bridge/opencensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

require (
go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f
go.opentelemetry.io/otel v0.14.0
go.opentelemetry.io/otel v0.15.0
)

replace go.opentelemetry.io/otel => ../..
2 changes: 1 addition & 1 deletion bridge/opentracing/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ replace go.opentelemetry.io/otel => ../..

require (
github.com/opentracing/opentracing-go v1.2.0
go.opentelemetry.io/otel v0.14.0
go.opentelemetry.io/otel v0.15.0
)
6 changes: 3 additions & 3 deletions example/basic/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ replace (
)

require (
go.opentelemetry.io/otel v0.14.0
go.opentelemetry.io/otel/exporters/stdout v0.14.0
go.opentelemetry.io/otel/sdk v0.14.0
go.opentelemetry.io/otel v0.15.0
go.opentelemetry.io/otel/exporters/stdout v0.15.0
go.opentelemetry.io/otel/sdk v0.15.0
)
6 changes: 3 additions & 3 deletions example/jaeger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ replace (
)

require (
go.opentelemetry.io/otel v0.14.0
go.opentelemetry.io/otel/exporters/trace/jaeger v0.14.0
go.opentelemetry.io/otel/sdk v0.14.0
go.opentelemetry.io/otel v0.15.0
go.opentelemetry.io/otel/exporters/trace/jaeger v0.15.0
go.opentelemetry.io/otel/sdk v0.15.0
)
Loading