Skip to content

Commit 9e53939

Browse files
author
Alex Boten
authored
[opentelemetry-instrumentation] add version flag (#1065)
1 parent 6f620ee commit 9e53939

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Refactoring custom header collection API for consistency
1515
([#1064](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1064))
1616

17+
### Added
18+
- `opentelemetry-instrument` and `opentelemetry-bootstrap` now include a `--version` flag
19+
([#1065](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1065))
20+
1721
## [1.11.1-0.30b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.11.1-0.30b1) - 2022-04-21
1822

1923
### Added

opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
from pkg_resources import iter_entry_points
2525

26+
from opentelemetry.instrumentation.version import __version__
27+
2628
_logger = getLogger(__name__)
2729

2830

@@ -34,7 +36,7 @@ def run() -> None:
3436
program and its dependencies and then runs the program.
3537
""",
3638
epilog="""
37-
Optional arguments (except for --help) for opentelemetry-instrument
39+
Optional arguments (except for --help and --version) for opentelemetry-instrument
3840
directly correspond with OpenTelemetry environment variables. The
3941
corresponding optional argument is formed by removing the OTEL_ or
4042
OTEL_PYTHON_ prefix from the environment variable and lower casing the
@@ -66,6 +68,12 @@ def run() -> None:
6668
)
6769
argument_otel_environment_variable[argument] = attribute
6870

71+
parser.add_argument(
72+
"--version",
73+
help="print version information",
74+
action="version",
75+
version="%(prog)s " + __version__,
76+
)
6977
parser.add_argument("command", help="Your Python application.")
7078
parser.add_argument(
7179
"command_args",

opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
default_instrumentations,
2626
libraries,
2727
)
28+
from opentelemetry.instrumentation.version import __version__
2829

2930
logger = logging.getLogger(__name__)
3031

@@ -133,6 +134,12 @@ def run() -> None:
133134
installs the relevant instrumentation packages for them.
134135
"""
135136
)
137+
parser.add_argument(
138+
"--version",
139+
help="print version information",
140+
action="version",
141+
version="%(prog)s " + __version__,
142+
)
136143
parser.add_argument(
137144
"-a",
138145
"--action",

0 commit comments

Comments
 (0)