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

Generate metric name methods for all metrics #1007

Merged
merged 3 commits into from
Jul 10, 2023
Merged

Conversation

pkoenig10
Copy link
Member

Continuation of #293, but exposing this capability for all metrics.

I think the risk of misuse is minimal. Consumers can always bypass metric-schema entirely if they want. But if they want/need to off-road, it's better to at least have the metrics documented in metric-schema.

There are a couple places in our internal server library where this would be useful.

@changelog-app
Copy link

changelog-app bot commented Jun 26, 2023

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Generate metric name methods for all metrics.

Check the box to generate changelog(s)

  • Generate changelog entry

@@ -564,18 +574,19 @@ private static void generateMetricFactoryBuilder(
// TODO(ckozak): Update to use a method which can log a warning and replace existing gauges.
// See MetricRegistries.registerWithReplacement.
.addStatement(
"$L.$L($L(), $L)",
"$L.$L($N(), $L)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should all have been $N because they're name references, shouldn't make much difference in practice outside of cases like this where we pass a *Spec. Up to you if you'd like to replace them here or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, $N also supports CharSequence. I assumed it was just for Spec types because the docs say "Use $N to refer to another generated declaration by its name."

Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thanks! Feel free to add merge-when-ready at your convenience

@pkoenig10
Copy link
Member Author

👍

@bulldozer-bot bulldozer-bot bot merged commit 033e349 into develop Jul 10, 2023
5 checks passed
@bulldozer-bot bulldozer-bot bot deleted the pkeonig/names branch July 10, 2023 22:51
@svc-autorelease
Copy link
Collaborator

Released 0.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants