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

Match sub-classing interfaces #338

Open
npepinpe opened this issue Jan 30, 2025 · 0 comments
Open

Match sub-classing interfaces #338

npepinpe opened this issue Jan 30, 2025 · 0 comments

Comments

@npepinpe
Copy link

Description

We use MeterDocumentation with enums to document our metrics, and generally quite like the pattern, as it provides some technical documentation for all our metrics. We extend MeterDocumentation however to add more information. While it would be nice to have that shown by the generator, this is not the problem.

The main issue is that the generator doesn't pick up enums implementing the extending interface, it only picks up enums which directly implement MeterDocumentation.

Take the following ExtendedMeterDocumentation interface:

/**
 * Extends the base {@link MeterDocumentation} API to allow for more static description, e.g.
 * help/description associated with a given metric.
 */
public interface ExtendedMeterDocumentation extends MeterDocumentation {
   final Duration[] EMPTY_SLOS = new Duration[0];

  /** Returns the description (also known as {@code help} in some systems) for the given meter. */
  String getDescription();

  /**
   * Returns the buckets to be used if the meter type is a {@link Meter.Type#TIMER} or {@link
   * Meter.Type#DISTRIBUTION_SUMMARY}.
   */
  default Duration[] getServiceLevelObjectives() {
    return EMPTY_SLOS;
  }
}

And the following enum:

public enum MyMetrics implements ExtendedMeterDocumentation {
  // ... some metrics
}

Naively, I would expect the generator to pick up MyMetrics, but it does not.

As a workaround, I can do the following:

public enum MyMetrics implements MeterDocumentation, ExtendedMeterDocumentation {
  // ... some metrics
}

Then the generator will pick it up. It would be great though if it wasn't necessary to again declare the implementation of MeterDocumentation.

I'm happy to pick this up if you think this would be valuable. I understand there's not much urgency if there is a workaround :)

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

No branches or pull requests

1 participant