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

Automatic instrumentation returns: unrecognized arguments: --trace-exporter #2264

Closed
sguillen18 opened this issue Nov 4, 2021 · 16 comments
Closed
Labels
bug Something isn't working

Comments

@sguillen18
Copy link

I'm running python3 following the steps on https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/auto-instrumentation and when I get to the auto-instrumentation part it says to run the following command:

$ opentelemetry-instrument --trace-exporter console_span python server_uninstrumented.py

and i get the following returned:

(auto_instrumentation) seanguillen@MacBook-Pro-3 auto-instrumentation % opentelemetry-instrument --trace-exporter console_span python server_uninstrumented.py
usage: opentelemetry-instrument [-h] [--attribute_count_limit ATTRIBUTE_COUNT_LIMIT]
[--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: error: unrecognized arguments: --trace-exporter

I can't find any information on how to resolve this. Any input would help.

@sguillen18 sguillen18 added the bug Something isn't working label Nov 4, 2021
@owais
Copy link
Contributor

owais commented Nov 4, 2021

This changed recently and was renamed to --traces_exporter console. --help does print it as well which I think you missed :)

@lzchen
Copy link
Contributor

lzchen commented Nov 5, 2021

#2243 this pr updates the docs to reflect these changes.

@ocelotl
Copy link
Contributor

ocelotl commented Nov 9, 2021

Looks like we can close this issue, @owais, @lzchen

@owais owais closed this as completed Nov 9, 2021
@jonathan-s
Copy link

Even if I run opentelemetry-instrument --traces_exporter console python server_uninstrumented.py I get nothing in the console. I believe I should be getting an output at this point, correct? @ocelotl

@lzchen
Copy link
Contributor

lzchen commented Apr 20, 2022

@jonathan-s
Which version of opentelemetry-instrumentation and opentelemetry-api are you using?

@orsan0128
Copy link

Even if I run opentelemetry-instrument --traces_exporter console python server_uninstrumented.py I get nothing in the console. I believe I should be getting an output at this point, correct? @ocelotl

I got the same issue too .
I ran the command opentelemetry-instrument --traces_exporter console python server_uninstrumented.py and followed the otel documentation to try to run python client.py testing but nothing else in the console.

opentelemetry-instrumentation 0.30b1
opentelemetry-api 1.11.1

@srikanthccv
Copy link
Member

@orsan0128 did you install the sdk as well?

@orsan0128
Copy link

orsan0128 commented May 11, 2022

@orsan0128 did you install the sdk as well?

yep ,the opentelemetry-sdk 1.11.1

I tried to downgrade opentelemetry-sdk , opentelemetry-api == 1.8.0
and opentelemetry-instrumentation , opentelemetry-instrumentation-flask , opentelemetry-instrumentation-requests == 0.27b0 .

I try to run command "opentelemetry-instrument --traces_exporter console python server_uninstrumented.py" & "pytheon client.py testing " again and the console output is normally .

@srikanthccv
Copy link
Member

You don't seem to have distro installed. Please install opentelemetry-distro as noted here and let me know if it still doesn't work.

@orsan0128
Copy link

You don't seem to have distro installed. Please install opentelemetry-distro as noted here and let me know if it still doesn't work.

I installed opentelemetry-distro == 0.30b1 too
It still doesn't work .
I have installed the packages listed below:

  • opentelemetry-api==1.11.1
  • opentelemetry-distro==0.30b1
  • opentelemetry-instrumentation==0.30b1
  • opentelemetry-instrumentation-flask==0.30b1
  • opentelemetry-instrumentation-requests==0.30b1
  • opentelemetry-instrumentation-wsgi==0.30b1
  • opentelemetry-propagator-b3==1.11.1
  • opentelemetry-proto==1.11.1
  • opentelemetry-sdk==1.11.1
  • opentelemetry-semantic-conventions==0.30b1
  • opentelemetry-util-http==0.30b1

But I try to downgrade all to 0.27b0 and otel-api , sdk to 1.8.0 and the console output are normally !

ghost referenced this issue in open-telemetry/opentelemetry-python-contrib May 18, 2022
@ghost
Copy link

ghost commented May 18, 2022

I believe I have found the issue for me. I found that 1.10.0-0.29b0 works for me but not 1.11.0-0.30b0. Looking at the sitecustomize.py script, it had a change on 4/21 along with version 1.11.0-0.30b0. I reverted this change specifically, by moving the PYTHONPATH code back to within the "finally" and the span were produced once more. Here is the associated PR. Let me know if this fixed the issue for you as well!

@srikanthccv
Copy link
Member

@jeremyvoss-microsoft The 1.11.0 release had an issue with proto where the some changes made were not fully wire compatible without scope changes. We later release a patch version to fix for it, Are you sure this change is the reason that caused the issue?

@aabmass
Copy link
Member

aabmass commented May 19, 2022

It is working fine for me:

python3 -m venv venv
source venv/bin/activate
pip install flask opentelemetry-instrumentation opentelemetry-distro opentelemetry-instrumentation-flask
curl -O https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/main/docs/examples/auto-instrumentation/server_uninstrumented.py
opentelemetry-instrument --traces_exporter console python server_uninstrumented.py

# separate terminal do `curl localhost:8082/server_request`

 * Serving Flask app 'server_uninstrumented' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
None
{
    "name": "/server_request",
    "context": {
        "trace_id": "0x036a62b07231c51c2cd9fb8db5d8de0b",
        "span_id": "0x46378b949ea3c0fb",
        "trace_state": "[]"
    },
    "kind": "SpanKind.SERVER",
    "parent_id": null,
    "start_time": "2022-05-19T03:18:34.192093Z",
    "end_time": "2022-05-19T03:18:34.193532Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "http.method": "GET",
        "http.server_name": "127.0.0.1",
        "http.scheme": "http",
        "net.host.port": 8082,
        "http.host": "localhost:8082",
        "http.target": "/server_request",
        "net.peer.ip": "127.0.0.1",
        "http.user_agent": "curl/7.82.0",
        "net.peer.port": 33810,
        "http.flavor": "1.1",
        "http.route": "/server_request",
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "opentelemetry",
        "telemetry.sdk.version": "1.12.0rc1",
        "telemetry.auto.version": "0.31b0",
        "service.name": "unknown_service"
    }
}

the exact deps pip pulled in are

$ pip freeze
click==8.1.3
Deprecated==1.2.13
Flask==2.1.2
importlib-metadata==4.11.3
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
opentelemetry-api==1.12.0rc1
opentelemetry-distro==0.31b0
opentelemetry-instrumentation==0.31b0
opentelemetry-instrumentation-flask==0.31b0
opentelemetry-instrumentation-wsgi==0.31b0
opentelemetry-sdk==1.12.0rc1
opentelemetry-semantic-conventions==0.31b0
opentelemetry-util-http==0.31b0
typing_extensions==4.2.0
Werkzeug==2.1.2
wrapt==1.14.1
zipp==3.8.0

It would be great if someone could provide a repro and open a new issue.

@jeremydvoss
Copy link
Contributor

I am on Windows 11. Here are my steps to reproduce:

virtualenv auto_autoinstrumentation 
source auto_instrumentation/Scripts/activate 
pip list 
opentelemetry-api                      1.12.0rc1 c:\users\jeremyvoss\workplace\opentelemetry-python\opentelemetry-api\src 
opentelemetry-distro                   0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\opentelemetry-distro\src
opentelemetry-instrumentation          0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\opentelemetry-instrumentation\src 
opentelemetry-instrumentation-flask    0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\instrumentation\opentelemetry-instrumentation-flask\src 
opentelemetry-instrumentation-requests 0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\instrumentation\opentelemetry-instrumentation-requests\src 
opentelemetry-instrumentation-wsgi     0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\instrumentation\opentelemetry-instrumentation-wsgi\src 
opentelemetry-proto                    1.12.0rc1 c:\users\jeremyvoss\workplace\opentelemetry-python\opentelemetry-proto\src 
opentelemetry-sdk                      1.12.0rc1 c:\users\jeremyvoss\workplace\opentelemetry-python\opentelemetry-sdk\src 
opentelemetry-semantic-conventions     0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python\opentelemetry-semantic-conventions\src 
opentelemetry-util-http                0.31b0    c:\users\jeremyvoss\workplace\opentelemetry-python-contrib\util\opentelemetry-util-http\src 
pip                                    22.1 
 
opentelemetry-instrument --traces_exporter console python opentelemetry-python/docs/examples/auto-instrumentation/server_uninstrumented.py
$ Error in sitecustomize; set PYTHONVERBOSE for traceback: 
error: incomplete escape \u at position 2 
* Serving Flask app 'server_uninstrumented' (lazy loading) 
* Environment: production 
   WARNING: This is a development server. Do not use it in a production deployment. 
   Use a production WSGI server instead. 
* Debug mode: off 
* Running on http://127.0.0.1:8082 (Press CTRL+C to quit) 
None 
 
#In other terminal in virtualenv: 
python opentelemetry-python/docs/examples/auto-instrumentation/client.py testing 
{ 
    "name": "client-server", 
    "context": { 
        "trace_id": "0x73acdf4567483e0687b68750cfb4f949", 
        "span_id": "0xd64fe9ef65f7755b", 
        "trace_state": "[]" 
    }, 
    "kind": "SpanKind.INTERNAL", 
    "parent_id": "0x38d3f426cefc6cc1", 
    "start_time": "2022-05-19T19:50:19.645699Z", 
    "end_time": "2022-05-19T19:50:21.694709Z", 
    "status": { 
        "status_code": "UNSET" 
    }, 
    "attributes": {}, 
    "events": [], 
    "links": [], 
    "resource": { 
        "telemetry.sdk.language": "python", 
        "telemetry.sdk.name": "opentelemetry", 
        "telemetry.sdk.version": "1.12.0rc1", 
        "service.name": "unknown_service" 
    } 
} 
{ 
    "name": "client", 
    "context": { 
        "trace_id": "0x73acdf4567483e0687b68750cfb4f949", 
        "span_id": "0x38d3f426cefc6cc1", 
        "trace_state": "[]" 
    }, 
    "kind": "SpanKind.INTERNAL", 
    "parent_id": null, 
    "start_time": "2022-05-19T19:50:19.645699Z", 
    "end_time": "2022-05-19T19:50:21.694709Z", 
    "status": { 
        "status_code": "UNSET" 
    }, 
    "attributes": {}, 
    "events": [], 
    "links": [], 
    "resource": { 
        "telemetry.sdk.language": "python", 
        "telemetry.sdk.name": "opentelemetry", 
        "telemetry.sdk.version": "1.12.0rc1", 
        "service.name": "unknown_service" 
    } 
} 
 
#Back in original terminal: 
$ testing 
127.0.0.1 - - [19/May/2022 12:50:21] "GET /server_request?param=testing HTTP/1.1" 200 - 
# No spans 

But, if I move the code block back to the finally, I get the spans:

$ Error in sitecustomize; set PYTHONVERBOSE for traceback:
error: incomplete escape \u at position 2
 * Serving Flask app 'server_uninstrumented' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
testing
{
    "name": "/server_request",
    "context": {
        "trace_id": "0x17de907a560abb09fe4bb12c7ae959b7",
        "span_id": "0x7be5ba63f32fe5f6",
        "trace_state": "[]"
    },
    "kind": "SpanKind.SERVER",
    "parent_id": "0x134b353700b64083",
    "start_time": "2022-05-19T20:35:04.538593Z",
    "end_time": "2022-05-19T20:35:04.538593Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "http.method": "GET",
        "http.server_name": "127.0.0.1",
        "http.scheme": "http",
        "net.host.port": 8082,
        "http.host": "localhost:8082",
        "http.target": "/server_request?param=testing",
        "net.peer.ip": "127.0.0.1",
        "http.user_agent": "python-requests/2.27.1",
        "net.peer.port": 59869,
        "http.flavor": "1.1",
        "http.route": "/server_request",
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "opentelemetry",
        "telemetry.sdk.version": "1.12.0rc1",
        "telemetry.auto.version": "0.31b0",
        "service.name": "unknown_service"
    }
}

Notice that in both cases, I get the Error in sitecustomize; set PYTHONVERBOSE for traceback: error: incomplete escape \u at position 2 message which may only occur on Windows. I believe it's related to the rf-string, but need to investigate more.

@aabmass
Copy link
Member

aabmass commented May 19, 2022

@jeremydvoss can you open a new issue with the repro?

@jeremydvoss
Copy link
Contributor

Done. open-telemetry/opentelemetry-python-contrib#1102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants