-
Notifications
You must be signed in to change notification settings - Fork 4k
plumb otel subchannel metrics disconnect error #12342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AgraVator
wants to merge
27
commits into
grpc:master
Choose a base branch
from
AgraVator:plumb-otel-subchannel-metrics-disconnect-error
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
62d0969
master pull
AgraVator bf7255e
otel: plumb optional labels other than disconnect_error
AgraVator 57a7007
otel: fixes NPE
AgraVator 464bc68
otel: formatting fixes
AgraVator 65934ac
add test case
AgraVator c63405e
logs the metrics inside sync context
AgraVator d6bb6ec
reframe comments
AgraVator 9073cd4
suggested changes
AgraVator 5bde922
use parameterName
AgraVator c9f99c9
plumb disconnect error
AgraVator e78e690
master pull
AgraVator 1bc9f1a
fixes test cases
AgraVator 91997c9
fixes test cases
AgraVator add122f
fix test cases
AgraVator df736c2
fix test cases
AgraVator e6937b1
fix test cases
AgraVator 24af9ab
fix test cases
AgraVator 898351b
fix test cases
AgraVator 44fc3f9
suggested changes
AgraVator 8568964
fix tests
AgraVator 2c3b757
fix tests
AgraVator 3786365
fix tests
AgraVator feab3b8
fix tests
AgraVator 2ba576a
suggested changes
AgraVator 449a8bc
Merge branch 'master' into plumb-otel-subchannel-metrics-disconnect-e…
AgraVator 4754c1b
remove shutdown() from TransportWithDisconnectReason
AgraVator 66fac05
fixe robolectricBinderTransportTest.clientReportsAuthzErrorToServer()…
AgraVator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright 2025 The gRPC Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.grpc.internal; | ||
|
|
||
| import javax.annotation.concurrent.Immutable; | ||
|
|
||
| /** | ||
| * Represents the reason for a subchannel disconnection. | ||
| * Implementations are either the SimpleDisconnectError enum or the GoAwayDisconnectError class for | ||
| * dynamic ones. | ||
| */ | ||
| @Immutable | ||
| public interface DisconnectError { | ||
| /** | ||
| * Returns the string representation suitable for use as an error tag. | ||
| * | ||
| * @return The formatted error tag string. | ||
| */ | ||
| String toErrorString(); | ||
| } |
64 changes: 64 additions & 0 deletions
64
core/src/main/java/io/grpc/internal/GoAwayDisconnectError.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Copyright 2025 The gRPC Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.grpc.internal; | ||
|
|
||
|
|
||
| import javax.annotation.concurrent.Immutable; | ||
|
|
||
| /** | ||
| * Represents a dynamic disconnection due to an HTTP/2 GOAWAY frame. | ||
| * This class is immutable and holds the specific error code from the frame. | ||
| */ | ||
| @Immutable | ||
| public final class GoAwayDisconnectError implements DisconnectError { | ||
| private static final String ERROR_TAG = "GOAWAY"; | ||
| private final GrpcUtil.Http2Error errorCode; | ||
|
|
||
| /** | ||
| * Creates a GoAway reason. | ||
| * | ||
| * @param errorCode The specific, non-null HTTP/2 error code (e.g., "NO_ERROR"). | ||
| */ | ||
| public GoAwayDisconnectError(GrpcUtil.Http2Error errorCode) { | ||
| if (errorCode == null) { | ||
| throw new NullPointerException("Http2Error cannot be null for GOAWAY"); | ||
| } | ||
| this.errorCode = errorCode; | ||
| } | ||
|
|
||
| @Override | ||
| public String toErrorString() { | ||
| return ERROR_TAG + " " + errorCode.name(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| GoAwayDisconnectError goAwayDisconnectError = (GoAwayDisconnectError) o; | ||
| return errorCode == goAwayDisconnectError.errorCode; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return errorCode.hashCode(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
core/src/main/java/io/grpc/internal/SimpleDisconnectError.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * Copyright 2025 The gRPC Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.grpc.internal; | ||
|
|
||
| import javax.annotation.concurrent.Immutable; | ||
|
|
||
| /** | ||
| * Represents a fixed, static reason for disconnection. | ||
| */ | ||
| @Immutable | ||
| public enum SimpleDisconnectError implements DisconnectError { | ||
| /** | ||
| * The subchannel was shut down for various reasons like parent channel shutdown, | ||
| * idleness, or load balancing policy changes. | ||
| */ | ||
| SUBCHANNEL_SHUTDOWN("subchannel shutdown"), | ||
|
|
||
| /** | ||
| * Connection was reset (e.g., ECONNRESET, WSAECONNERESET). | ||
| */ | ||
| CONNECTION_RESET("connection reset"), | ||
|
|
||
| /** | ||
| * Connection timed out (e.g., ETIMEDOUT, WSAETIMEDOUT), including closures | ||
| * from gRPC keepalives. | ||
| */ | ||
| CONNECTION_TIMED_OUT("connection timed out"), | ||
|
|
||
| /** | ||
| * Connection was aborted (e.g., ECONNABORTED, WSAECONNABORTED). | ||
| */ | ||
| CONNECTION_ABORTED("connection aborted"), | ||
|
|
||
| /** | ||
| * Any socket error not covered by other specific disconnect errors. | ||
| */ | ||
| SOCKET_ERROR("socket error"), | ||
|
|
||
| /** | ||
| * A catch-all for any other unclassified reason. | ||
| */ | ||
| UNKNOWN("unknown"); | ||
|
|
||
| private final String errorTag; | ||
|
|
||
| SimpleDisconnectError(String errorTag) { | ||
| this.errorTag = errorTag; | ||
| } | ||
|
|
||
| @Override | ||
| public String toErrorString() { | ||
| return this.errorTag; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.