-
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 33 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 |
|---|---|---|
|
|
@@ -57,32 +57,40 @@ func googleCloudExporter(userAgent string, instrumentationLabels bool, serviceRe | |
| } | ||
| } | ||
|
|
||
| func ConvertPrometheusExporterToOtlpExporter(receiver otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline { | ||
| return ConvertToOtlpExporter(receiver, ctx, true) | ||
| func ConvertPrometheusExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline { | ||
| return ConvertToOtlpExporter(pipeline, ctx, true, false) | ||
| } | ||
|
|
||
| func ConvertGCMOtelExporterToOtlpExporter(receiver otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline { | ||
| return ConvertToOtlpExporter(receiver, ctx, false) | ||
| func ConvertGCMOtelExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline { | ||
| return ConvertToOtlpExporter(pipeline, ctx, false, false) | ||
| } | ||
|
|
||
| func ConvertToOtlpExporter(receiver otel.ReceiverPipeline, ctx context.Context, isPrometheus bool) otel.ReceiverPipeline { | ||
| func ConvertGCMSystemExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline { | ||
| return ConvertToOtlpExporter(pipeline, ctx, false, true) | ||
| } | ||
|
|
||
| func ConvertToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context, isPrometheus bool, isSystem bool) otel.ReceiverPipeline { | ||
|
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. It is great that now all logic to setup the OTLP exporter instead of the GCM exporter is contained within QuestionI 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) :
I bring up this questions, since i feel the solution of using a "converter" ( SuggestionOne 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.
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. Synced offline with @rafaelwestphal. Mentioned eventually we are going to consolidate all |
||
| expOtlpExporter := experimentsFromContext(ctx)["otlp_exporter"] | ||
| resource, _ := platform.FromContext(ctx).GetResource() | ||
| if !expOtlpExporter { | ||
| return receiver | ||
| return pipeline | ||
| } | ||
| _, err := receiver.ExporterTypes["metrics"] | ||
| _, err := pipeline.ExporterTypes["metrics"] | ||
| if !err { | ||
| return receiver | ||
| return pipeline | ||
| } | ||
| receiver.ExporterTypes["metrics"] = otel.OTLP | ||
| pipeline.ExporterTypes["metrics"] = otel.OTLP | ||
|
|
||
| receiver.Processors["metrics"] = append(receiver.Processors["metrics"], otel.GCPProjectID(resource.ProjectName())) | ||
| pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.GCPProjectID(resource.ProjectName())) | ||
| if isSystem { | ||
| pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricStartTime()) | ||
franciscovalentecastro marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsRemoveInstrumentationLibraryLabelsAttributes()) | ||
| } | ||
| if isPrometheus { | ||
| receiver.Processors["metrics"] = append(receiver.Processors["metrics"], otel.MetricUnknownCounter()) | ||
| receiver.Processors["metrics"] = append(receiver.Processors["metrics"], otel.MetricStartTime()) | ||
| pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricUnknownCounter()) | ||
| pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricStartTime()) | ||
| } | ||
| return receiver | ||
| return pipeline | ||
| } | ||
|
|
||
| func otlpExporter(userAgent string) otel.Component { | ||
|
|
@@ -127,6 +135,7 @@ func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context, outDir string) | |
| userAgent, _ := p.UserAgent("Google-Cloud-Ops-Agent-Metrics") | ||
| metricVersionLabel, _ := p.VersionLabel("google-cloud-ops-agent-metrics") | ||
| loggingVersionLabel, _ := p.VersionLabel("google-cloud-ops-agent-logging") | ||
| expOtlpExporter := experimentsFromContext(ctx)["otlp_exporter"] | ||
|
|
||
| receiverPipelines, pipelines, err := uc.generateOtelPipelines(ctx) | ||
| if err != nil { | ||
|
|
@@ -141,9 +150,8 @@ func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context, outDir string) | |
| OtelRuntimeDir: outDir, | ||
| OtelLogging: uc.Logging.Service.OTelLogging, | ||
| } | ||
| agentSelfMetrics.AddSelfMetricsPipelines(receiverPipelines, pipelines) | ||
| agentSelfMetrics.AddSelfMetricsPipelines(receiverPipelines, pipelines, ctx) | ||
|
|
||
| expOtlpExporter := experimentsFromContext(ctx)["otlp_exporter"] | ||
| extensions := map[string]interface{}{} | ||
| if expOtlpExporter { | ||
| extensions["googleclientauth"] = map[string]interface{}{} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.