-
Notifications
You must be signed in to change notification settings - Fork 287
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
[telemetry] Refactor track_property()
#685
Conversation
c707351
to
caf08c7
Compare
ed9abe8
to
2e783ed
Compare
2d31fb5
to
a5316e5
Compare
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.
I am request changes only over the _Ugly
name; the other comments are my opinion but not over my dead body issues.
|
||
enum class DefineMetric | ||
{ | ||
AssetSource, |
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.
Are these referred to more than once? If not, I think the previous form was actually better since we didn't have to decode the enum to a string and back again.
If you keep this, we probably should have a comment about how adding new entries needs to be classified vis a vis GDPR and all that stuff?
View<MetricEntry<DefineMetric>> Metrics::get_define_metrics() | ||
{ | ||
static constexpr std::array<MetricEntry<DefineMetric>, static_cast<size_t>(DefineMetric::_COUNT)> ENTRIES{{ | ||
{DefineMetric::AssetSource, "asset-source"}, |
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.
An example of why I slightly preferred the string literal form: forgetting an entry in here seems a likely product bug?
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.
It is intentional that the build fails if an enum is not defined in this array. However, this only checks for length, so one could put a repeated enum in the array to make it pass. This needs some supporting tests.
04f2fc5
to
c2e0f50
Compare
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
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.
I still would like to see that overload set split but the OMDB _Ugly problem is fixed.
The overrides are gone. I'll merge this once CI is green since I have a few PRs that depend on this. |
Changes
track_property()
to use enums instead of raw strings to collect metrics.The purpose is to provide some basic "type-safety" and make all metrics easily auditable in the code.