-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from alexandreLamarre/bpf-log-extension
Refactor automation logic to target all go submodules
- Loading branch information
Showing
23 changed files
with
139 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name : Validate | ||
|
||
permissions: | ||
contents : read | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "docs/**" | ||
- "*.md" | ||
- ".gitignore" | ||
- "CODEOWNERS" | ||
- "LICENSE" | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses : actions/setup-go@v5 | ||
with: | ||
go-version: ">=1.23.0" | ||
- name : Install mdatagen | ||
run: | | ||
git clone --depth 1 --branch v0.118.0 https://github.com/open-telemetry/opentelemetry-collector /tmp/opentelemetry-collector | ||
cd /tmp/opentelemetry-collector/cmd/mdatagen && go install . | ||
- name : Run go mod tidy | ||
run : make gotidy | ||
- name : Run generate targets | ||
run : make gogenerate | ||
- name : Validate repo | ||
run : git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,38 @@ | ||
include ./Makefile.Common | ||
|
||
.PHONY: build | ||
.PHONY: run | ||
CONFIG_TARGET ?= ./cmd/otelcol/config.yaml | ||
|
||
EXCLUDE_PATHS="./cmd" | ||
# ALL_MODULES includes ./* dirs (excludes . dir) | ||
ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | grep -E '^./' | grep -v -E "$(EXCLUDE_PATHS)" ) | ||
# Append root module to all modules | ||
GOMODULES = $(ALL_MODULES) $(PWD) | ||
|
||
# Define a delegation target for each module | ||
.PHONY: $(GOMODULES) | ||
$(GOMODULES): | ||
@echo "Running target '$(TARGET)' in module '$@'" | ||
$(MAKE) -C $@ $(TARGET) | ||
|
||
# Triggers each module's delegation target | ||
.PHONY: for-all-target | ||
for-all-target: $(GOMODULES) | ||
|
||
.PHONY: gogenerate | ||
gogenerate: | ||
@$(MAKE) for-all-target TARGET="generate" | ||
|
||
.PHONY: gotidy | ||
gotidy: | ||
@$(MAKE) for-all-target TARGET="tidy" | ||
|
||
build: | ||
@echo "Building otelcol-bpf..." | ||
cd otelcol && ocb --config=ocb-config.yaml | ||
cd ./cmd/otelcol && ocb --config=ocb-config.yaml | ||
|
||
run: | ||
@echo "Running otelcol-bpf with..." | ||
@cat otelcol/config.yaml | ||
@echo "\n\n" | ||
sudo ./otelcol/otelcol-bpf --config=otelcol/config.yaml | ||
@cat ./cmd/otelcol/config.yaml | grep -E '^[[:space:]]*#' -v | ||
sudo ./cmd/otelcol/otelcol-bpf --config=$(CONFIG_TARGET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
SHELL = /bin/bash | ||
# ALL_PKGS is the list of all packages where ALL_SRC files reside. | ||
ALL_PKGS := $(sort $(shell go list ./...)) | ||
# COVER_PKGS is the list of packages to include in the coverage | ||
COVER_PKGS := $(shell go list ./... | tr "\n" ",") | ||
|
||
CURR_MOD := $(shell go list -m | tr '/' '-' ) | ||
|
||
GOTEST_TIMEOUT?=240s | ||
GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT) | ||
GOCMD?= go | ||
GOOS := $(shell $(GOCMD) env GOOS) | ||
GOARCH := $(shell $(GOCMD) env GOARCH) | ||
|
||
.PHONY: test | ||
test: $(GOTESTSUM) | ||
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) | ||
|
||
.PHONY: test-with-cover | ||
test-with-cover: $(GOTESTSUM) | ||
mkdir -p $(PWD)/coverage/unit | ||
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(PWD)/coverage/unit" | ||
|
||
.PHONY: tidy | ||
tidy: | ||
rm -fr go.sum | ||
$(GOCMD) mod tidy | ||
|
||
.PHONY: govulncheck | ||
govulncheck: $(GOVULNCHECK) | ||
$(GOVULNCHECK) ./... | ||
|
||
.PHONY: generate | ||
generate: | ||
$(GOCMD) generate ./... | ||
|
||
.PHONY: moddownload | ||
moddownload: | ||
$(GOCMD) mod download |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:generate go run go.opentelemetry.io/collector/cmd/mdatagen metadata.yaml | ||
//go:generate mdatagen metadata.yaml | ||
|
||
// Package bpflogger adds (structured) logging for bpf_printk debug logs in the otel collector bpf distribution | ||
package bpflogger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:generate go run go.opentelemetry.io/collector/cmd/mdatagen metadata.yaml | ||
//go:generate mdatagen metadata.yaml | ||
|
||
// Package bpfstack receives data from stack profiling generated from eBPF | ||
package bpfstack // import "go.opentelemetry.io/collector/receiver/bpfstack" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:generate go run go.opentelemetry.io/collector/cmd/mdatagen metadata.yaml | ||
//go:generate mdatagen metadata.yaml | ||
|
||
// Package bpfstack receives data from stack profiling generated from eBPF | ||
package pprofreceiver // import "go.opentelemetry.io/collector/receiver/pprofreceiver" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.