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
* Add support for Vertex AI service in GCP module

* update changelog
  • Loading branch information
ishleenk17 authored Nov 8, 2024
1 parent 6be1c24 commit 8cd6feb
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 @@ -381,6 +381,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Restore docker.network.in.* and docker.network.out.* fields in docker module {pull}40968[40968]
- Add `id` field to all the vSphere metricsets. {pull}41097[41097]
- 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 @@ -82,13 +83,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 8cd6feb

Please sign in to comment.