firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 936 forks source link

Labels not applied to Cloud Run services - difficult to monitor costs #7850

Open Desno365 opened 1 week ago

Desno365 commented 1 week ago

[REQUIRED] Environment info

firebase-tools: 13.22.1

Platform: macOS

[REQUIRED] Test case

If you deploy a V2 function with custom labels, labels are not applied to the Cloud Run service, making it difficult to monitor the costs associated with the service.

A simple test case is the following:

const { onRequest } = require("firebase-functions/v2/https");

exports.hello = onRequest(
  { labels: { "cost_center": "sales" } },
  (req, res) => {
    res.status(200).send("Hello world!");
  }
);

[REQUIRED] Steps to reproduce

  1. Deploy any V2 function with custom labels
  2. Check on https://console.cloud.google.com/run the labels associated with the service
  3. Custom labels are not applied to the service

[REQUIRED] Expected behavior

Labels should be applied to the Cloud Run service so that costs associated with the service can be monitored.

[REQUIRED] Actual behavior

No labels are applied to the Cloud Run service.

Screenshot 2024-10-19 at 11 01 55
colerogers commented 4 days ago

Hi @Desno365, thanks for opening this issue. As you've probably noticed, labels only show up on the Cloud Function interface/tab when deploying to Google Cloud Functions. I did some digging on our end and it looks like this feature has been requested internally for Cloud Functions to automatically propagate user-defined labels to Cloud Run. This is currently being worked on by the team and should be released on the backend so you won't need to upgrade firebase-tools or firebase-functions. I'll respond back when it is released which should be relatively soon. Thanks!