You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/03/08 03:41:40 UTC

[GitHub] [skywalking] katelei6 opened a new issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

katelei6 opened a new issue #8633:
URL: https://github.com/apache/skywalking/issues/8633


   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache SkyWalking Component
   
   Python Agent (apache/skywalking-python)
   
   ### What happened
   
   In my service, I add the skywalking-python, when I run the server by root, the env config such as SW_AGENT_INSTANCE can get. But when I change the user by others, the env config can not catch. so the ui can not show the instance.
   
   ### What you expected to happen
   
   I think the env can get the param by the user config.
   
   ### How to reproduce
   
   1 I run the server by user such as xn_test.
   ![image](https://user-images.githubusercontent.com/79354895/157161742-d062a9a3-2999-4123-a2f6-b26fef74a696.png)
   2 the env setting
   ![image](https://user-images.githubusercontent.com/79354895/157161821-95ec8a15-fe04-449e-88de-51730d373fe2.png)
   3 not catch the ip I setted.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] katelei6 commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
katelei6 commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066284883


   1. use printenv SW_AGENT_INSTANCE:  the result is right!
   [xn_testdev_ci@host-11-55-250-240 ~]$ printenv SW_AGENT_INSTANCE
   11.55.250.240   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1067397937


   Moving to discussion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] kezhenxu94 commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066920068


   I don't recommend to set env var in the bashrc/ zshrc/ profile/ etc., instead, set them in your startup script. Users who run a service in this machine might be surprised to see the service/ instance name is different. Also, these settings should be self-contained in the service (e.g. startup script)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] katelei6 commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
katelei6 commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066285308


   2、Use Python , the result is ok!
   ![image](https://user-images.githubusercontent.com/79354895/158096199-18281c4a-39da-4a2a-ac82-fa74d4340138.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] katelei6 edited a comment on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
katelei6 edited a comment on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066285558


   3、@Superskyyy
   In the skywalking UI, the result is wrong!
   ![image](https://user-images.githubusercontent.com/79354895/158096266-7c94c632-de18-44bc-bbbd-2834a016987d.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] katelei6 commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
katelei6 commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066285916


   @Superskyyy 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] katelei6 commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
katelei6 commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066285558


   3、In the skywalking UI, the result is wrong!
   ![image](https://user-images.githubusercontent.com/79354895/158096266-7c94c632-de18-44bc-bbbd-2834a016987d.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] Superskyyy commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1063344971


   @katelei6 Hello, please try to execute and check the env vars directly from your shell & python interactively after exporting (in the non-root user).
   1. ```printenv SW_AGENT_INSTANCE```
   2. ```Python3
   	import os
   	os.environ['SW_AGENT_INSTANCE']
   	```
   both cases should show the variable value properly as your IP address.
   
   Please let me know if the outputs are as expected, then we could proceed to investigate further.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1066980979


   Should we still consider this as potential bug or a discussion only?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] Superskyyy commented on issue #8633: [Bug] skywalking-python get env by not root user, can not load the env

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8633:
URL: https://github.com/apache/skywalking/issues/8633#issuecomment-1067211838


   Yes depending on how the user is switched to, a `.bashrc` file may or may not be executed (non-login shell only). 
   The current code in the Python agent that reads the env var doesn't look buggy to me? It's the only place that could generate a uuid for the instances.
   ```
   service_instance = os.getenv('SW_AGENT_INSTANCE') or str(uuid.uuid1()).replace('-', '')  # type: str
   ```
   I suppose this is less likely a bug, what you guys think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org