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

cloud logging example is misleading where labels.instance_id has to be STRING #1238

Closed
faithseed opened this issue Apr 15, 2016 · 6 comments
Closed
Assignees
Labels
api: logging Issues related to the Cloud Logging API.

Comments

@faithseed
Copy link
Contributor

The doc says string for instance_id

var resource = {
type: 'gce_instance',
labels: {
zone: 'global',
instance_id: 3
}
};

yet in practice, you will hit the following if you pass an int. ugh...

{ [ApiError: Invalid value at 'entries[0].resource.labels[0].value' (TYPE_STRING), 1]
errors: undefined,
code: 400,
response: undefined,
message: 'Invalid value at 'entries[0].resource.labels[0].value' (TYPE_STRING), 1' }

@stephenplusplus
Copy link
Contributor

Can you show the code you're using? The code from the readme works for me.

Also, which version of gcloud-node are you running?

@faithseed
Copy link
Contributor Author

faithseed commented Apr 16, 2016

We use:
"gcloud": "0.28.0",

  resource = {
      type: 'gce_instance',
      labels: {
         instance_id: instance_id,
         zone: zone
      }
   };

   log.write([ logEntry ], function (err, apiResponse) {
         if (err) {
            logger.error(err);
         }
      });

@faithseed
Copy link
Contributor Author

https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry

also this say labels are string?

labels map (key: string, value: string)

@stephenplusplus stephenplusplus added the api: logging Issues related to the Cloud Logging API. label Apr 16, 2016
@stephenplusplus
Copy link
Contributor

I was able to reproduce. Thanks for catching this. Any chance you'd be willing to send a PR with the fix for the docs?

@faithseed
Copy link
Contributor Author

sure, will do

@stephenplusplus
Copy link
Contributor

Fixed by #1241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API.
Projects
None yet
Development

No branches or pull requests

2 participants