Repository: open-telemetry/opentelemetry-java
File: api/incubator/src/main/java/io/opentelemetry/api/incubator/config/ConfigProvider.java (Java)

Code before:
  @Nullable
  DeclarativeConfigProperties getInstrumentationConfig();

  /**
   * Returns the {@link DeclarativeConfigProperties} for a specific instrumentation by name. If no
   * configuration is available for the given name, an empty {@link DeclarativeConfigProperties} is
   * returned.
   *
   * @param name the name of the instrumentation
   * @return the {@link DeclarativeConfigProperties} for the given instrumentation name
   */
  default DeclarativeConfigProperties getJavaInstrumentationConfig(String name) {
    DeclarativeConfigProperties config = getInstrumentationConfig();
    return config == null ? empty() : config.get("java").get(name);
  }

  /**
   * Returns the {@link DeclarativeConfigProperties} for general instrumentation config by name. If
   * no configuration is available for the given name, an empty {@link DeclarativeConfigProperties}
   * is returned.
   *
   * @param name the name of the general instrumentation config
   * @return the {@link DeclarativeConfigProperties} for the given general instrumentation config
   *     name
   */
  default DeclarativeConfigProperties getGeneralInstrumentationConfig(String name) {
    DeclarativeConfigProperties config = getInstrumentationConfig();
    return config == null ? empty() : config.get("general").get(name);
  }

  /** Returns a no-op {@link ConfigProvider}. */
  static ConfigProvider noop() {
    return () -> null;
  }
}


Review comment (suggestion):
This works because for now there are no top level properties under `.instrumentation/development.general`. But if there were, callers would be unable to access them. I think we should omit the `String name` parameter for now and just return the `.instrumentation/development.general` node. 

Code after:
   * Returns the {@link DeclarativeConfigProperties} for a specific instrumentation by name. If no
   * configuration is available for the given name, an empty {@link DeclarativeConfigProperties} is
   * returned.
   *
   * <p>For example, {@code getInstrumentationConfig("foo")} returns the node:
   *
   * <pre>{@code
   * instrumentation/development:
   *   java:
   *     foo:
   * }</pre>
   *
   * @param name the name of the instrumentation
   * @return the {@link DeclarativeConfigProperties} for the given instrumentation name
   */
  default DeclarativeConfigProperties getInstrumentationConfig(String name) {
    return getInstrumentationConfig().get("java").get(name);
  }

  /**
   * Returns the {@link DeclarativeConfigProperties} for general instrumentation configuration.
   *
   * <pre>{@code
   * instrumentation/development:
   *   general:
   * }</pre>
   *
   * <p>If the general configuration is not available, an empty {@link DeclarativeConfigProperties}
   * is returned.
   *
   * @return the {@link DeclarativeConfigProperties} for the general instrumentation configuration
   */
  default DeclarativeConfigProperties getGeneralInstrumentationConfig() {
    return getInstrumentationConfig().get("general");
  }

  /** Returns a no-op {@link ConfigProvider}. */
  static ConfigProvider noop() {
    return DeclarativeConfigProperties::empty;
  }
}