Skip to content

httpRequest - latency isn't working #93

@njLT

Description

@njLT

Environment details

  • OS: MacOS X 10.13.5/Debian 9
  • Node.js version: 6.10.3/8.11.3
  • npm version: 3.10.10/5.6.0
  • @google-cloud/logging-winston version: 0.9.0

Steps to reproduce

  1. produce a log containing a httpRequest object which includes latency (these docs state latency should be a number appended with an 's'. fixing the value to "3.5s" as given in the example is producing an error.

Sample code:

let message = {
  requestMethod: "GET",
  requestUrl: "/api/getuserareas/randuser",
  status: 200,
  responseSize: "2",
  userAgent: "PostmanRuntime/7.1.5",
  remoteIp: "::1",
  latency: "3.5s"
  protocol: "HTTP/1.1"
}

logger.info("requested " + message.requestUrl, {
  httpRequest: message
});

Console output:

info: requested /api/getuserareas/randuser requestMethod=GET, requestUrl=/api/getuserareas/randuser, status=200, responseSize=2, userAgent=PostmanRuntime/7.1.5, remoteIp=::1, latency=3.5s, protocol=HTTP/1.1

Error:

undefined:50
  throw TypeError(".google.logging.type.HttpRequest.latency: object expected")
  ^

TypeError: .google.logging.type.HttpRequest.latency: object expected
    at TypeError (native)
    at Type.HttpRequest$fromObject [as fromObject] (eval at Codegen (/Users/nishant/Documents/feild_ops_server/node_modules/@protobufjs/codegen/index.js:52:20), <anonymous>:50:9)
    at Type.LogEntry$fromObject [as fromObject] (eval at Codegen (/Users/nishant/Documents/feild_ops_server/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:82:26)
    at Type.WriteLogEntriesRequest$fromObject [as fromObject] (eval at Codegen (/Users/nishant/Documents/feild_ops_server/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:30:25)
    at serialize (/Users/nishant/Documents/feild_ops_server/node_modules/grpc/src/protobuf_js_6_common.js:70:23)
    at ServiceClient.Client.makeUnaryRequest (/Users/nishant/Documents/feild_ops_server/node_modules/grpc/src/client.js:544:17)
    at apply (/Users/nishant/Documents/feild_ops_server/node_modules/lodash/lodash.js:470:17)
    at ServiceClient.wrapper (/Users/nishant/Documents/feild_ops_server/node_modules/lodash/lodash.js:5329:16)
    at /Users/nishant/Documents/feild_ops_server/node_modules/@google-cloud/logging/src/v2/logging_service_v2_client.js:188:39
    at Task.timeoutFunc [as _apiCall] (/Users/nishant/Documents/feild_ops_server/node_modules/google-gax/lib/api_callable.js:171:12)
    at Task.run (/Users/nishant/Documents/feild_ops_server/node_modules/google-gax/lib/bundling.js:206:29)
    at BundleExecutor._runNow (/Users/nishant/Documents/feild_ops_server/node_modules/google-gax/lib/bundling.js:477:8)
    at Timeout._onTimeout (/Users/nishant/Documents/feild_ops_server/node_modules/google-gax/lib/bundling.js:416:12)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)

Is the latency value supposed to be something else? I did try making it numeric (removing the 's'), which didn't work either. No error is produced if the latency field is removed.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: loggingIssues related to the googleapis/nodejs-logging-winston API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions