-
Notifications
You must be signed in to change notification settings - Fork 80
Using otlphttp exporter for self metrics #2093
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
base: master
Are you sure you want to change the base?
Changes from all commits
b066750
3e29132
0969945
06ae486
6b8674d
8901822
486f335
2ca0535
68f9c4d
27f1487
7c6ab48
0203366
fb747cc
3d60aa6
75b3426
dad0225
d06c53e
4b1d06d
958fb37
49d5d56
0f1b0d2
72f0623
193dd21
edfe554
db9427a
a87cb54
87f07ee
d85b391
aab9b17
ecbc31f
939da8e
9f32772
460ca97
1cf2746
06a6d3f
765ab8d
3b0a878
0d45cb4
d4224ac
936ae3d
d387e0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -256,6 +256,12 @@ func (c ModularConfig) Generate(ctx context.Context, expOtlpExporter bool) (stri | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copyProcessor := CopyHostIDToInstanceID() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| processorNames = append(processorNames, copyProcessor.name("_global_0")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| processors[copyProcessor.name("_global_0")] = copyProcessor.Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Similar to the resource detector, for any pipeline that is using the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Requested Change]After seeing the implementation of Why not create a similar pair of This also removes the need to have the ops-agent/confgenerator/testdata/goldens/metrics-exporter_prometheus_otlp/golden/windows/otel.yaml Lines 887 to 900 in d387e0a
[Context]For Otel Logging, I've found a need (see #2165) for a separate This is my draft of the idea i propose above. IMO, this is extendable and encodes all this "processor logic" depending on the exporter : ops-agent/confgenerator/otel/modular.go Lines 226 to 273 in fa9c5ee
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P.D. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // otlphttp exporter, we add a MetricStartTime processor at the end of it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // This mimics the current behavior on GCM exporter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metricStartTime := MetricStartTime() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| processorNames = append(processorNames, metricStartTime.name(fmt.Sprintf("%s_0", prefix))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| processors[metricStartTime.name(fmt.Sprintf("%s_0", prefix))] = metricStartTime.Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exporterType := receiverPipeline.ExporterTypes[pipeline.Type] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,17 @@ processors: | |
| - googlecloudmonitoring/point_count | ||
| interval/loggingmetrics_7: | ||
| interval: 1m | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Requested changed] Add a |
||
| metricstarttime/prometheus_3: | ||
| metricstarttime/default__pipeline_hostmetrics_0: | ||
| strategy: subtract_initial_point | ||
| metricstarttime/default__pipeline_hostmetrics_1_0: | ||
| strategy: subtract_initial_point | ||
| metricstarttime/fluentbit_0: | ||
| strategy: subtract_initial_point | ||
| metricstarttime/loggingmetrics_0: | ||
| strategy: subtract_initial_point | ||
| metricstarttime/opsagent_0: | ||
| strategy: subtract_initial_point | ||
| metricstarttime/otel_0: | ||
| strategy: subtract_initial_point | ||
| metricstransform/fluentbit_1: | ||
| transforms: | ||
|
|
@@ -587,6 +597,16 @@ processors: | |
| include: ^(.*)$$ | ||
| match_type: regexp | ||
| new_name: agent.googleapis.com/$${1} | ||
| resource/agent_prometheus_1: | ||
| attributes: | ||
| - action: insert | ||
| key: gcp.project_id | ||
| value: test-project | ||
| resource/ops_agent_1: | ||
| attributes: | ||
| - action: insert | ||
| key: gcp.project_id | ||
| value: test-project | ||
| resource/prometheus_1: | ||
| attributes: | ||
| - action: insert | ||
|
|
@@ -610,6 +630,12 @@ processors: | |
| - delete_key(resource.attributes, "service.instance.id") | ||
| - delete_key(resource.attributes, "server.port") | ||
| - delete_key(resource.attributes, "url.scheme") | ||
| transform/agent_prometheus_2: | ||
| metric_statements: | ||
| - context: scope | ||
| statements: | ||
| - set(name, "") | ||
| - set(version, "") | ||
| transform/loggingmetrics_0: | ||
| error_mode: ignore | ||
| metric_statements: | ||
|
|
@@ -637,6 +663,12 @@ processors: | |
| - context: datapoint | ||
| statements: | ||
| - set(time, Now()) | ||
| transform/ops_agent_2: | ||
| metric_statements: | ||
| - context: scope | ||
| statements: | ||
| - set(name, "") | ||
| - set(version, "") | ||
| transform/otel_0: | ||
| error_mode: ignore | ||
| metric_statements: | ||
|
|
@@ -769,6 +801,7 @@ service: | |
| - filter/default__pipeline_hostmetrics_0 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/default__pipeline_hostmetrics_0 | ||
| receivers: | ||
| - hostmetrics/hostmetrics | ||
| metrics/default__pipeline_hostmetrics_1: | ||
|
|
@@ -779,24 +812,30 @@ service: | |
| - filter/default__pipeline_hostmetrics_1_0 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/default__pipeline_hostmetrics_1_0 | ||
| receivers: | ||
| - nvml/hostmetrics_1 | ||
| metrics/fluentbit: | ||
| exporters: | ||
| - googlecloud | ||
| - otlphttp/otlp | ||
| processors: | ||
| - transform/agent_prometheus_0 | ||
| - resource/agent_prometheus_1 | ||
| - transform/agent_prometheus_2 | ||
| - filter/fluentbit_0 | ||
| - metricstransform/fluentbit_1 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/fluentbit_0 | ||
| receivers: | ||
| - prometheus/agent_prometheus | ||
| metrics/loggingmetrics: | ||
| exporters: | ||
| - googlecloud | ||
| - otlphttp/otlp | ||
| processors: | ||
| - transform/agent_prometheus_0 | ||
| - resource/agent_prometheus_1 | ||
| - transform/agent_prometheus_2 | ||
| - transform/loggingmetrics_0 | ||
| - filter/loggingmetrics_1 | ||
| - filter/loggingmetrics_2 | ||
|
|
@@ -808,28 +847,35 @@ service: | |
| - metricstransform/loggingmetrics_8 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/loggingmetrics_0 | ||
| receivers: | ||
| - prometheus/agent_prometheus | ||
| metrics/opsagent: | ||
| exporters: | ||
| - googlecloud | ||
| - otlphttp/otlp | ||
| processors: | ||
| - transform/ops_agent_0 | ||
| - resource/ops_agent_1 | ||
| - transform/ops_agent_2 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/opsagent_0 | ||
| receivers: | ||
| - otlpjsonfile/ops_agent | ||
| metrics/otel: | ||
| exporters: | ||
| - googlecloud | ||
| - otlphttp/otlp | ||
| processors: | ||
| - transform/agent_prometheus_0 | ||
| - resource/agent_prometheus_1 | ||
| - transform/agent_prometheus_2 | ||
| - transform/otel_0 | ||
| - filter/otel_1 | ||
| - filter/otel_2 | ||
| - metricstransform/otel_3 | ||
| - resourcedetection/_global_0 | ||
| - transform/_global_0 | ||
| - metricstarttime/otel_0 | ||
| receivers: | ||
| - prometheus/agent_prometheus | ||
| metrics/prometheus__pipeline_prometheus: | ||
|
|
@@ -839,7 +885,6 @@ service: | |
| - transform/prometheus_0 | ||
| - resource/prometheus_1 | ||
| - transform/prometheus_2 | ||
| - metricstarttime/prometheus_3 | ||
| receivers: | ||
| - prometheus/prometheus | ||
| telemetry: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is great that now all logic to setup the OTLP exporter instead of the GCM exporter is contained within
ConvertToOtlpExporter!Question
I want to followup on this comment made above :
When the migration to the OTLP exporter is fully completed and we remove all the other exporters (System, OTel , GMP) :
GMPexporter, how is the functionConvertPrometheusExporterToOtlpExportergoing to be renamed/refactored ?I bring up this questions, since i feel the solution of using a "converter" (
ConvertToOtlpExporter) is considering only the intermediate state whereGCMis the main exporter, but will need further refactoring when those are removed. My suggestion here aims to find a solution that won't need any refactoring later.Suggestion
One idea is to have 3 exporter types which help determine the specific processors needed for each pipeline (while keeping the possibility to store the logic in one place ) :
This keeps the abstraction of a "ReceiverPipeline" while also having a way to differentiate the specific requirements of each metric pipeline.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synced offline with @rafaelwestphal. Mentioned eventually we are going to consolidate all
OTLP exporterprocessor logic when the migration is complete. Using aConvertToOtlpExporteris considered an intermediate step since it enables development to happen for each receiver separately.