Skip to content

Remove with_ prefix from prometheus exporter property names#612

Merged
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:odd-prometheus-naming
May 15, 2026
Merged

Remove with_ prefix from prometheus exporter property names#612
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:odd-prometheus-naming

Conversation

@jack-berg

@jack-berg jack-berg commented May 5, 2026

Copy link
Copy Markdown
Member

See open-telemetry/opentelemetry-specification#5056 (review)

  • without_scope_info -> scope_info_enabled (default true)
  • without_target_info/development -> target_info_enabled/development (default true)
  • with_resource_constant_labels -> resource_constant_labels (default none are added)

Corresponding spec PR was merged: open-telemetry/opentelemetry-specification#5071

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks much better without double negations removing the without_ prefix.

A few questions:

  1. why still draft, looks ready for review

  2. why a boolean property foo_enabled, as opposed to just foo.
    I am sure this has been discussed elsewhere, but can not find the reference.

resource_constant_labels is not named resource_constant_labels_enabled, so this looks inconsistent.

I would prefer just scope_info, target_info and resource_constant_labels, unless there is a good reason for the enabled suffix.

@jack-berg

Copy link
Copy Markdown
Member Author

why still draft, looks ready for review

No reason for it to be a draft but it shouldn't be merged before corresponding spec PR (link in description).

why a boolean property foo_enabled, as opposed to just foo.
I am sure this has been discussed elsewhere, but can not find the reference.

I'm not sure this has been discussed actually - at least not in the context of the declarative config schema. There has been discussion at the spec level. Currently, the spec guidance for for env vars was to included either *_ENABLED or *_DISABLED based on making sure a default value of false aligns with the desired default behavior. This was clarified to only apply to env vars (i.e. not other config interfaces like programmatic or declarative config) here.

The original issue for that PR discusses prior art in the java agent and collector standardizing on *_ENALBED for all properties, regardless of their default.

So IMO, the realistic options for us in declarative config are:

  • *_enabled suffix for all boolean properties: Aligns with prior art in collector and java agent. Provides an obvious signal that the property is boolean type (questionably value).
  • omit any *_enabled / *_disabled: Name boolean types like any other properties without any special indication of their type in their name.

I will say that names like scope_info / target_info feel less self describing to me that scope_info_enabled / target_info_enabled. Its not clear to me what a scope_info property does, but I have better intuition that scope_info_enabled is a toggle to turn scope info on and off.

resource_constant_labels is not named resource_constant_labels_enabled, so this looks inconsistent.

resource_constant_labels is more than just a boolean - its a description of which resources should be added as labels. In the case of the declarative config schema, we use IncludeExclude to model this:

https://github.com/open-telemetry/opentelemetry-specification/blame/5d59108fe78264b7546dc1c971814956decdb916/specification/metrics/sdk_exporters/prometheus.md#L136

@jack-berg
jack-berg marked this pull request as ready for review May 11, 2026 14:58
@jack-berg
jack-berg requested a review from a team as a code owner May 11, 2026 14:58
@jack-berg

jack-berg commented May 11, 2026

Copy link
Copy Markdown
Member Author

FYI, the upstream spec PR has been merged: open-telemetry/opentelemetry-specification#5071

We could re-open the conversation at the spec level, or adopt a stance in declarative config schema that we generally omit _enabled suffixes on boolean types.

But the simpler approach is just to follow the naming of the upstream spec, which is what I advocate for.

pull Bot pushed a commit to CodeWeaver13/opentelemetry-specification that referenced this pull request May 11, 2026
Here, I change:

* without_scope_info -> scope_info_enabled (default true)
* without_target_info -> target_info_enabled (default true)
* with_resource_constant_labels -> resource_constant_labels (default
none are added)

The `with` prefix of a few (but not all) prometheus exporter options
seems to be a carry over from go functional options pattern. We don't
see it in the spec'd property names of any other built in components. It
doesn't doesn't contribute to the property's meaning in any way.
Omitting it doesn't block a language from using it in their
implementation, since that choice falls within maintainer discretion.

I think the use of "without" without_scope_info / without_target_info
with a default value of false was probably inspired by the "All Boolean
environment variables SHOULD be named and defined such that false is the
expected safe default behavior." language that we decided is not
applicable to other configuration interfaces:
open-telemetry#4723

So since there's no env vars for without_scope_info /
without_target_info, we don't need to be constrained by that.

Originated from:
open-telemetry#5056 (comment)

Corresponding change in declarative config schema:
github.com/open-telemetry/opentelemetry-configuration/pull/612

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@jack-berg
jack-berg merged commit c0a4c3b into open-telemetry:main May 15, 2026
12 checks passed
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.

4 participants