-
Notifications
You must be signed in to change notification settings - Fork 1.3k
node grpc spike dashboard to server #18691
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9a1447e
[public-api] add dummy service for testing
akosyakov e407294
[public-api] proxy dummy to server
akosyakov 9e7af6a
[public-api] hello service server impl
akosyakov aec5e22
[server] fix API contribution bindings
akosyakov 99b3799
[dashboard] emulate unary call
akosyakov 20116a4
only if actually called
akosyakov 04f1390
[dummy] auth
akosyakov d7be37d
fix tests
akosyakov d882137
[server] add interceptor to public api
akosyakov 0dbbe52
add server side observability
akosyakov 14a2a94
fix port name
akosyakov 6eead8e
change to unimplemented for unknown methods
akosyakov 6abcc26
[public-api] client metrics
akosyakov 9ee89d6
fix metrics imports
akosyakov 42988ef
align server metrics
akosyakov 49bdf1e
actually fix metrics
akosyakov a5ce840
add feature flags
akosyakov 88d7b8f
fix server side streams
akosyakov b8f3ec1
[dashboard] hook error reporting
akosyakov e1bc2a9
rebase and fix imports
akosyakov 246cf76
feature flagged metrics from dashboard
akosyakov 9dc74c1
revert GRPC_TYPE
akosyakov 400fc32
address feedback
akosyakov 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* Copyright (c) 2023 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url"; | ||
import { MetricsReporter } from "@gitpod/public-api/lib/metrics"; | ||
import { getExperimentsClient } from "../experiments/client"; | ||
|
||
const originalConsoleError = console.error; | ||
|
||
const options = { | ||
gitpodUrl: new GitpodHostUrl(window.location.href).withoutWorkspacePrefix().toString(), | ||
clientName: "dashboard", | ||
clientVersion: "", | ||
logError: originalConsoleError.bind(console), | ||
isEnabled: () => getExperimentsClient().getValueAsync("dashboard_metrics_enabled", false, {}), | ||
geropl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
fetch("/api/version").then(async (res) => { | ||
const version = await res.text(); | ||
options.clientVersion = version; | ||
}); | ||
const metricsReporter = new MetricsReporter(options); | ||
metricsReporter.startReporting(); | ||
|
||
window.addEventListener("unhandledrejection", (event) => { | ||
reportError("Unhandled promise rejection", event.reason); | ||
}); | ||
window.addEventListener("error", (event) => { | ||
let message = "Unhandled error"; | ||
if (event.message) { | ||
message += ": " + event.message; | ||
} | ||
reportError(message, event.error); | ||
}); | ||
|
||
console.error = function (...args) { | ||
originalConsoleError.apply(console, args); | ||
reportError(...args); | ||
}; | ||
|
||
function reportError(...args: any[]) { | ||
let err = undefined; | ||
let details = undefined; | ||
if (args[0] instanceof Error) { | ||
err = args[0]; | ||
details = args[1]; | ||
} else if (typeof args[0] === "string") { | ||
err = new Error(args[0]); | ||
if (args[1] instanceof Error) { | ||
err.message += ": " + args[1].message; | ||
err.name = args[1].name; | ||
err.stack = args[1].stack; | ||
details = args[2]; | ||
} else if (typeof args[1] === "string") { | ||
err.message += ": " + args[1]; | ||
details = args[2]; | ||
} else { | ||
details = args[1]; | ||
} | ||
} | ||
|
||
let data = undefined; | ||
if (details && typeof details === "object") { | ||
data = Object.fromEntries( | ||
Object.entries(details) | ||
.filter(([key, value]) => { | ||
return ( | ||
typeof value === "string" || | ||
typeof value === "number" || | ||
typeof value === "boolean" || | ||
value === null || | ||
typeof value === "undefined" | ||
); | ||
}) | ||
.map(([key, value]) => [key, String(value)]), | ||
); | ||
} | ||
|
||
if (err) { | ||
metricsReporter.reportError(err, data); | ||
} | ||
} |
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,28 @@ | ||
syntax = "proto3"; | ||
|
||
package gitpod.experimental.v1; | ||
|
||
option go_package = "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"; | ||
|
||
// HelloService is a dummy service that says hello. It is used for reliability | ||
// testing. | ||
service HelloService { | ||
// Unary RPCs where the client sends a single request to the server and gets a | ||
// single response back, just like a normal function call. | ||
rpc SayHello(SayHelloRequest) returns (SayHelloResponse); | ||
// Server streaming RPCs where the client sends a request to the server and | ||
// gets a stream to read a sequence of messages back. | ||
rpc LotsOfReplies(LotsOfRepliesRequest) | ||
returns (stream LotsOfRepliesResponse); | ||
} | ||
|
||
message SayHelloRequest {} | ||
message SayHelloResponse { string reply = 1; } | ||
|
||
message LotsOfRepliesRequest { | ||
int32 previous_count = 1; | ||
} | ||
message LotsOfRepliesResponse { | ||
string reply = 1; | ||
int32 count = 2; | ||
} |
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.