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

OpenTelemetry Tracing #26

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
806d206
initial commit
aMahanna Nov 23, 2023
d0d66b7
fix `pip install`
aMahanna Nov 23, 2023
b2100a5
fix pip install
aMahanna Nov 23, 2023
f173fc6
fix pip install
aMahanna Nov 23, 2023
5734076
parameterize otlp endpoint
aMahanna Nov 23, 2023
e778392
fix: `otlp_endpoint` param
aMahanna Nov 23, 2023
82e0e3d
fix: `span_exporters` param
aMahanna Nov 23, 2023
123e6d6
cleanup
aMahanna Nov 23, 2023
4e2b3f0
Update README.md
aMahanna Nov 23, 2023
9ca93bd
new: `TracingManager.set_attributes()`
aMahanna Nov 30, 2023
d549251
early exit for `with_tracing`
aMahanna Dec 3, 2023
eeb9a7a
cleanup tracer import
aMahanna Dec 3, 2023
bba46cd
new: `benchmark` dir
aMahanna Dec 5, 2023
68e68a3
cleanup `tests`
aMahanna Dec 5, 2023
c374534
Create benchmark.yml
aMahanna Dec 5, 2023
cde8808
Update .gitignore
aMahanna Dec 5, 2023
2f5c23a
Update benchmark.yml
aMahanna Dec 5, 2023
bc89200
Update benchmark.yml
aMahanna Dec 5, 2023
f0352c4
Update benchmark.yml
aMahanna Dec 5, 2023
19dd073
fix lint
aMahanna Dec 5, 2023
261d224
cleanup
aMahanna Dec 5, 2023
10b1d6c
Update benchmark.yml
aMahanna Dec 5, 2023
e08b111
Update benchmark.yml
aMahanna Dec 5, 2023
aff682e
Update benchmark.yml
aMahanna Dec 5, 2023
eee8128
Merge branch 'master' into tracing
aMahanna Dec 16, 2023
83672c5
cleanup tracing, new spans, new attributes
aMahanna Dec 16, 2023
9e2fa4c
cleanup: `benchmark`
aMahanna Dec 16, 2023
2e9151d
add `retry` dev dependency
aMahanna Dec 16, 2023
3260723
fix: `__set_adb_data`
aMahanna Dec 16, 2023
bca1b1d
fix: `improvement`
aMahanna Dec 16, 2023
c5cb4c0
update benchmark.yml
aMahanna Dec 16, 2023
8382e8b
cleanup: `benchmark`
aMahanna Dec 16, 2023
0ed2071
install `tracing` dependencies in `build.yml`
aMahanna Dec 16, 2023
de4a1a7
pragma no cover
aMahanna Dec 16, 2023
78a88de
update `master` traces
aMahanna Dec 23, 2023
f3e268a
update `benchmark/write.py`
aMahanna Dec 23, 2023
38dd8ef
cleanup compare.py
aMahanna Dec 23, 2023
a685637
tracing cleanup
aMahanna Dec 23, 2023
63ee345
cleanup tracing (again)
aMahanna Dec 23, 2023
c81fbc5
fix `compare.py`
aMahanna Dec 23, 2023
cf95b8a
new master traces
aMahanna Dec 23, 2023
b3eeb86
pragma no cover
aMahanna Dec 23, 2023
265c3b2
Update benchmark.yml
aMahanna Dec 23, 2023
a856796
Update benchmark.yml
aMahanna Dec 23, 2023
ae3b12a
jq
aMahanna Dec 23, 2023
2399b85
Update benchmark.yml
aMahanna Dec 23, 2023
85a0865
Update benchmark.yml
aMahanna Dec 23, 2023
cbb6392
Update benchmark.yml
aMahanna Dec 23, 2023
fc6b149
Update benchmark.yml
aMahanna Dec 23, 2023
d2a46c3
fix typo
aMahanna Dec 23, 2023
42976c4
Update benchmark.yml
aMahanna Dec 23, 2023
ef6a746
jq
aMahanna Dec 23, 2023
12adb6e
Update benchmark.yml
aMahanna Dec 23, 2023
ced88ab
Update benchmark.yml
aMahanna Dec 23, 2023
a9d9249
Update benchmark.yml
aMahanna Dec 23, 2023
28629ef
fix double quotes
aMahanna Dec 23, 2023
dc0e031
Update write.py
aMahanna Dec 23, 2023
17c4995
cleanup
aMahanna Dec 23, 2023
62efe15
cleanup `compare.py`
aMahanna Dec 23, 2023
bc50b6f
update benchmark readme files
aMahanna Dec 23, 2023
3d0e3de
new: `continue-on-error`
aMahanna Jan 18, 2024
ddbd331
fix: custom span names for `@with_tracing` decorator
aMahanna Jan 18, 2024
704cbba
cleanup: `__fetch_adb_docs`
aMahanna Jan 19, 2024
bd3e06c
fix private method span names
aMahanna Jan 19, 2024
0744148
regenerate "master" traces
aMahanna Jan 19, 2024
16ace5c
add README
aMahanna Jan 19, 2024
3f35755
fix benchmark assertions
aMahanna Jan 19, 2024
de16e8d
fix `start_as_current_span`
aMahanna Jan 26, 2024
77b7a81
fix: `operationName`
aMahanna Jan 26, 2024
67378e8
fix: edge_index
aMahanna Feb 9, 2024
d325fd4
Merge branch 'master' into tracing
aMahanna Feb 9, 2024
36e33e5
empty commit to rerun benchmark
aMahanna Feb 9, 2024
91aed84
attempt: insert_many instead of import_bulk
aMahanna Feb 27, 2024
b8a19b3
temp: fix parameters for `insert_many`, skip test
aMahanna Feb 27, 2024
7fb9f67
switch back to `import_bulk`
aMahanna Feb 27, 2024
7c67b70
Merge branch 'master' into tracing
aMahanna Feb 27, 2024
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
146 changes: 146 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: benchmark

on:
workflow_dispatch:
pull_request:
paths:
- "adbpyg_adapter/*.py"
- "benchmark/*.py"
push:
branches:
- master
paths:
- "adbpyg_adapter/*.py"
- "benchmark/*.py"

jobs:
generate_master_traces:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create new branch
run: git checkout -b actions/benchmark

- name: Set branch upstream
run: git push -u origin actions/benchmark
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: setup.py

- name: Start ArangoDB Instance
run: docker run -d --name arangodb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb

- name: Start Jaeger Instance
run: docker run -d --name jaeger --rm -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 9411:9411 jaegertracing/all-in-one:latest

- name: Install packages
run: |
pip install torch==2.1.0
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-$(python -c 'import torch; print(torch.__version__.split("+")[0])')+cpu.html
pip install -e '.[dev, tracing]'

- name: Run Python Script
run: python benchmark/write.py --output_dir master

- name: Echo PyG to ArangoDB
run: cat benchmark/traces/master/pyg_to_arangodb.json | jq .

- name: Echo ArangoDB to PyG
run: cat benchmark/traces/master/arangodb_to_pyg.json | jq .

- name: Make commit for auto-generated benchmark files
uses: EndBug/add-and-commit@v9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
add: "./benchmark/traces/master/*.json"
new_branch: actions/benchmark
message: "generate benchmark files for $GITHUB_SHA"

- name: Create pull request for the auto generated benchmark
run: |
echo "PR_URL=$(gh pr create \
--title "benchmark: $GITHUB_SHA" \
--body "beep boop, i am a robot ($GITHUB_SHA)" \
--label documentation)" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Alert developer of open PR
run: echo "Benchmark $PR_URL is ready to be merged by developer."

compare_traces:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: setup.py

- name: Start ArangoDB Instance
run: docker run -d --name arangodb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb

- name: Start Jaeger Instance
run: docker run -d --name jaeger --rm -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 9411:9411 jaegertracing/all-in-one:latest

- name: Install packages
run: |
pip install torch==2.1.0
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-$(python -c 'import torch; print(torch.__version__.split("+")[0])')+cpu.html
pip install -e '.[dev, tracing]'

- name: Write PR traces
run: python benchmark/write.py --output_dir branch

- name: Compare PR & Master Traces
run: |
echo "ROOT_SPAN_COMPARISON<<EOF" >> $GITHUB_ENV
python benchmark/compare.py >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Prepare PR Comment
run: |
echo 'MESSAGE<<EOF' >> $GITHUB_ENV
echo "Benchmark (${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
echo '' >> $GITHUB_ENV
echo '```json' >> $GITHUB_ENV
echo "$ROOT_SPAN_COMPARISON" | jq . >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo '' >> $GITHUB_ENV
echo "See the full diff [here](https://github.com/arangoml/pyg-adapter/actions/runs/$GITHUB_RUN_ID)" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

- name: Post PR Comment
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const prNumber = context.payload.pull_request.number;
const message = process.env.MESSAGE;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: message
});

- name: Echo Full PyG to ArangoDB Diff
run: cat benchmark/traces/diff/pyg_to_arangodb.json | jq .

- name: Echo Full ArangoDB to PyG Diff
run: cat benchmark/traces/diff/arangodb_to_pyg.json | jq .
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"] # "3.12"
Expand All @@ -34,7 +35,7 @@ jobs:
run: |
pip install torch==2.1.0
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-$(python -c 'import torch; print(torch.__version__.split("+")[0])')+cpu.html
pip install -e .[dev]
pip install -e '.[dev, tracing]'

- name: Run black
run: black --check --verbose --diff --color ${{env.PACKAGE_DIR}} ${{env.TESTS_DIR}}
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,8 @@ adbpyg_adapter/version.py
.vscode

# PyG Data
tests/data/pyg
tests/data/pyg

# "Current" Benchmark Results
benchmark/traces/branch/*.json
benchmark/traces/diff/*.json
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,16 @@ Prerequisite: `arangorestore`
2. `cd pyg-adapter`
3. (create virtual environment of choice)
4. `pip install torch`
5. `pip install -e .[dev]`
5. `pip install -e '.[dev, tracing]'`
6. (create an ArangoDB instance with method of choice)
7. `pytest --url <> --dbName <> --username <> --password <>`

**Note**: A `pytest` parameter can be omitted if the endpoint is using its default value:
**Note**: `pytest` parameters:
```python
def pytest_addoption(parser):
parser.addoption("--url", action="store", default="http://localhost:8529")
parser.addoption("--dbName", action="store", default="_system")
parser.addoption("--username", action="store", default="root")
parser.addoption("--password", action="store", default="")
parser.addoption("--otlp_endpoint", action="append", default=[]) # OpenTelemetry Protocol Exporter endpoint
```
Loading
Loading