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

Fix code detecting if the collector is running as service on Windows #9035

Conversation

pjanotti
Copy link
Contributor

@pjanotti pjanotti commented Dec 1, 2023

Description:
Re-instate change #4253 (it seems that it was lost by accident). The deprecated function being called checks if the process is an interactive process, however, while services are non-interactive the reverse is not true: a process can be non-interactive but not a service. This is what caused the detection to fail and required the use of NO_WINDOWS_SERVICE, with this change there should be no need for this variable anymore. If the SIG decide to deprecate this environment variable it should be done in a separate change.

Link to tracking Issue:
Fix #7350: it will be fixed since the detection should work correctly from this point forward.

Testing:
Local run of the collector.

Documentation:
Update changelog.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6e2fdc7) 91.57% compared to head (f3ce778) 91.57%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9035   +/-   ##
=======================================
  Coverage   91.57%   91.57%           
=======================================
  Files         316      316           
  Lines       17147    17147           
=======================================
  Hits        15702    15702           
  Misses       1150     1150           
  Partials      295      295           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pjanotti
Copy link
Contributor Author

pjanotti commented Dec 2, 2023

The implementation of svc.IsWindowsService has a bug and doesn't work correctly on Windows containers. I'm going to close the PR, the best path seems to fix svc.IsWindowsService and then re-open this PR.

@pjanotti pjanotti closed this Dec 2, 2023
@cwegener
Copy link

cwegener commented Dec 5, 2023

however, while services are non-interactive

What about interactive services? Are they not services? https://learn.microsoft.com/en-us/windows/win32/services/interactive-services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alternative method to configure NO_WINDOWS_SERVICE
2 participants