3

I'm following instructions here to get a list of services in my project from the google monitoring API: https://cloud.google.com/monitoring/service-monitoring/using-api#using-curl

curl --http1.1 --header "Authorization: Bearer ${ACCESS_TOKEN}" https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/services

I get back results for appEngine and clusterIstio objects within my project, but not for my Cloud Endpoints.

The documentation here suggests that Cloud Endpoints are supported: https://cloud.google.com/monitoring/service-monitoring/using-api#choosing-svcmon-api.

Are there any missing instructions here for maybe enabling the endpoints for monitoring?

qcabeza
  • 31
  • 1

1 Answers1

2

You can use the API to create custom SLOs using just about any metrics in your project.

First, create a service using this call:

https://cloud.google.com/monitoring/service-monitoring/using-api#service-create

Then, create SLOs against that service:

https://cloud.google.com/monitoring/service-monitoring/using-api#slo-create

Here's a walkthrough (using an App Engine service, rather than a custom one):

https://medium.com/google-cloud/slos-with-stackdriver-service-monitoring-62f193147b3f

Yuri Grinshteyn
  • 592
  • 2
  • 11
  • From the link on creating the service: `If you are not using an environment where services are automatically created (that is, App Engine, Istio on Google Kubernetes Engine, and Cloud Endpoints), then you can create services by using the services.create method.` So I shouldn't have to create the service for my Cloud Endpoint manually, correct? (Also, thank you for writing that article, I did come across it and found it quite helpful!) – qcabeza Jun 08 '20 at 17:44
  • Thank you :) And yes, you would have to first manually create the service using https://cloud.google.com/monitoring/service-monitoring/using-api#service-create – Yuri Grinshteyn Jun 09 '20 at 18:28
  • I was really hoping to use the built in service object for the cloud endpoint, which would have allowed me to use a "basicSli" referenced here: https://cloud.google.com/monitoring/service-monitoring/api-structures#sli-structs However.. creating a custom service and custom SLIs could be a viable workaround for me, so I'll give that a shot. Thank you for your help! – qcabeza Jun 11 '20 at 19:24