Skip to content

RFC: Including the Typing returns in Metrics #642

Closed
@mkamioner

Description

@mkamioner

Key information

  • RFC PR: (leave this empty)
  • Related issue(s), if known:
  • Area: Metrics
  • Meet tenets: (Yes/no)
  • Approved by: ''
  • Reviewed by: ''

Summary

The Metrics library does not include the return types of the functions, causing MyPy to complain.

Motivation

Adding typing to the return of the signature of the function will help prevent errors during development. Also, Mypy will stop complaining:

Proposal

Go through the metrics/metrics.py file and add the return type to all functions

User Experience

This would require no code change and be backwards compatible. Users would get a better result from mypy and type hinting tools to help makde development easier

Before

/file.py: note: In member "record_metrics" of class "ConnectionCountRecorderDriver":
/file.py:26:9: error: Call to untyped function "clear_metrics" in typed context  [no-untyped-call]
Found 1 errors in 1 file (checked 1 source file)

After

Success: no issues found in 1 source file

Drawbacks

Honestly, none that I can think of except for someone's time - happy to take care of that :-)

Rationale and alternatives

  • What other designs have been considered? Why not them? Not sure what else has been considered, but since we use python typing in other places in the same file, it makes sense to be consistent.
  • What is the impact of not doing this? Better developer experience 💪

Unresolved questions

Optional, stash area for topics that need further development e.g. TBD

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions