Skip to content

feat(target): expose gRPC state metric - #932

Open
senthilsam wants to merge 2 commits into
openconfig:mainfrom
senthilsam:feat/add-rpc-state-metric
Open

feat(target): expose gRPC state metric#932
senthilsam wants to merge 2 commits into
openconfig:mainfrom
senthilsam:feat/add-rpc-state-metric

Conversation

@senthilsam

@senthilsam senthilsam commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Introduces gnmic_target_grpc_status_code metric to reflect grpc status code at runtime

# HELP gnmic_target_grpc_status_code The last gRPC status code received from the target. Default is 2 (Unknown) until the first response is received. See https://pkg.go.dev/google.golang.org/grpc/codes. Values: 0=OK, 1=Canceled, 2=Unknown, 3=InvalidArgument, 4=DeadlineExceeded, 5=NotFound, 6=AlreadyExists, 7=PermissionDenied, 8=ResourceExhausted, 9=FailedPrecondition, 10=Aborted, 11=OutOfRange, 12=Unimplemented, 13=Internal, 14=Unavailable, 15=DataLoss, 16=Unauthenticated.
# TYPE gnmic_target_grpc_status_code gauge
gnmic_target_grpc_status_code{name="test-sim-amps-device-1"} 0

During authentication error:

gnmic log
time=2026-07-22T09:33:39.375+05:30 level=INFO msg="subscription receive error" target=test.device.net subscription=test-sample-5m err="rpc error: code = Unauthenticated desc = Authentication has failed"

Generated metric


# HELP gnmic_target_grpc_status_code The last gRPC status code received from the target. Default is 2 (Unknown) until the first response is received. See https://pkg.go.dev/google.golang.org/grpc/codes. Values: 0=OK, 1=Canceled, 2=Unknown, 3=InvalidArgument, 4=DeadlineExceeded, 5=NotFound, 6=AlreadyExists, 7=PermissionDenied, 8=ResourceExhausted, 9=FailedPrecondition, 10=Aborted, 11=OutOfRange, 12=Unimplemented, 13=Internal, 14=Unavailable, 15=DataLoss, 16=Unauthenticated.
# TYPE gnmic_target_grpc_status_code gauge
gnmic_target_grpc_status_code{name="test.device.net"} 16

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.

2 participants