Skip to content
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

Merged
merged 15 commits into from
Sep 12, 2022

Conversation

vicroms
Copy link
Member

@vicroms vicroms commented Aug 31, 2022

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.

include/vcpkg/metrics.h Show resolved Hide resolved
src/vcpkg/binarycaching.cpp Show resolved Hide resolved
Copy link
Member

@BillyONeal BillyONeal left a 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.

include/vcpkg/metrics.h Outdated Show resolved Hide resolved
include/vcpkg/metrics.h Outdated Show resolved Hide resolved

enum class DefineMetric
{
AssetSource,
Copy link
Member

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"},
Copy link
Member

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?

Copy link
Member Author

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.

src/vcpkg/vcpkgpaths.cpp Outdated Show resolved Hide resolved
src/vcpkg/metrics.cpp Outdated Show resolved Hide resolved
src/vcpkg/metrics.cpp Outdated Show resolved Hide resolved
include/vcpkg/metrics.h Show resolved Hide resolved
vicroms and others added 2 commits September 7, 2022 15:29
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Copy link
Member

@BillyONeal BillyONeal left a 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.

@vicroms
Copy link
Member Author

vicroms commented Sep 12, 2022

The overrides are gone. I'll merge this once CI is green since I have a few PRs that depend on this.

@vicroms vicroms merged commit 3fa3fb5 into microsoft:main Sep 12, 2022
@vicroms vicroms deleted the telemetry-refactor branch September 12, 2022 21:09
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.

3 participants