-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add new IPC tags #1168
Open
ayangster
wants to merge
12
commits into
main
Choose a base branch
from
ayangster/new-ipc-tags
base: main
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.
+312
−2
Open
Add new IPC tags #1168
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5c7eaaf
Add new IPC tags from IPC Metrics v2 spec
umairk79 bd80ed6
Merge branch 'main' into ayangster/new-ipc-tags
477741c
Add new api metrics values
ba568f4
Add test
d0ee1b0
Remove not found
f2f2f62
Remove extraneous new line
7f434dc
Formatting
1fdadb3
Add API metrics enums
38fbaf7
Formatting
a665f79
Remove inflight metrics
b59978a
Merge branch 'main' into ayangster/new-ipc-tags
2b19bf1
Merge branch 'main' into ayangster/new-ipc-tags
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 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 |
---|---|---|
|
@@ -52,6 +52,7 @@ public final class IpcLogEntry { | |
|
||
private String owner; | ||
private IpcResult result; | ||
private IpcSource source; | ||
|
||
private String protocol; | ||
|
||
|
@@ -64,6 +65,7 @@ public final class IpcLogEntry { | |
|
||
private String vip; | ||
private String endpoint; | ||
private String method; | ||
|
||
private String clientRegion; | ||
private String clientZone; | ||
|
@@ -208,6 +210,14 @@ public IpcLogEntry withResult(IpcResult result) { | |
return this; | ||
} | ||
|
||
/** | ||
* Set the source for this request. See {@link IpcSource} for more information. | ||
*/ | ||
public IpcLogEntry withSource(IpcSource source) { | ||
this.source = source; | ||
return this; | ||
} | ||
|
||
/** | ||
* Set the high level status for the request. See {@link IpcStatus} for more | ||
* information. | ||
|
@@ -307,6 +317,22 @@ public IpcLogEntry withEndpoint(String endpoint) { | |
return this; | ||
} | ||
|
||
/** | ||
* Set the method used for this request. | ||
* See {@link IpcMethod} for possible values. | ||
*/ | ||
public IpcLogEntry withMethod(IpcMethod method) { | ||
return withMethod(method.value()); | ||
} | ||
|
||
/** | ||
* Set the method used for this request. | ||
*/ | ||
public IpcLogEntry withMethod(String method) { | ||
this.method = method; | ||
return this; | ||
} | ||
|
||
/** | ||
* Set the client region for the request. In the case of the server side this will be | ||
* automatically filled in if the {@link NetflixHeader#Zone} is specified on the client | ||
|
@@ -899,6 +925,7 @@ public String toString() { | |
.addField("protocol", protocol) | ||
.addField("uri", uri) | ||
.addField("path", path) | ||
.addField("method", method) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Source and method should also get updated in |
||
.addField("endpoint", endpoint) | ||
.addField("vip", vip) | ||
.addField("clientRegion", clientRegion) | ||
|
@@ -918,6 +945,7 @@ public String toString() { | |
.addField("attempt", attempt) | ||
.addField("attemptFinal", attemptFinal) | ||
.addField("result", result) | ||
.addField("source", source) | ||
.addField("status", status) | ||
.addField("statusDetail", statusDetail) | ||
.addField("exceptionClass", getExceptionClass()) | ||
|
94 changes: 94 additions & 0 deletions
94
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcMethod.java
This file contains 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,94 @@ | ||
/** | ||
* Copyright 2024 Netflix, Inc. | ||
* | ||
* 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 com.netflix.spectator.ipc; | ||
|
||
import com.netflix.spectator.api.Tag; | ||
|
||
public enum IpcMethod implements Tag { | ||
|
||
/** | ||
* Represents a unary gRPC method. | ||
*/ | ||
unary, | ||
|
||
/** | ||
* Represents a client streaming gRPC method. | ||
*/ | ||
client_streaming, | ||
|
||
/** | ||
* Represents a server streaming gRPC method. | ||
*/ | ||
server_streaming, | ||
|
||
/** | ||
* Represents a bidirectional streaming gRPC method. | ||
*/ | ||
bidi_streaming, | ||
|
||
/** | ||
* Represents an HTTP GET request. | ||
*/ | ||
get, | ||
|
||
/** | ||
* Represents an HTTP POST request. | ||
*/ | ||
post, | ||
|
||
/** | ||
* Represents an HTTP PUT request. | ||
*/ | ||
put, | ||
|
||
/** | ||
* Represents an HTTP PATCH request. | ||
*/ | ||
patch, | ||
|
||
/** | ||
* Represents an HTTP DELETE request. | ||
*/ | ||
delete, | ||
|
||
/** | ||
* Represents an HTTP OPTIONS request. | ||
*/ | ||
options, | ||
|
||
/** | ||
* Represents a GraphQL query. | ||
*/ | ||
query, | ||
|
||
/** | ||
* Represents a GraphQL mutation. | ||
*/ | ||
mutation, | ||
|
||
/** | ||
* Represents a GraphQL subscription. | ||
*/ | ||
subscription; | ||
|
||
@Override public String key() { | ||
return IpcTagKey.method.key(); | ||
} | ||
|
||
@Override public String value() { | ||
return name(); | ||
} | ||
} |
This file contains 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
81 changes: 81 additions & 0 deletions
81
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcSource.java
This file contains 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,81 @@ | ||
/** | ||
* Copyright 2024 Netflix, Inc. | ||
* | ||
* 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 com.netflix.spectator.ipc; | ||
|
||
import com.netflix.spectator.api.Tag; | ||
|
||
public enum IpcSource implements Tag { | ||
|
||
/** | ||
* No call was made due to errors potentially. | ||
*/ | ||
none, | ||
|
||
/** | ||
* Data sourced directly from EVCache as the cache implementation (when the exact cache is known). | ||
*/ | ||
evcache, | ||
|
||
/** | ||
* Data sourced from a cache where the cache implementation is not directly known or abstracted. | ||
*/ | ||
cache, | ||
|
||
/** | ||
* Static fallback was used to fetch the data. | ||
*/ | ||
fallback, | ||
|
||
/** | ||
* Response fetched using mesh. | ||
*/ | ||
mesh, | ||
|
||
/** | ||
* Response fetched directly from the downstream service (or if not known to be mesh). | ||
*/ | ||
direct, | ||
|
||
/** | ||
* Data sourced from a validation handler that may short-circuit the response immediately for failed validation. | ||
*/ | ||
validation, | ||
|
||
/** | ||
* Data sourced and returned directly by a filter or interceptor. | ||
*/ | ||
filter, | ||
|
||
/** | ||
* Data fetched from an in-memory cache. | ||
*/ | ||
memory, | ||
|
||
/** | ||
* Data sourced from a user defined business logic handler or root data fetcher. | ||
*/ | ||
application; | ||
|
||
@Override | ||
public String key() { | ||
return IpcTagKey.source.key(); | ||
} | ||
|
||
@Override | ||
public String value() { | ||
return name(); | ||
} | ||
} |
This file contains 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both a string and enum version? That tends to work against consistency. As one example the enum uses lower case values for method, but if setting it with a string using some thing like
request.getMethod()
for some API it would often be upper cased. Ideally we would just have the enum and not allow arbitrary values.