Skip to content

feat: add GetTaskQueueUserData RPC to admin service#9934

Open
veeral-patel wants to merge 3 commits intotemporalio:mainfrom
veeral-patel:feature/task-queue-get-user-data-admin-rpc
Open

feat: add GetTaskQueueUserData RPC to admin service#9934
veeral-patel wants to merge 3 commits intotemporalio:mainfrom
veeral-patel:feature/task-queue-get-user-data-admin-rpc

Conversation

@veeral-patel
Copy link
Copy Markdown

@veeral-patel veeral-patel commented Apr 13, 2026

What changed?

This PR adds a new GetTaskQueueUserData RPC to the admin service.

Given a namespace, task queue name, task queue type, and optional partition ID (default is 0, which is root), it returns the user data currently loaded by that partition.

This PR wraps the existing GetTaskQueueUserData RPC in Matching Service. We will also create a tdbg command which calls this Admin Service RPC, in a separate PR.

Why?

Each task queue family has associated metadata, stored in TaskQueueUserData. Metadata related to worker versioning, queue rate limiting, fairness are all stored in TaskQueueUserData.

TaskQueueUserData is replicated from the root partition to all other partitions.

However, there is no admin-accessible way to read the user data loaded by a specific partition or compare versions across partitions to diagnose replication lag.

Files changed

File Change
proto/internal/.../adminservice/v1/request_response.proto Added GetTaskQueueUserDataRequest and GetTaskQueueUserDataResponse messages
proto/internal/.../adminservice/v1/service.proto Added GetTaskQueueUserData RPC to AdminService
service/frontend/admin_handler.go Implemented AdminHandler.GetTaskQueueUserData: validates request, resolves namespace → ID, builds partition RPC name via tqid, calls matching service, returns per-type entry + version
service/frontend/admin_handler_test.go Added unit tests

How did you test it?

  • built
  • run locally and tested manually
  • added new unit test(s)
  • added new integration test(s) - not applicable, not touching persistence layer
  • added new functional test(s)

Unit tests

100% unit test coverage

Test case Input Expected
Nil request request == nil errRequestNotSet
Empty namespace namespace == "" errNamespaceNotSet
Namespace not found Namespace registry returns not-found Error propagated; matching never called
Invalid task queue name task_queue starts with /_sys/ INVALID_ARGUMENT from tqid.NewTaskQueueFamily; matching never called
Root partition partition_id=0, workflow type Sends bare name my-queue to matching; returns correct user_data and version
Non-root partition partition_id=1, workflow type Sends mangled name /_sys/my-queue/1 to matching
No per-type data Matching returns response with empty per_type map user_data is nil; version still populated
Matching error Matching client returns error Error propagated to caller

Functional tests

Test Setup What it verifies
TestAdminGetTaskQueueUserData_RootPartition Write fairness weight config to a workflow task queue Admin RPC resolves namespace by name, routes to root partition (partition_id=0), returns version > 0 and non-nil per-type data
TestAdminGetTaskQueueUserData_NonRootPartition Same write, then poll until non-root partition replicates Admin RPC routes to a non-root partition (partition_id=1) via mangled name, returns the same version as root after replication

Manual tests

Setup
  1. Build and start the server: make temporal-server && make start-sqlite
  2. Create namespace: temporal operator namespace create default
  3. Insert assignment rule: temporal task-queue versioning insert-assignment-rule
Case 1 — Root partition, workflow type
grpcurl -plaintext \
  -d '{"namespace":"default","task_queue":"my-queue","task_queue_type":"TASK_QUEUE_TYPE_WORKFLOW"}' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
{
  "version": "1"
}
Case 2 — Root partition, activity type
grpcurl -plaintext \
  -d '{"namespace":"default","task_queue":"my-queue","task_queue_type":"TASK_QUEUE_TYPE_ACTIVITY"}' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
{
  "version": "1"
}
Case 3 — Non-root partition, workflow type
grpcurl -plaintext \
  -d '{"namespace":"default","task_queue":"my-queue","task_queue_type":"TASK_QUEUE_TYPE_WORKFLOW","partition_id":1}' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
{
  "version": "1"
}
Case 4 — Non-root partition, activity type
grpcurl -plaintext \
  -d '{"namespace":"default","task_queue":"my-queue","task_queue_type":"TASK_QUEUE_TYPE_ACTIVITY","partition_id":1}' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
{
  "version": "1"
}
Case 5 — Non-root partition, activity type, with user data

Setup: Add rate limit config

grpcurl -plaintext \
  -d '{
    "namespace": "default",
    "task_queue": "my-queue",
    "task_queue_type": "TASK_QUEUE_TYPE_ACTIVITY",
    "update_queue_rate_limit": {
      "rate_limit": {
        "requests_per_second": 50.0
      },
      "reason": "manual test"
    }
  }' \
  localhost:7233 \
  temporal.api.workflowservice.v1.WorkflowService/UpdateTaskQueueConfig
grpcurl -plaintext \
  -d '{
    "namespace": "default",
    "task_queue": "my-queue",
    "task_queue_type": "TASK_QUEUE_TYPE_ACTIVITY"
  }' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
{
  "userData": {
    "config": {
      "queueRateLimit": {
        "rateLimit": {
          "requestsPerSecond": 50
        },
        "metadata": {
          "reason": "manual test",
          "updateTime": "2026-04-13T21:40:39.888Z"
        }
      }
    }
  },
  "version": "2"
}
Case 6 — Namespace not found
grpcurl -plaintext \
  -d '{"namespace":"nonexistent","task_queue":"my-queue","task_queue_type":"TASK_QUEUE_TYPE_WORKFLOW"}' \
  localhost:7233 \
  temporal.server.api.adminservice.v1.AdminService/GetTaskQueueUserData
ERROR:
  Code: NotFound
  Message: Namespace nonexistent is not found.

NOT_FOUND from namespace registry; matching never called.

Veeral Patel and others added 3 commits April 7, 2026 14:19
Exposes per-type task queue user data via the admin service, proxying to
the existing matching service RPC. Accepts namespace name + task queue +
type + optional partition_id, resolving the partition to its wire-format
RPC name for consistent-hash routing to the correct matching host.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@veeral-patel veeral-patel requested review from a team as code owners April 13, 2026 21:47
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Veeral Patel seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

3 participants