-
Notifications
You must be signed in to change notification settings - Fork 7k
Refactor OpenTelemetry environment variable handling to use ray_constants #57910
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
Changes from all commits
52dcd97
a6cb7a9
f316589
c663773
a5edb59
b37c182
27b0aa7
9e0c08e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import logging | ||
| import os | ||
| import re | ||
| import warnings | ||
| from typing import Any, Dict, List, Optional, Tuple, Union | ||
|
|
||
| from ray._private.ray_constants import env_bool | ||
| from ray._raylet import ( | ||
| Count as CythonCount, | ||
| Gauge as CythonGauge, | ||
|
|
@@ -198,7 +198,7 @@ def __init__( | |
| if self._discard_metric: | ||
| self._metric = None | ||
| else: | ||
| if os.environ.get("RAY_enable_open_telemetry") == "1": | ||
| if env_bool("RAY_enable_open_telemetry", False): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Inconsistent Env Evaluation Between Metrics and Ray Internal MeasuresInconsistent environment variable evaluation timing. The change uses
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it makes sense for test to evaluate at import time; in non-test code, it is consistently that the value will be evaluated at runtime |
||
| """ | ||
| For the new opentelemetry implementation, we'll correctly use Counter | ||
| rather than Sum. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve maintainability and avoid magic strings, you can define the environment variable name as a local variable. This also allows for making the code more concise.