Skip to content

Commit

Permalink
Add support for region/zone for Vertex AI service in GCP module (#41551
Browse files Browse the repository at this point in the history
…) (#41807)

* Add support for Vertex AI service in GCP module

* update changelog

(cherry picked from commit 8cd6feb)

Co-authored-by: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com>
  • Loading branch information
mergify[bot] and ishleenk17 authored Dec 2, 2024
1 parent 633e6f6 commit 9dbb81c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Add `id` field to all the vSphere metricsets. {pull}41097[41097]
- Bump aerospike-client-go to version v7.7.1 and add support for basic auth in Aerospike module {pull}41233[41233]
- Only watch metadata for ReplicaSets in metricbeat k8s module {pull}41289[41289]
- Add support for region/zone for Vertex AI service in GCP module {pull}41551[41551]

*Metricbeat*

Expand Down
16 changes: 9 additions & 7 deletions x-pack/metricbeat/module/gcp/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
ServiceDataproc = "dataproc"
ServiceCloudSQL = "cloudsql"
ServiceRedis = "redis"
ServiceAIPlatform = "aiplatform"
)

// Paths within the GCP monitoring.TimeSeries response, if converted to JSON, where you can find each ECS field required for the output event
Expand Down Expand Up @@ -81,13 +82,14 @@ const (

// NOTE: if you are adding labels make sure to update tests in metrics/metrics_requester_test.go.
const (
DefaultResourceLabel = "resource.label.zone"
ComputeResourceLabel = "resource.labels.zone"
GKEResourceLabel = "resource.label.location"
StorageResourceLabel = "resource.label.location"
CloudSQLResourceLabel = "resource.labels.region"
DataprocResourceLabel = "resource.label.region"
RedisResourceLabel = "resource.label.region"
DefaultResourceLabel = "resource.label.zone"
ComputeResourceLabel = "resource.labels.zone"
GKEResourceLabel = "resource.label.location"
StorageResourceLabel = "resource.label.location"
CloudSQLResourceLabel = "resource.labels.region"
DataprocResourceLabel = "resource.label.region"
RedisResourceLabel = "resource.label.region"
AIPlatformResourceLabel = "resource.label.location"
)

// AlignersMapToGCP map contains available perSeriesAligner
Expand Down
2 changes: 2 additions & 0 deletions x-pack/metricbeat/module/gcp/metrics/metrics_requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ func getServiceLabelFor(serviceName string) string {
return gcp.CloudSQLResourceLabel
case gcp.ServiceRedis:
return gcp.RedisResourceLabel
case gcp.ServiceAIPlatform:
return gcp.AIPlatformResourceLabel
default:
return gcp.DefaultResourceLabel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ func TestIsAGlobalService(t *testing.T) {
{"Dataproc service", gcp.ServiceDataproc, false},
{"CloudSQL service", gcp.ServiceCloudSQL, false},
{"Redis service", gcp.ServiceRedis, false},
{"AIPlatform service", gcp.ServiceAIPlatform, false},
}
for _, c := range cases {
t.Run(c.title, func(t *testing.T) {
Expand Down Expand Up @@ -249,6 +250,7 @@ func TestGetServiceLabelFor(t *testing.T) {
{"Dataproc service", gcp.ServiceDataproc, "resource.label.region"},
{"CloudSQL service", gcp.ServiceCloudSQL, "resource.labels.region"},
{"Redis service", gcp.ServiceRedis, "resource.label.region"},
{"AIPlatform service", gcp.ServiceAIPlatform, "resource.label.location"},
}

for _, c := range cases {
Expand Down

0 comments on commit 9dbb81c

Please sign in to comment.