Skip to content

[GCP] Add Cloud Run metrics datastream - #5097

Merged
endorama merged 12 commits into
mainfrom
unknown repository
Mar 22, 2023
Merged

[GCP] Add Cloud Run metrics datastream#5097
endorama merged 12 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jan 25, 2023

Copy link
Copy Markdown

What does this PR do?

Adds Cloud Run metrics data stream.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

@elasticmachine

elasticmachine commented Jan 25, 2023

Copy link
Copy Markdown

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-03-22T11:14:23.605+0000

  • Duration: 19 min 39 sec

Test stats 🧪

Test Results
Failed 0
Passed 59
Skipped 0
Total 59

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@ghost
ghost force-pushed the add_gcp-run_metrics branch from b7e61ea to 1ab6284 Compare January 25, 2023 14:42
@elasticmachine

elasticmachine commented Jan 25, 2023

Copy link
Copy Markdown

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (6/6) 💚
Files 100.0% (6/6) 💚
Classes 100.0% (6/6) 💚
Methods 89.623% (95/106) 👎 -10.377
Lines 96.0% (1464/1525) 👍 5.091
Conditionals 100.0% (0/0) 💚
@ghost

ghost commented Jan 25, 2023

Copy link
Copy Markdown
Author

/test

@ghost
ghost marked this pull request as ready for review January 25, 2023 17:17
@ghost
ghost requested review from a team as code owners January 25, 2023 17:17
@ghost ghost added Team:Cloud-Monitoring Label for the Cloud Monitoring team Integration:gcp Google Cloud Platform labels Jan 25, 2023
@Danouchka

Copy link
Copy Markdown

Hi @gpop63 , please dont forget to do same for gcp cloud function metrics as well (you have done so far only cloud run metrics)
Please also, is it possible to have them released even in tech preview, when everything is working fine of course.
I am running a POC for a big prospect and it's an emergency to get them
Thank you very much

on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}' No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you set event.kind when an error occurs?

on_failure:
  - set:
      field: error.message
      value: "{{{_ingest.on_failure_message}}}"
  - append:
      field: event.kind
      value: pipeline_error
      allow_duplicates: false

@dmathieu dmathieu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the GCP API returns metrics with an additional .value to the key. I had to remove them, or I got the following errors:

Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Date(2023, time.February, 27, 14, 12, 26, 0, time.UTC), Meta:{"input_id":"gcp/metrics-cloudrun_metrics-2d8b7d7f-ea57-42e9-8ea9-ff05aa6ad3e6","raw_index":"metrics-gcp.cloudrun_metrics-default","stream_id":"gcp/metrics-gcp.cloudrun_metrics-2d8b7d7f-ea57-42e9-8ea9-ff05aa6ad3e6"}, Fields:{"agent":{"ephemeral_id":"4c06530f-f1db-478b-a25c-4a6dee50fed6","id":"66b24416-a674-41e0-8343-4188d4b4424d","name":"docker-fleet-agent","type":"metricbeat","version":"8.6.1"},"cloud":{"account":{"id":"elastic-obs-integrations-dev","name":"elastic-obs-integrations-dev"},"provider":"gcp"},"data_stream":{"dataset":"gcp.cloudrun_metrics","namespace":"default","type":"metrics"},"ecs":{"version":"8.0.0"},"elastic_agent":{"id":"66b24416-a674-41e0-8343-4188d4b4424d","snapshot":false,"version":"8.6.1"},"event":{"dataset":"gcp.cloudrun_metrics","duration":324001876,"module":"gcp"},"gcp":{"labels":{"metrics":{"state":"active"},"resource":{"configuration_name":"damien-test-hello","location":"us-central1","revision_name":"damien-test-hello-00001-ped","service_name":"damien-test-hello"}},"metrics":{"container":{"instance_count":{"value":1}}}},"host":{"architecture":"x86_64","containerized":false,"hostname":"docker-fleet-agent","id":"956e4429f62042c2bf337b823882ed6a","ip":["172.22.0.7"],"mac":["02-42-AC-16-00-07"],"name":"docker-fleet-agent","os":{"codename":"focal","family":"debian","kernel":"5.15.49-linuxkit","name":"Ubuntu","platform":"ubuntu","type":"linux","version":"20.04.5 LTS (Focal Fossa)"}},"metricset":{"name":"metrics","period":60000},"service":{"type":"gcp"}}, Private:interface {}(nil), TimeSeries:true}, Flags:0x0, Cache:publisher.EventCache{m:mapstr.M(nil)}} (status=400): {"type":"mapper_parsing_exception","reason":"failed to parse field [gcp.cloudrun_metrics.container.instance.count] of type [long] in document with id 'EdI7k4YB7zWeSt5gEssU'. Preview of field's value: '{value=1}'","caused_by":{"type":"illegal_argument_exception","reason":"Cannot parse object as number"}}, dropping event!

Comment thread packages/gcp/data_stream/cloudrun_metrics/fields/fields.yml Outdated
@endorama

Copy link
Copy Markdown
Contributor

While merging main I made an error while fixing the conflict in changelog.yml. I just pushed a new commit to fix it.

@dmathieu dmathieu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

Screenshot 2023-03-22 at 14 52 49

@endorama
endorama merged commit 3535a66 into elastic:main Mar 22, 2023
@elasticmachine

Copy link
Copy Markdown

Package gcp - 2.19.0 containing this change is available at https://epr.elastic.co/search?package=gcp

orestisfl pushed a commit to orestisfl/integrations that referenced this pull request May 15, 2026
Co-authored-by: Damien Mathieu <damien.mathieu@elastic.co>
Co-authored-by: Edoardo Tenani <edoardo.tenani@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration:gcp Google Cloud Platform Team:Cloud-Monitoring Label for the Cloud Monitoring team

6 participants