Skip to content

Commit cfd9225

Browse files
authored
Add instructions to proto package README (open-telemetry#905)
1 parent ee9d28a commit cfd9225

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

opentelemetry-proto/README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ Installation
1616
Code Generation
1717
---------------
1818

19-
These files were generated automatically. More details on how to generate them
20-
are available here_.
19+
These files were generated automatically from code in opentelemetry-proto_.
20+
To regenerate the code, run ``../scripts/proto_codegen.sh``.
2121

22+
To build against a new release or specific commit of opentelemetry-proto_,
23+
update the ``PROTO_REPO_BRANCH_OR_COMMIT`` variable in
24+
``../scripts/proto_codegen.sh``. Then run the script and commit the changes
25+
as well as any fixes needed in the OTLP exporter.
2226

23-
.. _here: https://github.com/open-telemetry/opentelemetry-proto
27+
.. _opentelemetry-proto: https://github.com/open-telemetry/opentelemetry-proto
2428

2529

2630
References
2731
----------
2832

2933
* `OpenTelemetry Project <https://opentelemetry.io/>`_
3034
* `OpenTelemetry Proto <https://github.com/open-telemetry/opentelemetry-proto>`_
35+
* `proto_codegen.sh script <https://github.com/open-telemetry/opentelemetry-python/blob/master/scripts/proto_codegen.sh>`_

scripts/proto_codegen.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,24 @@ PROTO_REPO_BRANCH_OR_COMMIT="v0.4.0"
1616

1717
set -e
1818

19-
if [ -z "$VIRTUAL_ENV" ]; then
20-
echo '$VIRTUAL_ENV is not set, you probably forgot to source it. Exiting...'
21-
exit 1
22-
fi
23-
2419
PROTO_REPO_DIR=${PROTO_REPO_DIR:-"/tmp/opentelemetry-proto"}
2520
# root of opentelemetry-python repo
2621
repo_root="$(git rev-parse --show-toplevel)"
22+
venv_dir="/tmp/proto_codegen_venv"
23+
24+
# run on exit even if crash
25+
cleanup() {
26+
echo "Deleting $venv_dir"
27+
rm -rf $venv_dir
28+
}
29+
trap cleanup EXIT
2730

28-
python -m pip install -r $repo_root/dev-requirements.txt
31+
echo "Creating temporary virtualenv at $venv_dir using $(python3 --version)"
32+
python3 -m venv $venv_dir
33+
source $venv_dir/bin/activate
34+
python -m pip install \
35+
-c $repo_root/dev-requirements.txt \
36+
grpcio-tools mypy-protobuf
2937

3038
# Clone the proto repo if it doesn't exist
3139
if [ ! -d "$PROTO_REPO_DIR" ]; then

0 commit comments

Comments
 (0)