Repository navigation
Describe every usage metric and simple metric feature area - #8228
Conversation
Every usage metrics provider now reports a description with each value, and simple metric feature areas get descriptions too, including the client-side areas counted by @labkey/components.
There was a problem hiding this comment.
This is from the previous change, but since this catch is per-provider, shouldn't the logging highlight the provider that failed?
There was a problem hiding this comment.
Also, I guess this was intentional, but unfortunate that we have to generate all the metrics just to get the descriptions.
There was a problem hiding this comment.
Also, I guess this was intentional, but unfortunate that we have to generate all the metrics just to get the descriptions.
Claude kept lamenting on that during its reviews. It didn't seem worth the complexity of decoupling them (and potential drift) since the descriptions will only need to be collected occasionally and every server already recomputes its metric values daily anyway.
It would be easy enough to capture and stash the descriptions during the metric submission process but I wasn't going to bother to automate export/import of them yet.
There was a problem hiding this comment.
This is from the previous change, but since this catch is per-provider, shouldn't the logging highlight the provider that failed?
The stack trace should contain the class name of the provider. That's often a lambda. I don't know if it's worth a pass to include a name for every provider at registration time.
There was a problem hiding this comment.
Also, I guess this was intentional, but unfortunate that we have to generate all the metrics just to get the descriptions.
Claude kept lamenting on that during its reviews. It didn't seem worth the complexity of decoupling them (and potential drift) since the descriptions will only need to be collected occasionally and every server already recomputes its metric values daily anyway.
It would be easy enough to capture and stash the descriptions during the metric submission process but I wasn't going to bother to automate export/import of them yet.
My thought: UsageMetrics.put() has the (for now) option of taking a Supplier<Object>. If a supplier is provided, the metrics enumerator will resolve it and the metrics description exporter will not. We can migrate to suppliers over time. Should be an easy change for Claude to implement.
There was a problem hiding this comment.
This is from the previous change, but since this catch is per-provider, shouldn't the logging highlight the provider that failed?
The stack trace should contain the class name of the provider. That's often a lambda. I don't know if it's worth a pass to include a name for every provider at registration time.
Sure, the name is there. Maybe just update the message to say "a provider in module XXX failed..." since it's not the entire module that failed.
There was a problem hiding this comment.
OK, updated.
| } | ||
|
|
||
| /** Calls the supplier only when values are reported, so a {@code reportedIf(false)} view skips the work. A literal null value resolves here. */ | ||
| public UsageMetrics put(@NotNull String key, @Nullable Supplier<?> value, @NotNull String description) |
There was a problem hiding this comment.
Oh good, so we're already accepting a Supplier
There was a problem hiding this comment.
I converted more, but not all, callers to use a Supplier
| return this; | ||
| } | ||
|
|
||
| /** Calls the supplier only when values are reported, so a {@code reportedIf(false)} view skips the work. A literal null value resolves here. */ |
There was a problem hiding this comment.
What's a view? Seems like an odd and overloaded term for us.
There was a problem hiding this comment.
Updated the comment. It's just a render of the descriptions without grabbing the metrics.
| import org.labkey.api.usageMetrics.SimpleMetricsService; | ||
|
|
||
| /** Describes the client-side feature areas that @labkey/components counts */ | ||
| public final class ClientSideMetricDescriptions |
There was a problem hiding this comment.
Maybe I missed it, but I didn't see any place where we alert (e.g., log an error or warning, or throw) when we receive a client-side metric that isn't described.
There was a problem hiding this comment.
I went back and forth on this.
I pushed an update that logs once per server startup when we get a client-side metric that's not linked to a description. In dev mode, it's ERROR to get caught by automated tests. In prod mode, it's WARN as we get spammed by bots sometimes that make up descriptions.
Also flag simple metric feature areas that lack a description and clarify describe-only terminology, per review feedback.
## Rationale Describes the Flow and Protein usage metrics, using the API added in the platform PR. [GH Issue 1775](LabKey/internal-issues#1775) ## Related Pull Requests - LabKey/platform#8228 - LabKey/limsModules#2564 - LabKey/premiumModules#821 - LabKey/customModules#289 - LabKey/targetedms#1298 - LabKey/ehrModules#1232 ## Changes - Descriptions for Flow's and Protein's usage metrics.
## Rationale Describes the Specimen usage metrics, using the API added in the platform PR. [GH Issue 1775](LabKey/internal-issues#1775) ## Related Pull Requests - LabKey/platform#8228 - LabKey/limsModules#2564 - LabKey/premiumModules#821 - LabKey/commonAssays#1094 - LabKey/targetedms#1298 - LabKey/ehrModules#1232 ## Changes - Descriptions for Specimen's usage metrics.
## Rationale Describes the EHR usage metrics, using the API added in the platform PR. [GH Issue 1775](LabKey/internal-issues#1775) ## Related Pull Requests - LabKey/platform#8228 - LabKey/limsModules#2564 - LabKey/premiumModules#821 - LabKey/commonAssays#1094 - LabKey/customModules#289 - LabKey/targetedms#1298 ## Changes - Description for the participant history filter's client-side feature area.
## Rationale Describes the TargetedMS usage metrics, using the API added in the platform PR. [GH Issue 1775](LabKey/internal-issues#1775) ## Related Pull Requests - LabKey/platform#8228 - LabKey/limsModules#2564 - LabKey/premiumModules#821 - LabKey/commonAssays#1094 - LabKey/customModules#289 - LabKey/ehrModules#1232 ## Changes - Descriptions for TargetedMS's usage metrics.
Rationale
Documents what every usage metric reports to mothership, so each value can be understood without reading the code that produces it.
The provider API changes, so the other
fb_metric_descriptionsPRs must merge with this one.GH Issue 1775
Related Pull Requests
Changes
@labkey/components.