Skip to content

Commit f59c959

Browse files
authored
Ad Hoc Profiles (#2963)
* Define initial contract for Ad Hoc profiles * Initial implementation of the Ad Hoc APIs * Include profile name in upload api * Handle multiple sample types within a pprof gracefully * Add API docs * Return ad hoc profiles in full flamebearer profile format * Revert proto refactoring * Add max_nodes to the Ad Hoc Profiles APIs * Restore convert package from OG Pyroscope to handle multiple profile formats * Simplify API, rename fields for clarity, fix profileTypes field for JSON uploads * Move Ad Hoc Profiles to a new Sidekick module * Switch uploaded_at to timestamp, update docs * Improve naming, execution order * Add todo for tenant limits * Move the convert package to its original location, restore tests * Make ad-hoc-profiles its own module * Fix lint error * Improve key parsing for the /List call * Simplify bucket creation * Add tests for the ad hoc profile handlers
1 parent dc576e7 commit f59c959

File tree

16 files changed

+4254
-2
lines changed

16 files changed

+4254
-2
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
syntax = "proto3";
2+
3+
package adhocprofiles.v1;
4+
5+
import "types/v1/types.proto";
6+
7+
service AdHocProfileService {
8+
// Upload a profile to the underlying store. The request contains a name and a base64 encoded pprof file. The response
9+
// contains a generated unique identifier, a flamegraph and a list of found sample types within the profile.
10+
rpc Upload(AdHocProfilesUploadRequest) returns (AdHocProfilesGetResponse) {}
11+
12+
// Retrieves a profile from the underlying store by id and an optional sample type. The response is similar to the one
13+
// for the upload method.
14+
rpc Get(AdHocProfilesGetRequest) returns (AdHocProfilesGetResponse) {}
15+
16+
// Retrieves a list of profiles found in the underlying store.
17+
rpc List(AdHocProfilesListRequest) returns (AdHocProfilesListResponse) {}
18+
}
19+
20+
message AdHocProfilesUploadRequest {
21+
// This is typically the file name and it serves as a human readable name for the profile.
22+
string name = 1;
23+
// This is the profile encoded in base64. The supported formats are pprof, json, collapsed and perf-script.
24+
string profile = 2;
25+
// Max nodes can be used to truncate the response.
26+
optional int64 max_nodes = 3;
27+
}
28+
29+
message AdHocProfilesGetRequest {
30+
// The unique identifier of the profile.
31+
string id = 1;
32+
// The desired profile type (e.g., cpu, samples) for the returned flame graph. If omitted the first profile is returned.
33+
optional string profile_type = 2;
34+
// Max nodes can be used to truncate the response.
35+
optional int64 max_nodes = 3;
36+
}
37+
38+
message AdHocProfilesGetResponse {
39+
string id = 1;
40+
string name = 2;
41+
// timestamp in milliseconds
42+
int64 uploaded_at = 3;
43+
string profile_type = 4;
44+
// Some profiles formats (like pprof) can contain multiple profile (sample) types inside. One of these can be passed
45+
// in the Get request using the profile_type field.
46+
repeated string profile_types = 5;
47+
string flamebearer_profile = 6;
48+
}
49+
50+
message AdHocProfilesListRequest {}
51+
52+
message AdHocProfilesListResponse {
53+
repeated AdHocProfilesProfileMetadata profiles = 1;
54+
}
55+
56+
message AdHocProfilesProfileMetadata {
57+
string id = 1;
58+
string name = 2;
59+
// timestamp in milliseconds
60+
int64 uploaded_at = 3;
61+
}

0 commit comments

Comments
 (0)