Diagnostic logs

Mock.qa offers diagnostic endpoints to help users troubleshoot and debug their mock service during development. These endpoints can be useful for identifying and fixing issues with the service, as well as for understanding how the service is functioning.

Status endpoint

The status endpoint provides information about the routing details and online/offline status of the service. If the service is marked as "online", it means that it has been initialized and is ready to accept requests. Initialization occurs when the first request is sent to the mock service. This endpoint can be useful for tracking the status of the mock service and validating the version (sha) of the config and .proto file.

  • HTTP GET https://[[instanceName→]repo→]<owner>.grpc.qa/__admin/status
  • HTTP GET https://[[instanceName→]repo→]<owner>.rest.qa/__admin/status

Examples:

gRPC mock offline response:

{
  "routing": {
    "repository": "mockqa/hello-world-grpc",
    "instance": "greet",
    "gitRef": null
  },
  "status": "offline"
}

gRPC mock online response:

{
  "routing": {
    "repository": "mockqa/hello-world-grpc",
    "instance": "greet",
    "gitRef": null
  },
  "status": "online",
  "updated": "2022-12-27T18:19:46.9207816+00:00",
  "mock": {
    "uptime": "00:00:02.4372787",
    "instanceName": "Greet",
    "protoFile": "https://github.com/mockqa/hello-world-grpc/blob/main/greet.proto",
    "protoFileSha": "788a73744e41925fa29c1cfac48746cef85ac6e9",
    "configFile": "https://github.com/mockqa/hello-world-grpc/blob/main/.grpc.mock.qa.yaml",
    "configFileSha": "8efea2037bb702743b88138c34441a9ebd15c46f"
  }
}

Trace endpoint

The trace endpoint allows users to retrieve log entries for debugging and troubleshooting purposes. It uses a correlation id value, which is included in the x-mockqa-correlation-id HTTP header of every response from the mock service. This can be useful for tracking the processing of incoming requests and identifying any issues that may have occurred.

  • HTTP GET https://[[instanceName→]repo→]<owner>.grpc.qa/__admin/trace?correlationId=<correlationId>[&format=<json|csv>]
  • HTTP GET https://[[instanceName→]repo→]<owner>.rest.qa/__admin/trace?correlationId=<correlationId>[&format=<json|csv>]

JSON format is in use by Playground and supports collapsible entries for better user experience:

diagnostic-log

CSV format example:

2022-12-27T19:34:01.769: INF: GRPC Request received
2022-12-27T19:34:01.769: INF: Sender IP = XXX.XXX.XXX.XXX
2022-12-27T19:34:01.769: INF: Repository = mockqa/hello-world-grpc
2022-12-27T19:34:01.769: INF: Instance = greet
2022-12-27T19:34:01.769: INF: Method = /greet.Greeter/SayHello
2022-12-27T14:34:01.770: INF: Account limits validation
2022-12-27T14:34:01.770: INF: Account marketplace plan: Free plan
2022-12-27T14:34:01.770: INF: Daily requests: used 15 out of 1000; Monthly requests: used 43 out of 5000
2022-12-27T14:34:01.770: INF: Matching by method name
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #1: call matched
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #2: call matched
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #3: call matched
2022-12-27T14:34:01.770: INF: Matched 3 calls
2022-12-27T14:34:01.770: INF: Credentials validation
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #1: credentials validation passed
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #2: credentials validation passed
2022-12-27T14:34:01.770: INF: GRPC greet.Greeter/SayHello #3: credentials validation passed
2022-12-27T14:34:01.770: INF: Number of authorized calls: 3
2022-12-27T14:34:01.771: INF: Evaluating 'GRPC greet.Greeter/SayHello #1'
2022-12-27T14:34:01.771: INF: Evaluating request.body
2022-12-27T14:34:01.771: ERR: MISMATCH: request.body.Name: equalTo: expected: "Joe": actual: "Kelly"
2022-12-27T14:34:01.771: INF: Skipping, request body mismatch
2022-12-27T14:34:01.771: INF: Evaluating 'GRPC greet.Greeter/SayHello #2'
2022-12-27T14:34:01.771: INF: Evaluating request.body
2022-12-27T14:34:01.771: INF: MATCH: request.body.Name: equalTo: "Kelly"
2022-12-27T14:34:01.771: INF: Call matched
2022-12-27T14:34:01.772: INF: Request completed; StatusCode=200; Elapsed: 3.146 ms