Skip to content

Commit

Permalink
Merge pull request #24 from alonkeyval/gen-1359-merge-upstream
Browse files Browse the repository at this point in the history
[GEN-1359] chore: merge upstream
  • Loading branch information
alonkeyval authored Sep 3, 2024
2 parents 99161bf + 66d11f6 commit 26ccfce
Show file tree
Hide file tree
Showing 131 changed files with 3,547 additions and 459 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/backends-docs-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Backend Doc Change

on:
pull_request:
branches:
- main

jobs:
check-doc-change:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Run sync-dest-doc.py in docs directory
run: |
cd docs
python sync-dest-doc.py
- name: Check for changes in docs-backends
run: |
git diff --exit-code docs/backends || (
echo "Changes detected in docs/backends directory. You should update run cd docs ; python sync-dest-doc.py and commit the changes.";
git diff docs/backends;
exit 1;
)
21 changes: 19 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,26 @@ jobs:
working-directory: ./instrumentor
run: |
make test
build-and-test-odiglet:
build-and-test-odigos-collector:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build Odigos Collector Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: false
tags: odigos-collector:pr-${{ github.event.number }}
context: ./collector
file: collector/Dockerfile
- name: run tests
working-directory: ./collector
run: |
make test
build-and-test-odiglet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/helm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@v4
- name: Lint Charts
run: helm lint helm/*
run: |
shopt -s extglob
helm lint helm/!(*.md)
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ deploy: deploy-odiglet deploy-autoscaler deploy-collector deploy-instrumentor de
e2e-test:
./e2e-test.sh

ALL_GO_MOD_DIRS := $(shell go list -m -f '{{.Dir}}' | sort)
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)

.PHONY: go-mod-tidy
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
Expand All @@ -192,10 +192,10 @@ check-clean-work-tree:
.PHONY: cli-install
cli-install:
@echo "Installing odigos from source. version: $(ODIGOS_CLI_VERSION)"
go run -tags=embed_manifests ./cli install --version $(ODIGOS_CLI_VERSION)
cd ./cli ; go run -tags=embed_manifests . install --version $(ODIGOS_CLI_VERSION)


.PHONY: cli-upgrade
cli-upgrade:
@echo "Installing odigos from source. version: $(ODIGOS_CLI_VERSION)"
go run -tags=embed_manifests ./cli upgrade --version $(ODIGOS_CLI_VERSION) --yes
cd ./cli ; go run -tags=embed_manifests . upgrade --version $(ODIGOS_CLI_VERSION) --yes
1 change: 1 addition & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (

require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/sync v0.7.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
9 changes: 9 additions & 0 deletions api/odigos/v1alpha1/instrumentatioconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,12 @@ type InstrumentationConfigList struct {
func init() {
SchemeBuilder.Register(&InstrumentationConfig{}, &InstrumentationConfigList{})
}

// Languages returns the set of languages that this configuration applies to
func (ic *InstrumentationConfig) Languages() map[common.ProgrammingLanguage]struct{} {
langs := make(map[common.ProgrammingLanguage]struct{})
for _, sdkConfig := range ic.Spec.SdkConfigs {
langs[sdkConfig.Language] = struct{}{}
}
return langs
}
Binary file modified assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions autoscaler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
2 changes: 2 additions & 0 deletions autoscaler/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down
2 changes: 2 additions & 0 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func otelSdkConfigCommunity() map[common.ProgrammingLanguage]common.OtelSdk {
common.GoProgrammingLanguage: common.OtelSdkEbpfCommunity,
common.DotNetProgrammingLanguage: common.OtelSdkNativeCommunity,
common.JavascriptProgrammingLanguage: common.OtelSdkNativeCommunity,
common.NginxProgrammingLanguage: common.OtelSdkNativeCommunity,
}
}

Expand All @@ -194,6 +195,7 @@ func otelSdkConfigCloud() map[common.ProgrammingLanguage]common.OtelSdk {
common.GoProgrammingLanguage: common.OtelSdkEbpfEnterprise,
common.DotNetProgrammingLanguage: common.OtelSdkNativeCommunity,
common.JavascriptProgrammingLanguage: common.OtelSdkNativeCommunity,
common.NginxProgrammingLanguage: common.OtelSdkNativeCommunity,
}
}

Expand Down
14 changes: 8 additions & 6 deletions cli/cmd/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ var uiCmd = &cobra.Command{
}

localPort := cmd.Flag("port").Value.String()
if err := portForwardWithContext(ctx, uiPod, client, localPort); err != nil {
localAddress := cmd.Flag("address").Value.String()
if err := portForwardWithContext(ctx, uiPod, client, localPort, localAddress); err != nil {
fmt.Printf("\033[31mERROR\033[0m Cannot start port-forward: %s\n", err)
os.Exit(1)
}
},
}

func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube.Client, localPort string) error {
func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube.Client, localPort string, localAddress string) error {
stopChannel := make(chan struct{}, 1)
readyChannel := make(chan struct{})
signals := make(chan os.Signal, 1)
Expand All @@ -84,7 +85,7 @@ func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube
close(stopChannel)
}()

fmt.Printf("Odigos UI is available at: http://localhost:%s\n\n", localPort)
fmt.Printf("Odigos UI is available at: http://%s:%s\n\n", localAddress, localPort)
fmt.Printf("Port-forwarding from %s/%s\n", uiPod.Namespace, uiPod.Name)
fmt.Printf("Press Ctrl+C to stop\n")

Expand All @@ -95,7 +96,7 @@ func portForwardWithContext(ctx context.Context, uiPod *corev1.Pod, client *kube
Name(uiPod.Name).
SubResource("portforward")

return forwardPorts("POST", req.URL(), client.Config, stopChannel, readyChannel, localPort)
return forwardPorts("POST", req.URL(), client.Config, stopChannel, readyChannel, localPort, localAddress)
}

func createDialer(method string, url *url.URL, cfg *rest.Config) (httpstream.Dialer, error) {
Expand All @@ -115,15 +116,15 @@ func createDialer(method string, url *url.URL, cfg *rest.Config) (httpstream.Dia
return dialer, nil
}

func forwardPorts(method string, url *url.URL, cfg *rest.Config, stopCh chan struct{}, readyCh chan struct{}, localPort string) error {
func forwardPorts(method string, url *url.URL, cfg *rest.Config, stopCh chan struct{}, readyCh chan struct{}, localPort string, localAddress string) error {
dialer, err := createDialer(method, url, cfg)
if err != nil {
return err
}

port := fmt.Sprintf("%s:%d", localPort, defaultPort)
fw, err := portforward.NewOnAddresses(dialer,
[]string{"localhost"},
[]string{localAddress},
[]string{port}, stopCh, readyCh, nil, os.Stderr)

if err != nil {
Expand Down Expand Up @@ -156,4 +157,5 @@ func findOdigosUIPod(client *kube.Client, ctx context.Context, ns string) (*core
func init() {
rootCmd.AddCommand(uiCmd)
uiCmd.Flags().Int("port", defaultPort, "port to listen on")
uiCmd.Flags().String("address", "localhost", "Address to listen on")
}
3 changes: 2 additions & 1 deletion cli/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ and apply any required migrations and adaptations.`,

var operation string

if !cmd.Flag("skip-version-check").Changed {
skipVersionCheckFlag := cmd.Flag("skip-version-check")
if skipVersionCheckFlag == nil || !cmd.Flag("skip-version-check").Changed {

cm, err := client.CoreV1().ConfigMaps(ns).Get(ctx, resources.OdigosDeploymentConfigMapName, metav1.GetOptions{})
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions collector/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM golang:1.22-bullseye AS builder
FROM --platform=$BUILDPLATFORM golang:1.22-bullseye AS builder
COPY . /go/src/
WORKDIR /go/src/
RUN make build-odigoscol

ARG TARGETARCH
RUN GOOS=linux GOARCH=$TARGETARCH make build-odigoscol

FROM gcr.io/distroless/base:latest
COPY --from=builder /go/src/odigosotelcol/odigosotelcol /odigosotelcol
Expand Down
13 changes: 12 additions & 1 deletion collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ BUILDER := $(TOOLS_BIN_DIR)/builder_$(BUILDER_VERSION)

# Determine the current operating system and architecture
CURRENT_OS := $(shell go env GOOS)
CURRENT_ARCH := $(shell go env GOARCH)
CURRENT_ARCH := $(shell go env GOHOSTARCH)
GOBIN := $(shell go env GOPATH)/bin

# Define the URL format for the tool executable
BUILDER_URL = https://github.com/open-telemetry/opentelemetry-collector/releases/download/cmd%2Fbuilder%2Fv$(BUILDER_VERSION)/ocb_$(BUILDER_VERSION)_$(CURRENT_OS)_$(CURRENT_ARCH)

GOCMD?= go
MDATAGENCMD?= mdatagen

.PHONY: download_builder
download_builder:
Expand Down Expand Up @@ -50,3 +51,13 @@ install-tools:
.PHONY: generate
generate: install-tools
@find . -type f -name 'metadata.yaml' -print0 | xargs -0 -I {} sh -c 'cd $$(dirname {}); $(GOBIN)/mdatagen metadata.yaml'

ALL_GO_MODS := $(shell find . -type f -name 'go.mod' ! -path './exporters/googlecloudstorageexporter/*' ! -path './exporters/azureblobstorageexporter/*' ! -path './internal/tools/*' ! -path './odigosotelcol/*' | sort)
GO_MODS_TO_TEST := $(ALL_GO_MODS:%=test/%)

.PHONY: test
test: $(GO_MODS_TO_TEST)
test/%: GO_MOD=$*
test/%:
cd $(shell dirname $(GO_MOD)) && $(GOCMD) test -v ./...

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions collector/exporters/azureblobstorageexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.21.0
toolchain go1.22.6

require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.0
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/component v0.106.0
go.opentelemetry.io/collector/confmap v0.106.0
Expand All @@ -20,9 +20,9 @@ require (
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand All @@ -31,7 +31,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -43,7 +43,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
Expand All @@ -64,8 +64,8 @@ require (
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
Expand Down
Loading

0 comments on commit 26ccfce

Please sign in to comment.