Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions confgenerator/confgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ func ConvertToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context,
}

if _, ok := pipeline.ExporterTypes["metrics"]; ok {
pipeline.ExporterTypes["metrics"] = otel.OTLP_Metrics
if isSystem {
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsRemoveInstrumentationLibraryLabelsAttributes())
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsRemoveServiceAttributes())
}
if isPrometheus {
pipeline.ExporterTypes["metrics"] = otel.GMP
} else {
pipeline.ExporterTypes["metrics"] = otel.OTLP_Metrics
if isSystem {
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsRemoveInstrumentationLibraryLabelsAttributes())
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsRemoveServiceAttributes())
}
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricUnknownCounter())
// If a metric already has a domain, it will not be considered a prometheus metric by the UTR endpoint unless we add the prefix.
// This behavior is the same as the GCM/GMP exporters.
pipeline.Processors["metrics"] = append(pipeline.Processors["metrics"], otel.MetricsTransform(otel.AddPrefix("prometheus.googleapis.com")))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -723,6 +719,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -927,6 +929,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1235,11 +1245,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -694,6 +690,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -883,6 +885,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1175,11 +1185,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=windows;ShortName=win_platform;ShortVersion=win_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=windows;ShortName=win_platform;ShortVersion=win_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -756,6 +752,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -994,6 +996,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1725,11 +1735,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=windows;ShortName=win_platform;ShortVersion=win_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=windows;ShortName=win_platform;ShortVersion=win_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -756,6 +752,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -994,6 +996,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1725,11 +1735,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -723,6 +719,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -898,6 +900,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1120,11 +1130,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ exporters:
service_resource_labels: true
skip_create_descriptor: true
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
googlemanagedprometheus:
metric:
add_metric_suffixes: false
user_agent: Google-Cloud-Ops-Agent-Metrics/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
otlp_grpc/otlp_logs:
auth:
authenticator: googleclientauth
Expand Down Expand Up @@ -694,6 +690,12 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/otlp_4:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: prometheus.googleapis.com/$${1}
metricstransform/otlpgooglecloudmonitoring_0:
transforms:
- action: update
Expand Down Expand Up @@ -854,6 +856,14 @@ processors:
- set(attributes["cluster"], "__gce__") where "__gce__" != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["instance_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
- set(attributes["machine_type"], resource.attributes["host.type"]) where resource.attributes["host.type"] != nil and resource.attributes["cloud.platform"] == "gcp_compute_engine"
transform/otlp_3:
error_mode: ignore
metric_statements:
- context: metric
statements:
- copy_metric(Concat([metric.name, "unknowncounter"], ":")) where metric.metadata["prometheus.type"] == "unknown" and not HasSuffix(metric.name, ":unknowncounter")
- convert_gauge_to_sum("cumulative", true) where HasSuffix(metric.name, ":unknowncounter")
- set(metric.name, Substring(metric.name, 0, Len(metric.name)-Len(":unknowncounter"))) where HasSuffix(metric.name, ":unknowncounter")
transform/otlp_grpc/otlp_logs_logs_2:
error_mode: ignore
log_statements:
Expand Down Expand Up @@ -1060,11 +1070,16 @@ service:
- otlp/otlpgooglecloudmonitoring
metrics/otlp_otlp:
exporters:
- googlemanagedprometheus
- otlp_grpc/otlp_metrics
processors:
- resourcedetection/otlp_0
- transform/otlp_1
- groupbyattrs/otlp_2
- transform/otlp_3
- metricstransform/otlp_4
- resource/otlp_grpc/otlp_metrics_metrics_0
- metric_start_time/otlp_grpc/otlp_metrics_metrics_1
- batch/otlp_grpc/otlp_metrics_metrics_2
receivers:
- otlp/otlp
traces/traces_otlp_otlp:
Expand Down
Loading
Loading