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

Improve error handling and messaging for cloud-logging #1054

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

MichaelDoyle
Copy link
Member

@MichaelDoyle MichaelDoyle commented Oct 16, 2024

The general idea is, the first time we hit an auth error with telemetry related APIs, we log some helpful information about how to resolve it, which includes a gcloud command with your project and service account name filled in. After that, we don't log - but we could optionally log out telemetry that "would have" been sent.

Caveats

  • Locally, it's a bit weird because you aren't running as a service account
  • I was able to "impersonate" a gcp service account locally to try and test it, I have not yet done it in prod.
  • Currently - I cannot get metrics to fail locally? even without permission?

Errors look like this:

Unable to send logs to Google Cloud: 7 PERMISSION_DENIED: Permission 'logging.logEntries.create' denied on resource (or it may not exist).

Add the role 'roles/logging.logWriter' to your Service Account in the IAM & Admin page on the Google Cloud console, or use the following command:

gcloud projects add-iam-policy-binding prompt-management-401514 \
    --member=serviceAccount:[email protected] \
    --role=roles/logging.logWriter
Unable to send telemetry to Google Cloud: batchWriteSpans error: 7 PERMISSION_DENIED: The caller does not have permission

Add the role 'roles/cloudtrace.agent' to your Service Account in the IAM & Admin page on the Google Cloud console, or use the following command:

gcloud projects add-iam-policy-binding prompt-management-401514 \
    --member=serviceAccount:[email protected] \
    --role=roles/cloudtrace.agent

TODO:

  • Logging
  • Metrics
  • Tracing

@MichaelDoyle MichaelDoyle force-pushed the improve-cloud-telemetry-errors branch 2 times, most recently from c38789a to bfe5932 Compare October 16, 2024 20:41
@MichaelDoyle MichaelDoyle force-pushed the improve-cloud-telemetry-errors branch 3 times, most recently from f52bcc8 to e7070d4 Compare October 18, 2024 20:20
@MichaelDoyle MichaelDoyle marked this pull request as ready for review October 18, 2024 20:27
js/plugins/google-cloud/src/utils.ts Outdated Show resolved Hide resolved
@MichaelDoyle MichaelDoyle force-pushed the improve-cloud-telemetry-errors branch 15 times, most recently from 37af6a7 to bd08554 Compare October 23, 2024 15:45
@MichaelDoyle MichaelDoyle force-pushed the improve-cloud-telemetry-errors branch 2 times, most recently from a8daf2d to 26426fb Compare October 23, 2024 18:26
@MichaelDoyle MichaelDoyle merged commit cd6e10f into next Oct 23, 2024
4 checks passed
@MichaelDoyle MichaelDoyle deleted the improve-cloud-telemetry-errors branch October 23, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants