-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[dagster-prometheus] Update dagster-prometheus using Pythonic resources w/ lifecycle hooks #13894
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
python_modules/dagster/dagster/_config/pythonic_config/__init__.py
Outdated
Show resolved
Hide resolved
python_modules/dagster/dagster/_config/pythonic_config/__init__.py
Outdated
Show resolved
Hide resolved
cdc0437
to
34c2a47
Compare
34c2a47
to
d4b97b5
Compare
Updated to use new lifecycle hooks. |
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.
Have some minor suggestions
This is also a bit of a goofy resource in that it take configuration but then that configuration does not impact the collector registry as far as I can tell. So the configuration only effects the methods we wrap, but then the user is also expected to use the prometheus APIs directly.
For example in our test we configure the resource but I don't think we use it all?
Just requesting changes to make sure you see this question.
python_modules/libraries/dagster-prometheus/dagster_prometheus/resources.py
Outdated
Show resolved
Hide resolved
python_modules/libraries/dagster-prometheus/dagster_prometheus_tests/test_resources.py
Outdated
Show resolved
Hide resolved
def test_prometheus_counter_pythonic_res() -> None: | ||
@op | ||
def prometheus_solid(prometheus: PrometheusResource) -> None: | ||
c = Counter( | ||
"some_counter_seconds", | ||
"Description of this counter", | ||
registry=prometheus.registry, | ||
) | ||
c.inc() | ||
c.inc(1.6) | ||
recorded = prometheus.registry.get_sample_value("some_counter_seconds_total") | ||
assert recorded | ||
assert abs(2.6 - recorded) < EPS | ||
|
||
assert wrap_op_in_graph_and_execute( | ||
prometheus_solid, run_config=ENV, resources=RESOURCES | ||
).success |
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.
does this test even use the configuration at all?
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.
Yeah, that's right. It is a bit silly as currently constructed. The tests don't touch on the codepaths that use the config (before and in this PR)
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.
Have some minor suggestions
This is also a bit of a goofy resource in that it take configuration but then that configuration does not impact the collector registry as far as I can tell. So the configuration only effects the methods we wrap, but then the user is also expected to use the prometheus APIs directly.
For example in our test we configure the resource but I don't think we use it all?
Just requesting changes to make sure you see this question.
…sources w/ post-init
0203eb7
to
063aa4b
Compare
Deploy preview for dagit-core-storybook ready! ✅ Preview Built with commit 063aa4b. |
Deploy preview for dagit-storybook ready! ✅ Preview Built with commit 063aa4b. |
Sumamry
Reimplementation of #13869 which migrates the
dagster-prometheus
resource as a configurable-resource w/ setup lifecycle hook that sets up some state on the class.