Skip to content

Commit

Permalink
Merge pull request #21 from alonkeyval/setup-style-fixes
Browse files Browse the repository at this point in the history
Setup style fixes
  • Loading branch information
alonkeyval authored Aug 25, 2024
2 parents 1b14b3e + 11e95c3 commit 14eac57
Show file tree
Hide file tree
Showing 482 changed files with 16,820 additions and 11,031 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- name: Build Autoscaler Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: false
tags: autoscaler:pr-${{ github.event.number }}
build-args: SERVICE_NAME=autoscaler
Expand All @@ -27,6 +28,7 @@ jobs:
- name: Build Scheduler Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: false
tags: scheduler:pr-${{ github.event.number }}
build-args: SERVICE_NAME=scheduler
Expand All @@ -42,6 +44,7 @@ jobs:
- name: Build Instrumentor Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: false
tags: instrumentor:pr-${{ github.event.number }}
build-args: SERVICE_NAME=instrumentor
Expand All @@ -56,9 +59,12 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Odiglet Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: odiglet/Dockerfile
context: .
push: false
Expand All @@ -79,6 +85,7 @@ jobs:
- name: Build Frontend Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: frontend/Dockerfile
context: .
push: false
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check links

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
check-links:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: lycheeverse/lychee-action@v1.10.0
with:
args: >-
-v -n "*.md" "**/*.md"
--exclude "http://localhost*"
fail: true
8 changes: 7 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
test-scenario:
- "multi-apps"
- "helm-chart"
- "fe-synthetic"
- "cli-upgrade"
include:
- kube-version: "1.23"
kind-image: "kindest/node:v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3"
Expand All @@ -44,13 +46,17 @@ jobs:
with:
version: v3.9.0
- name: Install chainsaw
uses: kyverno/action-install-chainsaw@v0.2.4
uses: kyverno/action-install-chainsaw@v0.2.8
- name: Create Kind Cluster
uses: helm/kind-action@v1.10.0
with:
node_image: ${{ matrix.kind-image }}
version: "v0.23.0"
cluster_name: kind
- name: Install FE
run: |
cd frontend/webapp
yarn install
- name: Build CLI
run: |
cd cli
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/publish-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos go modules tagged successfully", "tag":"${{ steps.extract_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
if: ${{ failure() || cancelled() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down Expand Up @@ -137,7 +137,9 @@ jobs:
with:
push: true
tags: keyval/odigos-${{ matrix.service }}:${{ steps.extract_tag.outputs.tag }}
build-args: SERVICE_NAME=${{ matrix.service }}
build-args: |
SERVICE_NAME=${{ matrix.service }}
ODIGOS_VERSION=${{ steps.extract_tag.outputs.tag }}
platforms: linux/amd64,linux/arm64
file: >-
${{
Expand All @@ -159,7 +161,7 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos component ${{ matrix.service }} released successfully", "tag":"${{ steps.extract_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
if: ${{ failure() || cancelled() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down Expand Up @@ -215,7 +217,7 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos collector linux packages released successfully", "tag":"${{ steps.extract_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
if: ${{ failure() || cancelled() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Verify Components Image Ready
run: |
declare -a REPOS=("odigos-autoscaler" "odigos-scheduler" "odigos-instrumentor" "odigos-odiglet" "odigos-collector" "odigos-enterprise-odiglet")
declare -a REPOS=("odigos-autoscaler" "odigos-scheduler" "odigos-instrumentor" "odigos-odiglet" "odigos-collector" "odigos-enterprise-odiglet" "odigos-ui")
TAG_TO_CHECK=${{ env.TAG }}
for REPO in "${REPOS[@]}"; do
Expand Down Expand Up @@ -89,6 +89,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}

# TODO: Remove once we are ready to fully sunset managing charts in a separate repo
- name: Trigger Release PR in Odigos Charts
run: |
curl -X POST \
Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos CLI released successfully. new version is ready", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
if: ${{ failure() || cancelled() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-collector-ocb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.3"
go-version: "1.22.6"
- name: Generate collector with ocb
working-directory: ./collector
run: "make genodigoscol"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.DS_Store
go.work.sum
cli/odigos
.venv
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ changelog:
- "^docs:"
- "^test:"
brews:
- tap:
- repository:
owner: keyval-dev
name: homebrew-odigos-cli
token: "{{ .Env.HOMEBREW_GITHUB_API_TOKEN }}"
Expand Down
10 changes: 1 addition & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
"cwd": "${workspaceFolder}/frontend",
"args": ["--port", "8085", "--address", "0.0.0.0"]
},
{
"name": "gql-playground",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/frontend/main.go",
"cwd": "${workspaceFolder}/frontend"
},
{
"name": "autoscaler local",
"type": "go",
Expand All @@ -44,7 +36,7 @@
"program": "${workspaceFolder}/autoscaler",
"cwd": "${workspaceFolder}/autoscaler",
"env": {
"ODIGOS_VERSION": "v1.0.71"
"ODIGOS_VERSION": "v1.0.90"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.22 as builder
FROM --platform=$BUILDPLATFORM golang:1.22 AS builder
ARG SERVICE_NAME

# Copyy local modules required by the build
Expand All @@ -21,7 +21,7 @@ RUN go mod tidy
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOARCH=$TARGETARCH \
go build -a -o /workspace/build/$SERVICE_NAME main.go
go build -a -o /workspace/build/$SERVICE_NAME .

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,8 @@ cli-install:
@echo "Installing odigos from source. version: $(ODIGOS_CLI_VERSION)"
go run -tags=embed_manifests ./cli 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/odigos-io/odigos/actions/workflows/publish-cli.yml" target="_blank">
<img src="https://github.com/odigos-io/odigos/actions/workflows/publish-cli.yml/badge.svg" alt="Release Odigos CLI" style="margin-right: 10px; border: 1px solid #007acc; border-radius: 4px; padding: 5px;">
<a href="https://github.com/odigos-io/odigos/actions/workflows/release.yml" target="_blank">
<img src="https://github.com/odigos-io/odigos/actions/workflows/release.yml/badge.svg" alt="Release Odigos CLI" style="margin-right: 10px; border: 1px solid #007acc; border-radius: 4px; padding: 5px;">
</a>
<a href="https://goreportcard.com/report/github.com/odigos-io/odigos/cli" target="_blank">
<img src="https://goreportcard.com/badge/github.com/odigos-io/odigos/cli" alt="Go Report Card" style="margin-right: 10px; border: 1px solid #4CAF50; border-radius: 4px; padding: 5px;">
Expand Down
23 changes: 23 additions & 0 deletions agents/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,26 @@
Odigos distribution of OpenTelemetry for Python

This package is used in the odigos project to provide auto OpenTelemetry instrumentation for applications written in Python.


## Local development of `odigos-opentelemetry-python`
1. Navigate to the Project Directory:
Open a new terminal and move to the directory containing odigos-opentelemetry-python:
```sh
cd <ODIGOS-OPENTELEMETRY-PYTHON-PATH>
```
2. Start the Local PyPI Server:
Build and run a local PyPI server with the following command:
```sh
docker build -t local-pypi-server -f debug.Dockerfile . && docker run --rm --name pypi-server -p 8080:8080 local-pypi-server
```
- Note: You need to run the Docker build command each time you make changes to odigos-opentelemetry-python.

3. Update the Development Configuration:
In the `odigos/agents/python/setup.py` file, uncomment the DEV index-url to point to the local PyPI server.

4. Deploy the Odiglet:
Finally, deploy the Odiglet by running:
```sh
make deploy-odiglet <VERSION>
```
87 changes: 10 additions & 77 deletions agents/python/configurator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,82 +1,15 @@
import threading
import atexit
import os
import opentelemetry.sdk._configuration as sdk_config
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.resources import ProcessResourceDetector, OTELResourceDetector
from .lib_handling import reorder_python_path, reload_distro_modules
from .version import VERSION
from opamp.http_client import OpAMPHTTPClient
from initializer.components import initialize_components

class OdigosPythonConfigurator(sdk_config._BaseConfigurator):

def _configure(self, **kwargs):
_initialize_components()


def _initialize_components():
trace_exporters, metric_exporters, log_exporters = sdk_config._import_exporters(
sdk_config._get_exporter_names("traces"),
sdk_config._get_exporter_names("metrics"),
sdk_config._get_exporter_names("logs"),
)

auto_resource = {
"telemetry.distro.name": "odigos",
"telemetry.distro.version": VERSION,
}

resource_attributes_event = threading.Event()
client = start_opamp_client(resource_attributes_event)
resource_attributes_event.wait(timeout=30) # Wait for the resource attributes to be received for 30 seconds

received_value = client.resource_attributes

if received_value:
auto_resource.update(received_value)

resource = Resource.create(auto_resource) \
.merge(OTELResourceDetector().detect()) \
.merge(ProcessResourceDetector().detect())

initialize_traces_if_enabled(trace_exporters, resource)
initialize_metrics_if_enabled(metric_exporters, resource)
initialize_logging_if_enabled(log_exporters, resource)

MINIMUM_PYTHON_SUPPORTED_VERSION = (3, 8)

# Reorder the python sys.path to ensure that the user application's dependencies take precedence over the agent's dependencies.
# This is necessary because the user application's dependencies may be incompatible with those used by the agent.
reorder_python_path()
# Reload distro modules to ensure the new path is used.
reload_distro_modules()

def initialize_traces_if_enabled(trace_exporters, resource):
traces_enabled = os.getenv(sdk_config.OTEL_TRACES_EXPORTER, "none").strip().lower()
if traces_enabled != "none":
id_generator_name = sdk_config._get_id_generator()
id_generator = sdk_config._import_id_generator(id_generator_name)
sdk_config._init_tracing(exporters=trace_exporters, id_generator=id_generator, resource=resource)

def initialize_metrics_if_enabled(metric_exporters, resource):
metrics_enabled = os.getenv(sdk_config.OTEL_METRICS_EXPORTER, "none").strip().lower()
if metrics_enabled != "none":
sdk_config._init_metrics(metric_exporters, resource)

def initialize_logging_if_enabled(log_exporters, resource):
logging_enabled = os.getenv(sdk_config.OTEL_LOGS_EXPORTER, "none").strip().lower()
if logging_enabled != "none":
sdk_config._init_logging(log_exporters, resource)


def start_opamp_client(event):
condition = threading.Condition(threading.Lock())
client = OpAMPHTTPClient(event, condition)
client.start()
class OdigosPythonConfigurator(sdk_config._BaseConfigurator):

def shutdown():
client.shutdown()

# Ensure that the shutdown function is called on program exit
atexit.register(shutdown)

return client
def _configure(self, **kwargs):
trace_exporters, metric_exporters, log_exporters = sdk_config._import_exporters(
sdk_config._get_exporter_names("traces"),
sdk_config._get_exporter_names("metrics"),
sdk_config._get_exporter_names("logs"),
)
initialize_components(trace_exporters, metric_exporters, log_exporters)
34 changes: 0 additions & 34 deletions agents/python/configurator/lib_handling.py

This file was deleted.

Loading

0 comments on commit 14eac57

Please sign in to comment.