Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gtaylor opened this issue Apr 7, 2016 · 4 comments
Closed
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@gtaylor
Copy link
Contributor

gtaylor commented Apr 7, 2016

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.

@waprin
Copy link
Contributor

waprin commented Apr 7, 2016

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 :-\

@gtaylor
Copy link
Contributor Author

gtaylor commented Apr 7, 2016

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

@gtaylor gtaylor closed this as completed Apr 7, 2016
@waprin
Copy link
Contributor

waprin commented Apr 7, 2016

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.

@waprin waprin reopened this Apr 7, 2016
@waprin waprin closed this as completed Apr 7, 2016
@gtaylor
Copy link
Contributor Author

gtaylor commented Apr 7, 2016

Thanks, I might go on ahead and do that.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
m-strzelczyk added a commit that referenced this issue Nov 9, 2022
…244)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
msampathkumar pushed a commit that referenced this issue Nov 14, 2022
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
dandhlee pushed a commit that referenced this issue Nov 16, 2022
…244)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sita04 added a commit that referenced this issue Jan 25, 2023
* feat!: migrate to microgenerator (#26)

* docs(samples): add deny samples and tests (#209)

* docs(samples): init add deny samples and tests

* docs(samples): added requirements.txt

* docs(samples): minor update and refactoring

* added nox files

* added comments and minor refactoring

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* added region tags

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* added region tags

* modified comments acc to review

* modified comments acc to review

* updated env var

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* modified acc to review comments

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* modified acc to review comments

* added init.py

* updated acc to review comments

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: nicain <nicholascain@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update all dependencies (#217)

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update all dependencies (#218)

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update dependency google-cloud-iam to v2.8.2 (#225)

* chore: detect samples tests in nested directories (#236)

Source-Link: googleapis/synthtool@50db768
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978

* feat: Add client for IAM Deny v2 API (#230)

* feat: Create the public IAM Deny v2 API

PiperOrigin-RevId: 470600752

Source-Link: googleapis/googleapis@dac66f6

Source-Link: googleapis/googleapis-gen@729529e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzI5NTI5ZWRjMTAzZTQ1MDg3ZmZhZTgzNTNlYWYwMDlhZDdmZThjMiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* regenerate files using cl/470713093

* workaround docstring formatting issue

* add pytest to samples CI

* lint

* fix import statement in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs(samples): migrate samples from iam_v2beta to iam_v2

* update required checks to include samples

* use GOOGLE_CLOUD_PROJECT

* fix imports in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add pytest

* chore(python): prepare for release of the iam/v2 python client

PiperOrigin-RevId: 471240188

Source-Link: googleapis/googleapis@ea847a1

Source-Link: googleapis/googleapis-gen@6f1e4cd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmYxZTRjZDAxM2FiMjkxNDc3MzgyNmU2OGIyYTJkMDc2MzAzMGEzOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Bump gapic-generator-python version to 1.3.0

PiperOrigin-RevId: 472561635

Source-Link: googleapis/googleapis@332ecf5

Source-Link: googleapis/googleapis-gen@4313d68
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: use gapic-generator-python 1.3.1

PiperOrigin-RevId: 472772457

Source-Link: googleapis/googleapis@855b74d

Source-Link: googleapis/googleapis-gen@b64b1e7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: integrate  gapic-generator-python-1.4.1 and enable more py_test targets

PiperOrigin-RevId: 473833416

Source-Link: googleapis/googleapis@565a550

Source-Link: googleapis/googleapis-gen@1ee1a06
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMWEwNmM2ZGUzY2E4Yjg0MzU3MmMxZmRlMDU0OGY4NDIzNjk4OSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* updated test to delete stale policies and avoid quota error

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat!: remove ListApplicablePolicies

PiperOrigin-RevId: 475955031

Source-Link: googleapis/googleapis@65376f4

Source-Link: googleapis/googleapis-gen@c8504e9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzg1MDRlOTc4OTFlZDllNjY0Y2Y2ODI3MGQ3ZTYxYmVjMTYwZmU1NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* samples: wait for the operation to complete

* samples: minor refactoring

* use project `python-docs-samples-tests`

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
Co-authored-by: SitaLakshmi <sita1996@gmail.com>

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

* removing noxfile.py, adding CODEOWNERS and blunderbuss config

* fixing up test infra

* test infra fix

* testing with secrets

Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: nicain <nicholascain@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: WhiteSource Renovate <renovate@whitesourcesoftware.com>
Co-authored-by: WhiteSource Renovate <bot@renovateapp.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: SitaLakshmi <sita1996@gmail.com>
Co-authored-by: Maciej Strzelczyk <strzelczyk@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
telpirion pushed a commit that referenced this issue Mar 13, 2023
* feat!: migrate to microgenerator (#26)

* docs(samples): add deny samples and tests (#209)

* docs(samples): init add deny samples and tests

* docs(samples): added requirements.txt

* docs(samples): minor update and refactoring

* added nox files

* added comments and minor refactoring

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* added region tags

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* added region tags

* modified comments acc to review

* modified comments acc to review

* updated env var

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* modified acc to review comments

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* modified acc to review comments

* added init.py

* updated acc to review comments

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: nicain <nicholascain@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update all dependencies (#217)

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update all dependencies (#218)

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* chore(deps): update dependency google-cloud-iam to v2.8.2 (#225)

* chore: detect samples tests in nested directories (#236)

Source-Link: googleapis/synthtool@50db768
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978

* feat: Add client for IAM Deny v2 API (#230)

* feat: Create the public IAM Deny v2 API

PiperOrigin-RevId: 470600752

Source-Link: googleapis/googleapis@dac66f6

Source-Link: googleapis/googleapis-gen@729529e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzI5NTI5ZWRjMTAzZTQ1MDg3ZmZhZTgzNTNlYWYwMDlhZDdmZThjMiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* regenerate files using cl/470713093

* workaround docstring formatting issue

* add pytest to samples CI

* lint

* fix import statement in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs(samples): migrate samples from iam_v2beta to iam_v2

* update required checks to include samples

* use GOOGLE_CLOUD_PROJECT

* fix imports in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add pytest

* chore(python): prepare for release of the iam/v2 python client

PiperOrigin-RevId: 471240188

Source-Link: googleapis/googleapis@ea847a1

Source-Link: googleapis/googleapis-gen@6f1e4cd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmYxZTRjZDAxM2FiMjkxNDc3MzgyNmU2OGIyYTJkMDc2MzAzMGEzOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Bump gapic-generator-python version to 1.3.0

PiperOrigin-RevId: 472561635

Source-Link: googleapis/googleapis@332ecf5

Source-Link: googleapis/googleapis-gen@4313d68
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: use gapic-generator-python 1.3.1

PiperOrigin-RevId: 472772457

Source-Link: googleapis/googleapis@855b74d

Source-Link: googleapis/googleapis-gen@b64b1e7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: integrate  gapic-generator-python-1.4.1 and enable more py_test targets

PiperOrigin-RevId: 473833416

Source-Link: googleapis/googleapis@565a550

Source-Link: googleapis/googleapis-gen@1ee1a06
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMWEwNmM2ZGUzY2E4Yjg0MzU3MmMxZmRlMDU0OGY4NDIzNjk4OSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* updated test to delete stale policies and avoid quota error

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat!: remove ListApplicablePolicies

PiperOrigin-RevId: 475955031

Source-Link: googleapis/googleapis@65376f4

Source-Link: googleapis/googleapis-gen@c8504e9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzg1MDRlOTc4OTFlZDllNjY0Y2Y2ODI3MGQ3ZTYxYmVjMTYwZmU1NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* samples: wait for the operation to complete

* samples: minor refactoring

* use project `python-docs-samples-tests`

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
Co-authored-by: SitaLakshmi <sita1996@gmail.com>

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

* removing noxfile.py, adding CODEOWNERS and blunderbuss config

* fixing up test infra

* test infra fix

* testing with secrets

Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: nicain <nicholascain@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: WhiteSource Renovate <renovate@whitesourcesoftware.com>
Co-authored-by: WhiteSource Renovate <bot@renovateapp.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: SitaLakshmi <sita1996@gmail.com>
Co-authored-by: Maciej Strzelczyk <strzelczyk@google.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants