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

Load environment variables as options for opentelemetry-instrument #1969

Merged
merged 14 commits into from
Sep 29, 2021

Conversation

ocelotl
Copy link
Contributor

@ocelotl ocelotl commented Jul 19, 2021

Fixes #1968

This PR makes all OTEL_-prefixed environment variables to be loaded as options for opentelemetry-instrument.

The opentelemetry-instrument --help command now shows this:

usage: opentelemetry-instrument [-h]
                                [--OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT]
                                [--OTEL_BSP_EXPORT_TIMEOUT OTEL_BSP_EXPORT_TIMEOUT]
                                [--OTEL_BSP_MAX_EXPORT_BATCH_SIZE OTEL_BSP_MAX_EXPORT_BATCH_SIZE]
                                [--OTEL_BSP_MAX_QUEUE_SIZE OTEL_BSP_MAX_QUEUE_SIZE]
                                [--OTEL_BSP_SCHEDULE_DELAY OTEL_BSP_SCHEDULE_DELAY]
                                [--OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT]
                                [--OTEL_EXPORTER_JAEGER_AGENT_HOST OTEL_EXPORTER_JAEGER_AGENT_HOST]
                                [--OTEL_EXPORTER_JAEGER_AGENT_PORT OTEL_EXPORTER_JAEGER_AGENT_PORT]
                                [--OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES]
                                [--OTEL_EXPORTER_JAEGER_CERTIFICATE OTEL_EXPORTER_JAEGER_CERTIFICATE]
                                [--OTEL_EXPORTER_JAEGER_ENDPOINT OTEL_EXPORTER_JAEGER_ENDPOINT]
                                [--OTEL_EXPORTER_JAEGER_PASSWORD OTEL_EXPORTER_JAEGER_PASSWORD]
                                [--OTEL_EXPORTER_JAEGER_TIMEOUT OTEL_EXPORTER_JAEGER_TIMEOUT]
                                [--OTEL_EXPORTER_JAEGER_USER OTEL_EXPORTER_JAEGER_USER]
                                [--OTEL_EXPORTER_OTLP_CERTIFICATE OTEL_EXPORTER_OTLP_CERTIFICATE]
                                [--OTEL_EXPORTER_OTLP_COMPRESSION OTEL_EXPORTER_OTLP_COMPRESSION]
                                [--OTEL_EXPORTER_OTLP_ENDPOINT OTEL_EXPORTER_OTLP_ENDPOINT]
                                [--OTEL_EXPORTER_OTLP_HEADERS OTEL_EXPORTER_OTLP_HEADERS]
                                [--OTEL_EXPORTER_OTLP_PROTOCOL OTEL_EXPORTER_OTLP_PROTOCOL]
                                [--OTEL_EXPORTER_OTLP_TIMEOUT OTEL_EXPORTER_OTLP_TIMEOUT]
                                [--OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE]
                                [--OTEL_EXPORTER_OTLP_TRACES_COMPRESSION OTEL_EXPORTER_OTLP_TRACES_COMPRESSION]
                                [--OTEL_EXPORTER_OTLP_TRACES_ENDPOINT OTEL_EXPORTER_OTLP_TRACES_ENDPOINT]
                                [--OTEL_EXPORTER_OTLP_TRACES_HEADERS OTEL_EXPORTER_OTLP_TRACES_HEADERS]
                                [--OTEL_EXPORTER_OTLP_TRACES_PROTOCOL OTEL_EXPORTER_OTLP_TRACES_PROTOCOL]
                                [--OTEL_EXPORTER_OTLP_TRACES_TIMEOUT OTEL_EXPORTER_OTLP_TRACES_TIMEOUT]
                                [--OTEL_EXPORTER_ZIPKIN_ENDPOINT OTEL_EXPORTER_ZIPKIN_ENDPOINT]
                                [--OTEL_EXPORTER_ZIPKIN_TIMEOUT OTEL_EXPORTER_ZIPKIN_TIMEOUT]
                                [--OTEL_LINK_ATTRIBUTE_COUNT_LIMIT OTEL_LINK_ATTRIBUTE_COUNT_LIMIT]
                                [--OTEL_LOG_LEVEL OTEL_LOG_LEVEL]
                                [--OTEL_RESOURCE_ATTRIBUTES OTEL_RESOURCE_ATTRIBUTES]
                                [--OTEL_SERVICE_NAME OTEL_SERVICE_NAME]
                                [--OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT]
                                [--OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT]
                                [--OTEL_SPAN_EVENT_COUNT_LIMIT OTEL_SPAN_EVENT_COUNT_LIMIT]
                                [--OTEL_SPAN_LINK_COUNT_LIMIT OTEL_SPAN_LINK_COUNT_LIMIT]
                                [--OTEL_TRACES_SAMPLER OTEL_TRACES_SAMPLER]
                                [--OTEL_TRACES_SAMPLER_ARG OTEL_TRACES_SAMPLER_ARG]
                                [--OTEL_PYTHON_DISABLED_INSTRUMENTATIONS OTEL_PYTHON_DISABLED_INSTRUMENTATIONS]
                                [--OTEL_PROPAGATORS OTEL_PROPAGATORS]
                                [--OTEL_PYTHON_CONTEXT OTEL_PYTHON_CONTEXT]
                                [--OTEL_PYTHON_ID_GENERATOR OTEL_PYTHON_ID_GENERATOR]
                                [--OTEL_PYTHON_TRACER_PROVIDER OTEL_PYTHON_TRACER_PROVIDER]
                                [--OTEL_TRACES_EXPORTER OTEL_TRACES_EXPORTER]
                                command ...

opentelemetry-instrument automatically instruments a Python program and its
dependencies and then runs the program.

positional arguments:
  command               Your Python application.
  command_args          Arguments for your application.

optional arguments:
  -h, --help            show this help message and exit
  --OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT
  --OTEL_BSP_EXPORT_TIMEOUT OTEL_BSP_EXPORT_TIMEOUT
  --OTEL_BSP_MAX_EXPORT_BATCH_SIZE OTEL_BSP_MAX_EXPORT_BATCH_SIZE
  --OTEL_BSP_MAX_QUEUE_SIZE OTEL_BSP_MAX_QUEUE_SIZE
  --OTEL_BSP_SCHEDULE_DELAY OTEL_BSP_SCHEDULE_DELAY
  --OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT
  --OTEL_EXPORTER_JAEGER_AGENT_HOST OTEL_EXPORTER_JAEGER_AGENT_HOST
  --OTEL_EXPORTER_JAEGER_AGENT_PORT OTEL_EXPORTER_JAEGER_AGENT_PORT
  --OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES
  --OTEL_EXPORTER_JAEGER_CERTIFICATE OTEL_EXPORTER_JAEGER_CERTIFICATE
  --OTEL_EXPORTER_JAEGER_ENDPOINT OTEL_EXPORTER_JAEGER_ENDPOINT
  --OTEL_EXPORTER_JAEGER_PASSWORD OTEL_EXPORTER_JAEGER_PASSWORD
  --OTEL_EXPORTER_JAEGER_TIMEOUT OTEL_EXPORTER_JAEGER_TIMEOUT
  --OTEL_EXPORTER_JAEGER_USER OTEL_EXPORTER_JAEGER_USER
  --OTEL_EXPORTER_OTLP_CERTIFICATE OTEL_EXPORTER_OTLP_CERTIFICATE
  --OTEL_EXPORTER_OTLP_COMPRESSION OTEL_EXPORTER_OTLP_COMPRESSION
  --OTEL_EXPORTER_OTLP_ENDPOINT OTEL_EXPORTER_OTLP_ENDPOINT
  --OTEL_EXPORTER_OTLP_HEADERS OTEL_EXPORTER_OTLP_HEADERS
  --OTEL_EXPORTER_OTLP_PROTOCOL OTEL_EXPORTER_OTLP_PROTOCOL
  --OTEL_EXPORTER_OTLP_TIMEOUT OTEL_EXPORTER_OTLP_TIMEOUT
  --OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE
  --OTEL_EXPORTER_OTLP_TRACES_COMPRESSION OTEL_EXPORTER_OTLP_TRACES_COMPRESSION
  --OTEL_EXPORTER_OTLP_TRACES_ENDPOINT OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
  --OTEL_EXPORTER_OTLP_TRACES_HEADERS OTEL_EXPORTER_OTLP_TRACES_HEADERS
  --OTEL_EXPORTER_OTLP_TRACES_PROTOCOL OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
  --OTEL_EXPORTER_OTLP_TRACES_TIMEOUT OTEL_EXPORTER_OTLP_TRACES_TIMEOUT
  --OTEL_EXPORTER_ZIPKIN_ENDPOINT OTEL_EXPORTER_ZIPKIN_ENDPOINT
  --OTEL_EXPORTER_ZIPKIN_TIMEOUT OTEL_EXPORTER_ZIPKIN_TIMEOUT
  --OTEL_LINK_ATTRIBUTE_COUNT_LIMIT OTEL_LINK_ATTRIBUTE_COUNT_LIMIT
  --OTEL_LOG_LEVEL OTEL_LOG_LEVEL
  --OTEL_RESOURCE_ATTRIBUTES OTEL_RESOURCE_ATTRIBUTES
  --OTEL_SERVICE_NAME OTEL_SERVICE_NAME
  --OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT
  --OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT
  --OTEL_SPAN_EVENT_COUNT_LIMIT OTEL_SPAN_EVENT_COUNT_LIMIT
  --OTEL_SPAN_LINK_COUNT_LIMIT OTEL_SPAN_LINK_COUNT_LIMIT
  --OTEL_TRACES_SAMPLER OTEL_TRACES_SAMPLER
  --OTEL_TRACES_SAMPLER_ARG OTEL_TRACES_SAMPLER_ARG
  --OTEL_PYTHON_DISABLED_INSTRUMENTATIONS OTEL_PYTHON_DISABLED_INSTRUMENTATIONS
  --OTEL_PROPAGATORS OTEL_PROPAGATORS
  --OTEL_PYTHON_CONTEXT OTEL_PYTHON_CONTEXT
  --OTEL_PYTHON_ID_GENERATOR OTEL_PYTHON_ID_GENERATOR
  --OTEL_PYTHON_TRACER_PROVIDER OTEL_PYTHON_TRACER_PROVIDER
  --OTEL_TRACES_EXPORTER OTEL_TRACES_EXPORTER

@ocelotl ocelotl added the Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary label Jul 19, 2021
@ocelotl ocelotl self-assigned this Jul 19, 2021
@ocelotl ocelotl requested review from a team, owais and lzchen and removed request for a team July 19, 2021 03:24
@ocelotl ocelotl force-pushed the issue_1968 branch 3 times, most recently from f5f888f to 4c1463f Compare July 19, 2021 03:42
@owais
Copy link
Contributor

owais commented Jul 19, 2021

I feel like we might be abusing the plugin (entry point) system here a bit too much. Do we know what are performance hits this could result in? It is constant or linear with the size of your site-packages directory? For environments like Lamba, these things might add up and incur a significant startup penalty.

Other than this, I also have concerns about documentation, UX and stability guarantees. How and where do we document env variables if this package is dynamically "sourced" from other packages that may or may not be installed?

If an env variable is defined in let's say opentelemetry.sdk.env,

  • Do we document it in the SDK docs or the env variable package docs?
  • If we document in SDK docs and users are supposed to import from there, why even make it available in enviroment_variables package?
  • What about unstable packages like opentelemetry-instrumentation or some other 3rd party package, they can essentially affect the public interface of the environment_variables package meaning this package can never get to 1.0 and it can cause surprises.

I think it would be very surprising if as a user, I import something from opentelemetry.environment_variables package in my service and it results in an import error in future because another seemingly unrelated package was uninstalled/replaced/upgraded.

It generally feels a bit too magical and I personally don't think it is worth just to have a common import path.

BTW do we really not know all packages that we want to source environment variables from? It feels like we should know that and should be able to import with a try..except if we really wanted to dynamically generate this package.

@ocelotl ocelotl force-pushed the issue_1968 branch 2 times, most recently from b5661f4 to 0dead19 Compare August 25, 2021 15:51
@ocelotl ocelotl changed the title Make opentelemetry.environment_variables a single namespace Load environment variables as options for opentelemetry-instrument Aug 25, 2021
@ocelotl
Copy link
Contributor Author

ocelotl commented Aug 25, 2021

It is in theory possible to include each environment variable documentation as the command option help by using the documentation defined for every declared environment variable. For example, the `OTEL_RESOURCE_ATTRIBUTES has the following documentation:

.. envvar:: OTEL_RESOURCE_ATTRIBUTES
The :envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable allows resource
attributes to be passed to the SDK at process invocation. The attributes from
:envvar:`OTEL_RESOURCE_ATTRIBUTES` are merged with those passed to
`Resource.create`, meaning :envvar:`OTEL_RESOURCE_ATTRIBUTES` takes *lower*
priority. Attributes should be in the format ``key1=value1,key2=value2``.
Additional details are available `in the specification
<https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable>`__.
.. code-block:: console
    $ OTEL_RESOURCE_ATTRIBUTES="service.name=shoppingcard,will_be_overridden=foo" python - <<EOF
    import pprint
    from opentelemetry.sdk.resources import Resource
    pprint.pprint(Resource.create({"will_be_overridden": "bar"}).attributes)
    EOF
    {'service.name': 'shoppingcard',
    'telemetry.sdk.language': 'python',
    'telemetry.sdk.name': 'opentelemetry',
    'telemetry.sdk.version': '0.13.dev0',
    'will_be_overridden': 'bar'}

That documentation could be added to the command option help. Of course the formatting won't be ideal, but maybe a solution can be found. Just pointing this out to give you all the complete picture.

@owais
Copy link
Contributor

owais commented Sep 14, 2021

Should we lower case the vars as a convention? All caps args feel a bit weird.

@ocelotl
Copy link
Contributor Author

ocelotl commented Sep 15, 2021

Should we lower case the vars as a convention? All caps args feel a bit weird.

But all caps matches the environment variables exactly 😎

@owais
Copy link
Contributor

owais commented Sep 15, 2021

Sure, but is that such a big deal? If we were to do this manually to create CLI arg counter-parts for all env vars, we wouldn't use all caps, right?

IMO the fact that we source these args from the environment variables module is just a technical detail. Env vars and CLI args both could be sourced from another "config" module or a YAML file. In that case we wouldn't use all caps I think. So IMO we shouldn't let the fact that the code fetches these from env vars affect the casing of cli args. I feel like each config mechanism following established patterns would be better. That said, not a huge deal for me.

@owais
Copy link
Contributor

owais commented Sep 15, 2021

Actually, now that I think more about it, do we even need the OTEL_ prefix for cli args? It is a neccessity for env vars because env can be global to a system so we "namespace" the vars to avoid conflicts with other unrelated systems. That certainly is not an issue for CLI args. We wouldn't design something like opentelemetry-insrument --otel-resource-attributes="" --otel-service-name="svc-name" if we did this manually, right? That would be redundant. It'd instead be opentelemetry-instrument --resource-attributes="" --service-name="".

@codeboten
Copy link
Contributor

I find the lower case flags easier to process as a user, regardless of the fact that the uppercase variables match the environment variables. I also agree with @owais that removing as much duplication as possible in the name of the arguments makes sense if we want this to be user friendly. It would be easy enough for the help to show what env variable can be used to override any of the flags if we're concerned about the discrepancy there.

@ocelotl
Copy link
Contributor Author

ocelotl commented Sep 17, 2021

Added the requested changes, now the help looks like this:

usage: opentelemetry-instrument [-h]
                                [--attribute_value_length_limit ATTRIBUTE_VALUE_LENGTH_LIMIT]
                                [--bsp_export_timeout BSP_EXPORT_TIMEOUT]
                                [--bsp_max_export_batch_size BSP_MAX_EXPORT_BATCH_SIZE]
                                [--bsp_max_queue_size BSP_MAX_QUEUE_SIZE]
                                [--bsp_schedule_delay BSP_SCHEDULE_DELAY]
                                [--event_attribute_count_limit EVENT_ATTRIBUTE_COUNT_LIMIT]
                                [--exporter_jaeger_agent_host EXPORTER_JAEGER_AGENT_HOST]
                                [--exporter_jaeger_agent_port EXPORTER_JAEGER_AGENT_PORT]
                                [--exporter_jaeger_agent_split_oversized_batches EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES]
                                [--exporter_jaeger_certificate EXPORTER_JAEGER_CERTIFICATE]
                                [--exporter_jaeger_endpoint EXPORTER_JAEGER_ENDPOINT]
                                [--exporter_jaeger_password EXPORTER_JAEGER_PASSWORD]
                                [--exporter_jaeger_timeout EXPORTER_JAEGER_TIMEOUT]
                                [--exporter_jaeger_user EXPORTER_JAEGER_USER]
                                [--exporter_otlp_certificate EXPORTER_OTLP_CERTIFICATE]
                                [--exporter_otlp_compression EXPORTER_OTLP_COMPRESSION]
                                [--exporter_otlp_endpoint EXPORTER_OTLP_ENDPOINT]
                                [--exporter_otlp_headers EXPORTER_OTLP_HEADERS]
                                [--exporter_otlp_protocol EXPORTER_OTLP_PROTOCOL]
                                [--exporter_otlp_timeout EXPORTER_OTLP_TIMEOUT]
                                [--exporter_otlp_traces_certificate EXPORTER_OTLP_TRACES_CERTIFICATE]
                                [--exporter_otlp_traces_compression EXPORTER_OTLP_TRACES_COMPRESSION]
                                [--exporter_otlp_traces_endpoint EXPORTER_OTLP_TRACES_ENDPOINT]
                                [--exporter_otlp_traces_headers EXPORTER_OTLP_TRACES_HEADERS]
                                [--exporter_otlp_traces_protocol EXPORTER_OTLP_TRACES_PROTOCOL]
                                [--exporter_otlp_traces_timeout EXPORTER_OTLP_TRACES_TIMEOUT]
                                [--exporter_zipkin_endpoint EXPORTER_ZIPKIN_ENDPOINT]
                                [--exporter_zipkin_timeout EXPORTER_ZIPKIN_TIMEOUT]
                                [--link_attribute_count_limit LINK_ATTRIBUTE_COUNT_LIMIT]
                                [--log_level LOG_LEVEL]
                                [--resource_attributes RESOURCE_ATTRIBUTES]
                                [--service_name SERVICE_NAME]
                                [--span_attribute_count_limit SPAN_ATTRIBUTE_COUNT_LIMIT]
                                [--span_attribute_value_length_limit SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT]
                                [--span_event_count_limit SPAN_EVENT_COUNT_LIMIT]
                                [--span_link_count_limit SPAN_LINK_COUNT_LIMIT]
                                [--traces_sampler TRACES_SAMPLER]
                                [--traces_sampler_arg TRACES_SAMPLER_ARG]
                                [--disabled_instrumentations DISABLED_INSTRUMENTATIONS]
                                [--propagators PROPAGATORS]
                                [--context CONTEXT]
                                [--id_generator ID_GENERATOR]
                                [--tracer_provider TRACER_PROVIDER]
                                [--traces_exporter TRACES_EXPORTER]
                                command ...

opentelemetry-instrument automatically instruments a Python program and its
dependencies and then runs the program.

positional arguments:
  command               Your Python application.
  command_args          Arguments for your application.

optional arguments:
  -h, --help            show this help message and exit
  --attribute_value_length_limit ATTRIBUTE_VALUE_LENGTH_LIMIT
  --bsp_export_timeout BSP_EXPORT_TIMEOUT
  --bsp_max_export_batch_size BSP_MAX_EXPORT_BATCH_SIZE
  --bsp_max_queue_size BSP_MAX_QUEUE_SIZE
  --bsp_schedule_delay BSP_SCHEDULE_DELAY
  --event_attribute_count_limit EVENT_ATTRIBUTE_COUNT_LIMIT
  --exporter_jaeger_agent_host EXPORTER_JAEGER_AGENT_HOST
  --exporter_jaeger_agent_port EXPORTER_JAEGER_AGENT_PORT
  --exporter_jaeger_agent_split_oversized_batches EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES
  --exporter_jaeger_certificate EXPORTER_JAEGER_CERTIFICATE
  --exporter_jaeger_endpoint EXPORTER_JAEGER_ENDPOINT
  --exporter_jaeger_password EXPORTER_JAEGER_PASSWORD
  --exporter_jaeger_timeout EXPORTER_JAEGER_TIMEOUT
  --exporter_jaeger_user EXPORTER_JAEGER_USER
  --exporter_otlp_certificate EXPORTER_OTLP_CERTIFICATE
  --exporter_otlp_compression EXPORTER_OTLP_COMPRESSION
  --exporter_otlp_endpoint EXPORTER_OTLP_ENDPOINT
  --exporter_otlp_headers EXPORTER_OTLP_HEADERS
  --exporter_otlp_protocol EXPORTER_OTLP_PROTOCOL
  --exporter_otlp_timeout EXPORTER_OTLP_TIMEOUT
  --exporter_otlp_traces_certificate EXPORTER_OTLP_TRACES_CERTIFICATE
  --exporter_otlp_traces_compression EXPORTER_OTLP_TRACES_COMPRESSION
  --exporter_otlp_traces_endpoint EXPORTER_OTLP_TRACES_ENDPOINT
  --exporter_otlp_traces_headers EXPORTER_OTLP_TRACES_HEADERS
  --exporter_otlp_traces_protocol EXPORTER_OTLP_TRACES_PROTOCOL
  --exporter_otlp_traces_timeout EXPORTER_OTLP_TRACES_TIMEOUT
  --exporter_zipkin_endpoint EXPORTER_ZIPKIN_ENDPOINT
  --exporter_zipkin_timeout EXPORTER_ZIPKIN_TIMEOUT
  --link_attribute_count_limit LINK_ATTRIBUTE_COUNT_LIMIT
  --log_level LOG_LEVEL
  --resource_attributes RESOURCE_ATTRIBUTES
  --service_name SERVICE_NAME
  --span_attribute_count_limit SPAN_ATTRIBUTE_COUNT_LIMIT
  --span_attribute_value_length_limit SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT
  --span_event_count_limit SPAN_EVENT_COUNT_LIMIT
  --span_link_count_limit SPAN_LINK_COUNT_LIMIT
  --traces_sampler TRACES_SAMPLER
  --traces_sampler_arg TRACES_SAMPLER_ARG
  --disabled_instrumentations DISABLED_INSTRUMENTATIONS
  --propagators PROPAGATORS
  --context CONTEXT
  --id_generator ID_GENERATOR
  --tracer_provider TRACER_PROVIDER
  --traces_exporter TRACES_EXPORTER

Optional arguments (except for --help) for opentelemetry-instrument directly
correspond with OpenTelemetry environment variables. The corresponding
optional argument is formed by removing the OTEL_ or OTEL_PYTHON_ prefix from
the environment variable and lower casing the rest. For example, the optional
argument --attribute_value_length_limit corresponds with the environment
variable OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT. These optional arguments will
override the current value of the corresponding environment variable during
the execution of the command.

Copy link
Contributor

@owais owais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Left a minor documentation comment.

@lzchen lzchen merged commit 18b5cb0 into open-telemetry:main Sep 29, 2021
adamantike added a commit to adamantike/opentelemetry-python-contrib that referenced this pull request Oct 15, 2021
Since the change in `opentelemetry-instrument` to understand
environment variables [0], the options documented in this README file
are outdated.

[0] open-telemetry/opentelemetry-python#1969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make environment variables accessible from a central place
4 participants