-
Notifications
You must be signed in to change notification settings - Fork 842
add Timer decorator support partial function#858
Open
dafu-wu wants to merge 1 commit intoprometheus:master from
Open
add Timer decorator support partial function #858dafu-wu wants to merge 1 commit intoprometheus:master from
dafu-wu wants to merge 1 commit intoprometheus:master from
Conversation
@dafu-wu
dafu-wu
force-pushed
the
master
branch
2 times, most recently
from
November 21, 2022 09:02
2496d0e to
7476158
Compare
Signed-off-by: 吴成义 <wuchengyi2006@163.com>
@dafu-wu
dafu-wu
force-pushed
the
master
branch
from
November 22, 2022 02:10
7476158 to
c5b66b2
Compare
Member
csmarchbanks
commented
Nov 23, 2022
Thank you for the PR! decorator.py is actually copied from an old version of https://github.com/micheles/decorator, and we do not want to manually modify the contents. I would be ok updating to a newer version of decorator if it supports partial functions.
Author
dafu-wu
commented
Nov 24, 2022
ok, I tried to submit a pr in the decorator.
Author
dafu-wu
commented
Nov 27, 2022
GhostLyrics
commented
Jan 11, 2023
Will this maybe as a side-effect solve issues with the decorator making an function untyped? (example attached)
mypy .
toolchain/prometheus_timetac_exporter.py:47:2: error: Untyped decorator makes function "collect_ttqueue_oldest_pending_job_timestamp" untyped [misc]
@METRIC_QUERY_RESULT_TIME.time()
^
Found 1 error in 1 file (checked 16 source files)
make: *** [lint] Error 1
Currently I've solved this via a # type: ignore directive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
When we use time to decorate a partial function, I get an cannot decorate partial function error.
Should we use timer to support partial functions @hynek @csmarchbanks ? I thought it should be added and tried to add the relevant code.