Skip to content

Conversation

@Pliner
Copy link
Contributor

@Pliner Pliner commented Jan 28, 2022

Hi,

It is a small addition to Histogram/Summary/Gauge typings.

PS I suppose at the current stage it is fine to set disallow_incomplete_defs to True.

Also we could set disallow_incomplete_defs to True

Signed-off-by: Yury Pliner <[email protected]>
@Pliner Pliner force-pushed the add-typing-to-histogram branch from 3c515e7 to a34a80f Compare January 28, 2022 16:54
self._raise_if_not_observable()

def samples(self) -> Iterable[Sample]:
def samples(_: Gauge) -> Iterable[Sample]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the only one thing which is needed to enable disallow_incomplete_defs.

Signed-off-by: Yury Pliner <[email protected]>
@Pliner Pliner force-pushed the add-typing-to-histogram branch from 6b21fbd to 76c0c48 Compare January 28, 2022 17:17
@Pliner Pliner changed the title Add typing to Histogram Add typing to Histogram/Summary/Gauge Jan 28, 2022
return (Sample('', {}, float(f()), None, None),)

self._child_samples = types.MethodType(samples, self)
self._child_samples = types.MethodType(samples, self) # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy is not fond of such an overwrite of a method

@Pliner
Copy link
Contributor Author

Pliner commented Jan 28, 2022

@csmarchbanks Could you look on it please? Many thanks.

Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great!

I will take a closer look next week, but generally this is looking good to me.

Signed-off-by: Yury Pliner <[email protected]>
Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment, otherwise I think this looks good!

@Pliner Pliner force-pushed the add-typing-to-histogram branch from 32535ef to 3d4a632 Compare February 1, 2022 10:53
Signed-off-by: Yury Pliner <[email protected]>
@Pliner Pliner force-pushed the add-typing-to-histogram branch from 3d4a632 to 02b0053 Compare February 1, 2022 10:55
Copy link
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@csmarchbanks csmarchbanks merged commit ecb5dd9 into prometheus:master Feb 1, 2022
@Pliner Pliner deleted the add-typing-to-histogram branch February 8, 2022 15:43
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.

2 participants