Home > database >  Where are the requests to `/nginx_metrics` coming from in Google App Engine
Where are the requests to `/nginx_metrics` coming from in Google App Engine

Time:04-21

I'm running a webservice on Google App Engine. It's a simple webserver which has a few routes. none of these are /nginx_metrics. This is my app.yaml file:

runtime: custom
env: flex

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2
  cool_down_period_sec: 180
  cpu_utilization:
    target_utilization: 0.6

resources:
  cpu: 4
  memory_gb: 4
  disk_size_gb: 10

I run this and I see a constant stream of requests which seem to be hitting /nginx_metrics, and the logs say that it's responded with a 200 status. I'm not sure where this is coming from since I've not given my application any sort of nginx instance. It doesn't really bother me, but I'd like to read my logs without this, and I'm unable to do so.

I get a stream of this:

2022-03-28 04:00:37 default[20220328t092456]  "GET /nginx_metrics" 200
2022-03-28 04:00:52 default[20220324t171711]  "GET /nginx_metrics" 200

And even my app logs seem to be prefixed with default. How do I fix this?

CodePudding user response:

The /nginx_metrics endpoint is called by GAE to retrieve the metrics from the customer Flex VMs. That endpoint is not exposed publicly, it's exposed on the docker bridge network 172.17.0.1 but you can't send requests to /nginx_metrics from the appspot URL (you may want to check this) That path is targeting one of the sidecar containers that are deployed along with your app (which is on another container on each instance). That container is the opentelemetry-collector one, you can check it by SSHing into a flex instance. If you want to check the source of the container it should be running something similar to : https://github.com/GoogleCloudPlatform/appengine-sidecars-docker/tree/main/opentelemetry_collector.

Google is aware of this issue and that the /nginx_metrics is logged in nginx request logs, ( which is not an intended behavior) and we are working on it. You can expect the fix to be resolved on the next Flex runtime update.

Coming to your second question, default service being prefixed for every logs :

If you do not specify any service name while deploying your app or while entering the gcloud command like : gcloud app deploy instead of gcloud app deploy service-name-app.yaml your app will get deployed in another version of the default service. That is why you would see default[some-numbers] prefixed to each of your successful logs where default is the service and [20220328t092456] is the version-name that tells you have deployed this version on 28th March,2022.

  • Related