Skip to content

[logger.logstore] Add log retrieval via GetProbeStatus gRPC - #1286

Merged
manugarg merged 2 commits into
mainfrom
add-log-store-grpc
Apr 9, 2026
Merged

manugarg merged 2 commits into
mainfrom
add-log-store-grpc

Conversation

@manugarg

@manugarg manugarg commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Details

Proto changes (prober/proto/service.proto):

  • GetProbeStatusRequest: added include_logs (bool) and log_limit (int32, default 100)
  • New LogEntry message with timestamp_sec/nsec, level, message, attributes map
  • ProbeStatus: added repeated LogEntry logs

Implementation: When include_logs=true, queries logger.DefaultLogStore() per probe name and includes entries in the response.

All new fields are optional — fully backward compatible.

Test plan

  • go test ./prober/... — existing tests pass
  • go build ./... — full build passes
  • Manual: grpcurl call GetProbeStatus with include_logs=true

@manugarg
manugarg force-pushed the add-log-store-grpc branch 2 times, most recently from 01099fb to 90e2e1d Compare April 8, 2026 06:58
@manugarg
manugarg force-pushed the add-log-store-core branch 3 times, most recently from 175db24 to a76454a Compare April 8, 2026 18:28
Base automatically changed from add-log-store-core to main April 9, 2026 01:52
Extend GetProbeStatus to optionally include recent log entries:
- Add include_logs and log_limit fields to GetProbeStatusRequest
- Add LogEntry message with timestamp, level, message, attributes
- Add repeated LogEntry logs to ProbeStatus response
- Query LogStore per probe name in serviceimpl
@manugarg
manugarg force-pushed the add-log-store-grpc branch from 90e2e1d to 2c4dba7 Compare April 9, 2026 02:55
@manugarg manugarg changed the title Add log retrieval via GetProbeStatus gRPC [logger.logstore] Add log retrieval via GetProbeStatus gRPC Apr 9, 2026
@manugarg

manugarg commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

I asked Claude to run the manual test as well:

Manual E2E Test: grpcurl GetProbeStatus with logs

Started cloudprober with two HTTP probes (google_http, cloudprober_http) and grpc_port: 9314.

1. Without include_logs — no logs in response

$ grpcurl -plaintext -d '{}' localhost:9314 cloudprober.Cloudprober/GetProbeStatus

{
  "probeStatus": [
    {
      "name": "google_http",
      "targetStatus": [{"targetName": "www.google.com", "total": "0", "success": "0"}]
    },
    {
      "name": "cloudprober_http",
      "targetStatus": [{"targetName": "cloudprober.org", "total": "0", "success": "0"}]
    }
  ]
}

2. With include_logs: true — logs returned per probe

$ grpcurl -plaintext -d '{"include_logs": true}' localhost:9314 cloudprober.Cloudprober/GetProbeStatus
{
  "probeStatus": [
    {
      "name": "google_http",
      "targetStatus": [{"targetName": "www.google.com", "total": "5", "success": "5"}],
      "logs": [
        {
          "timestampSec": "1775704652", "timestampNsec": 703055340,
          "level": "INFO", "message": "Targets update interval: 1m0s",
          "attributes": {"probe": "google_http", "system": "cloudprober"}
        },
        {
          "timestampSec": "1775704652", "timestampNsec": 703112377,
          "level": "INFO", "message": "Probe(google_http) targets updated: map[www.google.com__0:ADD]",
          "attributes": {"probe": "google_http", "system": "cloudprober"}
        }
      ]
    },
    {
      "name": "cloudprober_http",
      "targetStatus": [{"targetName": "cloudprober.org", "total": "5", "success": "5"}],
      "logs": [
        {
          "timestampSec": "1775704653", "timestampNsec": 703420966,
          "level": "INFO", "message": "Targets update interval: 1m0s",
          "attributes": {"probe": "cloudprober_http", "system": "cloudprober"}
        },
        {
          "timestampSec": "1775704653", "timestampNsec": 703497256,
          "level": "INFO", "message": "Probe(cloudprober_http) targets updated: map[cloudprober.org__0:ADD]",
          "attributes": {"probe": "cloudprober_http", "system": "cloudprober"}
        }
      ]
    }
  ]
}

3. With log_limit: 1 — only most recent entry per probe

$ grpcurl -plaintext -d '{"include_logs": true, "log_limit": 1}' localhost:9314 cloudprober.Cloudprober/GetProbeStatus
{
  "probeStatus": [
    {
      "name": "google_http",
      "targetStatus": [{"targetName": "www.google.com", "total": "10", "success": "10"}],
      "logs": [
        {
          "timestampSec": "1775704652", "timestampNsec": 703112377,
          "level": "INFO", "message": "Probe(google_http) targets updated: map[www.google.com__0:ADD]",
          "attributes": {"probe": "google_http", "system": "cloudprober"}
        }
      ]
    },
    {
      "name": "cloudprober_http",
      "targetStatus": [{"targetName": "cloudprober.org", "total": "10", "success": "10"}],
      "logs": [
        {
          "timestampSec": "1775704653", "timestampNsec": 703497256,
          "level": "INFO", "message": "Probe(cloudprober_http) targets updated: map[cloudprober.org__0:ADD]",
          "attributes": {"probe": "cloudprober_http", "system": "cloudprober"}
        }
      ]
    }
  ]
}

@manugarg
manugarg merged commit 4eb9def into main Apr 9, 2026
12 checks passed
@manugarg
manugarg deleted the add-log-store-grpc branch April 9, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant