GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Wrong project ID when running cloud monitoring custom metrics sample · Issue #244 · GoogleCloudPlatform/python-docs-samples

Wrong project ID when running cloud monitoring custom metrics sample #244

New issue
Copy link
New issue
Copy link
Closed
Closed
Wrong project ID when running cloud monitoring custom metrics sample#244
Copy link
Labels
🚨This issue needs some love.triage meI really want to be triaged.

Description

@gtaylor
gtaylor
opened on Apr 7, 2016
Issue body actions

Trying to run this sample:
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/monitoring/api/v3/custom_metric.py

Command is:

python custom_metric.py --project_id=evennia-game-directory

Output is:

  File "/home/gtaylor/workspace/evennia-game-dir/evennia_gamedir/views/game_list.py", line 13, in game_list
    metric_poop()
  File "/home/gtaylor/workspace/evennia-game-dir/evennia_gamedir/views/game_list.py", line 60, in metric_poop
    name=project_resource, body=metrics_descriptor).execute()
  File "/home/gtaylor/workspace/evennia-game-dir/lib/oauth2client/util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/gtaylor/workspace/evennia-game-dir/lib/googleapiclient/http.py", line 760, in execute
    raise HttpError(resp, content, uri=self.uri)
HttpError: <HttpError 403 when requesting https://monitoring.googleapis.com/v3/projects/evennia-game-directory/metricDescriptors?alt=json returned "Google Monitoring API has not been used in project 32555940559 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/monitoring/overview?project=32555940559 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.">
INFO     2016-04-07 05:43:27,970 module.py:787] default: "GET / HTTP/1.1" 500 291

It's tossing out a weird project ID, so when I follow the link I get something odd:
image
Seems like it's got me in some invalid project.

If I go to the actual project and look at the permissions, I've got them enabled (as of 20+ minutes ago):
image

Any ideas? I'm aiming to get this working within App Engine, which I'm not sure is even possible. I'm running these samples from my dev machine with the latest gcloud SDK after having done gcloud auth login.

Activity

  1. waprin commented on Apr 7, 2016

    @waprin
    waprin
    on Apr 7, 2016
    Contributor
    More actions

    Use gcloud beta auth application-default login instead of gcloud auth login.

    It's a long story, but the short one is that monitoring is a unique API in that the project making the project is billed, so gcloud auth login does not provide the correct credentials. The new command is designed to fix it, and eventually will be recommended for all local code samples (gcloud auth login will only be for actual gcloud commands).

    You may also just need to wait a few minutes and/or click on the actual Stackdriver Monitoring screen in the Cloud console and add your account to Stackdriver.

    Sorry for the complexity :-\

  2. gtaylor commented on Apr 7, 2016

    @gtaylor
    gtaylor
    on Apr 7, 2016
    ContributorAuthor
    More actions

    Using your suggested beta equivalent seems to have fixed things. Thanks!

  3. gtaylor
    closed this as completedon Apr 7, 2016
  4. waprin commented on Apr 7, 2016

    @waprin
    waprin
    on Apr 7, 2016
    Contributor
    More actions

    Cool, @gtaylor just FYI some other APIs might not work with the beta command and will need gcloud auth login. We realize this is a messy story right now, trying to fix it up. The most reliabiable, consistent way to make sure this works is to create a service account and download a JSON key file and point GOOGLE_APPLICATION_CREDENTIALS environment variable to the key file. Just a heads up.

  5. waprin
    reopened this on Apr 7, 2016
  6. waprin
    closed this as completedon Apr 7, 2016
  7. gtaylor commented on Apr 7, 2016

    @gtaylor
    gtaylor
    on Apr 7, 2016
    ContributorAuthor
    More actions

    Thanks, I might go on ahead and do that.

  8. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 7, 2020
  9. m-strzelczyk
    added a commit that references this issue on Nov 9, 2022

    docs(samples): Add samples for moving VM to different regions/zones (#…

    0adb8b6
  10. donmccasland
    added a commit that references this issue on Nov 11, 2022

    chore(deps): update all dependencies (#244)

    911a278
  11. msampathkumar
    added a commit that references this issue on Nov 14, 2022

    chore: drop mention of Python 2.7 from templates (#244)

    2a4f2fd
  12. dandhlee
    added a commit that references this issue on Nov 16, 2022

    docs(samples): Add samples for moving VM to different regions/zones (#…

    eb49e2c
  13. telpirion
    added a commit that references this issue on Jan 18, 2023

    chore(samples): update dialogflow version (#244)

    64e2f27
  14. Sita04
    added a commit that references this issue on Jan 25, 2023

    feat: migrate code from googleapis/python-iam (#8497)

    469adec
  15. dandhlee
    added a commit that references this issue on Feb 6, 2023

    chore(samples): update dialogflow version (#244)

    83153ed
  16. telpirion
    added 2 commits that reference this issue on Mar 13, 2023

    feat: migrate code from googleapis/python-iam (#8497)

    cc1f05e

    chore(samples): update dialogflow version (#244)

    9f799b7
  17. parthea
    added 2 commits that reference this issue on Jun 8, 2023

    chore(deps): update dependency google-api-python-client to v2.64.0 (#244

    3eb4760

    chore(deps): update dependency google-api-python-client to v2.64.0 (#244

    8a0cea3
  18. dizcology
    added a commit that references this issue on Sep 11, 2023

    chore(deps): update dependency google-cloud-videointelligence to v2.5…

    6afeb07
  19. leahecole
    added a commit that references this issue on Sep 15, 2023

    chore(deps): update dependency google-cloud-videointelligence to v2.5…

    ca4b51e
  20. Linchin
    added a commit that references this issue on Aug 18, 2025

    chore(deps): update dependency google-cloud-bigquery-storage to v2.6.2 (

    8626f7f
  21. glasnt
    added a commit that references this issue on Sep 16, 2025

    chore: migrate handwritten samples from googleapis/python-bigquery-st…

    dada3ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.