Skip to content

Commit 29b1f4e

Browse files
authored
Add new Enhanced Stack Trace proto (#418)
* Add new Enhanced Stack Trace proto. list of commits below. --- * Remove optional from `string` and `int` types. Add `hide_default` flag to stacks. * Fix location of `hide_default` (we're hiding locations, not entire stacks). * fix schema names, copyright date, flatten sdkinfo message. issues: #418 (comment) #418 (comment) #418 (comment) * add some documentation, change main message name. Waiting to change package/message names. * Rename file to pass linting. * Prefix all messages with `StackTrace`-; Add extra documentation. * Convert optional `uint32` fields to signed `int32` so as to use `-1` as a sigil. Updated documentation string to reflect this, added clarification to `StackTraceFileSlice`.
1 parent 7ddad08 commit 29b1f4e

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2024 Temporal Technologies Inc. All rights reserved.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
syntax = "proto3";
24+
25+
package temporal.api.sdk.v1;
26+
27+
option go_package = "go.temporal.io/api/sdk/v1;sdk";
28+
option java_package = "io.temporal.api.sdk.v1";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "EnhancedStackTraceProto";
31+
option ruby_package = "Temporalio::Api::Sdk::V1";
32+
option csharp_namespace = "Temporalio.Api.Sdk.V1";
33+
34+
// Internal structure used to create worker stack traces with references to code.
35+
message EnhancedStackTrace {
36+
// Information pertaining to the SDK that the trace has been captured from.
37+
StackTraceSDKInfo sdk = 1;
38+
39+
// Mapping of file path to file contents.
40+
map<string, StackTraceFileSlice> sources = 2;
41+
42+
// Collection of stacks captured.
43+
repeated StackTrace stacks = 3;
44+
}
45+
46+
// Information pertaining to the SDK that the trace has been captured from.
47+
// (-- api-linter: core::0123::resource-annotation=disabled
48+
// aip.dev/not-precedent: Naming SDK version is optional. --)
49+
message StackTraceSDKInfo {
50+
// Name of the SDK
51+
string name = 1;
52+
53+
// Version string of the SDK
54+
string version = 2;
55+
}
56+
57+
// "Slice" of a file starting at line_offset -- a line offset and code fragment corresponding to the worker's stack.
58+
message StackTraceFileSlice {
59+
// Only used (possibly) to trim the file without breaking syntax highlighting. This is not optional, unlike
60+
// the `line` property of a `StackTraceFileLocation`.
61+
// (-- api-linter: core::0141::forbidden-types=disabled
62+
// aip.dev/not-precedent: These really shouldn't have negative values. --)
63+
uint32 line_offset = 1;
64+
65+
// Slice of a file with the respective OS-specific line terminator.
66+
string content = 2;
67+
}
68+
69+
// More specific location details of a file: its path, precise line and column numbers if applicable, and function name if available.
70+
// In essence, a pointer to a location in a file
71+
message StackTraceFileLocation {
72+
// Path to source file (absolute or relative).
73+
// If the paths are relative, ensure that they are all relative to the same root.
74+
string file_path = 1;
75+
76+
// Optional; If possible, SDK should send this -- this is required for displaying the code location.
77+
// If not provided, set to -1.
78+
int32 line = 2;
79+
80+
// Optional; if possible, SDK should send this.
81+
// If not provided, set to -1.
82+
int32 column = 3;
83+
84+
// Function name this line belongs to, if applicable.
85+
// Used for falling back to stack trace view.
86+
string function_name = 4;
87+
88+
// Flag to communicate whether a location should be hidden by default in the stack view.
89+
bool internal_code = 5;
90+
}
91+
92+
// Collection of FileLocation messages from a single stack.
93+
message StackTrace {
94+
// Collection of `FileLocation`s, each for a stack frame that comprise a stack trace.
95+
repeated StackTraceFileLocation locations = 1;
96+
}

0 commit comments

Comments
 (0)