Skip to content

Conversation

@rafaelwestphal
Copy link
Contributor

@rafaelwestphal rafaelwestphal commented Aug 7, 2025

Description

Use new feature flag otlp_endpoint to replace Google managed Prometheus exporter with the otlphttp exporter for Prometheus metrics.

Related issue

b/435217702

How has this been tested?

Unit test has been added to verify that the configuration is being generated when the feature flag is enabled.

Checklist:

  • Unit tests
    • Unit tests do not apply.
    • Unit tests have been added/modified and passed for this PR.
  • Integration tests
    • Integration tests do not apply.
    • Integration tests have been added/modified and passed for this PR.
  • Documentation
    • This PR introduces no user visible changes.
    • This PR introduces user visible changes and the corresponding documentation change has been made.
  • Minor version bump
    • This PR introduces no new features.
    • This PR introduces new features, and there is a separate PR to bump the minor version since the last release already.
    • This PR bumps the version.

}
// Check the Ops Agent receiver type.
if receiverPipeline.ExporterTypes[p.pipelineType] == otel.GMP {
if receiverPipeline.ExporterTypes[p.pipelineType] == otel.GMP || receiverPipeline.ExporterTypes[p.pipelineType] == otel.Otlp {
Copy link
Member

Choose a reason for hiding this comment

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

Is the new exporter intended to eventually be re-used for non-Prometheus pipelines as well?

If so, then I think this check is a bit of a time bomb, because there's no restriction on processors for non-Prometheus pipelines. If and when we decide to re-use the exporter for non-Prometheus, it would introduce a bug that we might not catch.

Otherwise, I think the new exporter type should be named something that's specific to Prometheus, i.e. OtlpGMP or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new exported is going to be re-used for non-Prometheus pipelines as well.

I changed the check here to prevent that problem from happening. This check should cover us for the scenarios:

  • Prometheus receiver with GMP exporter
  • Prometheus receiver with OTLP exporter
  • OTLP receiver with GMP exporter

Copy link
Member

Choose a reason for hiding this comment

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

What about OTLP receiver with OTLP exporter, but the OTLP receiver is configured in GMP mode? I think that's still not covered.

What if we add a new map adjacent to receiverPipeline.ExporterTypes that identifies the data model (GCM vs. GMP) for each pipeline/signal type? Today we assume that the data model is implied entirely by the exporter type, but with the OTLP exporter it's no longer true. The change you're proposing is potentially going down a rabbit hole where we'd need to exhaustively check every combination of receiver type and exporter type.

Copy link
Member

Choose a reason for hiding this comment

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

Or actually, since the data model depends on the configuration in the case of the OTLP receiver, it might have to be a function rather than a map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've reworked this part of the code and moved it to the validator.
PTAL

}
}
if len(c.Extensions) > 0 {
extensionsList := []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update extensionsList := []string{} to var extensionList []string

See: go/go-style/decisions#nil-slices

OTel ExporterType = iota
System
GMP
Otlp
Copy link
Contributor

Choose a reason for hiding this comment

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

We should stylize this abbrevation in all-caps similar to GMP

telemetryMap["logs"] = logs
}
}
if len(c.Extensions) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This was added here but then is repeated down below, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, bad code merge.

@rafaelwestphal rafaelwestphal merged commit 4bca6e5 into master Sep 30, 2025
62 checks passed
@rafaelwestphal rafaelwestphal deleted the westphalrafael-add-feature-otlp-exporter branch September 30, 2025 17:23
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.

8 participants