apple / swift-metrics

Metrics API for Swift
https://apple.github.io/swift-metrics/
Apache License 2.0
661 stars 67 forks source link

Consider defining type alias for dimension `(String, String)` #43

Open yim-lee opened 5 years ago

yim-lee commented 5 years ago

Expected behavior

It should be clear what each String in a dimension tuple represents.

Actual behavior

Saw this code and had to google search to remind myself that dimensions are just key-value pairs:

let dimensions: [(String, String)]

Please consider defining type alias:

typealias Dimension = (key: String, value: String)

let dimensions: [Dimension]

Steps to reproduce

N/A

If possible, minimal yet complete reproducer code (or URL to code)

N/A

SwiftMetrics version/commit hash

1.1.0

Swift & OS version (output of swift --version && uname -a)

N/A

Yasumoto commented 5 years ago

Took a quick glance here, and naming this Dimension would collide with the type in Foundation. Maybe we could call it MetricDimension ?

This could be a usability win since we could also add some documentation on the typealias, but it'd be a breaking change. Anyone else have thoughts if this would be helpful?