Skip to content

Commit adf016c

Browse files
committed
mux: debug data API
Introduce a debugging specific mux request. Add workflow debug config to the configuration update. Signed-off-by: Matt Klein <mklein@bitdrift.io>
1 parent 0f4c6cf commit adf016c

File tree

2 files changed

+58
-8
lines changed

2 files changed

+58
-8
lines changed

src/bitdrift_public/protobuf/bdtail/v1/bdtail_config.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import "bitdrift_public/protobuf/matcher/v1/log_matcher.proto";
1313
package bitdrift_public.protobuf.bdtail.v1;
1414

1515
message BdTailStream {
16-
// The name of the bdtail stream. Logs that match the matcher below should be annotated with this stream ID to allow the SaaS to associate the log with the bdtail stream.
16+
// The name of the bdtail stream. Logs that match the matcher below should be annotated with this
17+
// stream ID to allow the SaaS to associate the log with the bdtail stream.
1718
string stream_id = 1 [(validate.rules).string = {min_len: 1}];
1819

19-
// The match criteria for logs that should be forwarded to this bdtail stream. If empty, all logs will be forwarded to this stream.
20+
// The match criteria for logs that should be forwarded to this bdtail stream. If empty, all logs
21+
// will be forwarded to this stream.
2022
matcher.v1.LogMatcher matcher = 2;
2123
}
2224

src/bitdrift_public/protobuf/client/v1/api.proto

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ message HandshakeRequest {
4141
// TODO(snowp): Improve the story for this when parameters change during a
4242
// logging period, e.g. if we capture multiple process restarts that may span
4343
// versions.
44-
map<string, bitdrift_public.protobuf.logging.v1.Data> static_device_metadata = 1;
44+
map<string, logging.v1.Data> static_device_metadata = 1;
4545

4646
// This was never used by the client. Reserve it for now to avoid implementing it. We can bring
4747
// it back later if needed.
@@ -146,6 +146,11 @@ message LogUploadRequest {
146146

147147
// The UUID (v4) of the buffer that is producing the logs.
148148
string buffer_uuid = 3 [(validate.rules).string = {min_len: 1}];
149+
150+
// Whether the server should not respond to this upload. This is used for high
151+
// throughput, low value logs where the client does not need to know whether
152+
// the upload succeeded or failed.
153+
bool ackless = 4;
149154
}
150155

151156
// Empty message to maintain a application layer keep alive mechanism.
@@ -195,6 +200,7 @@ message ApiRequest {
195200
SankeyIntentRequest sankey_intent = 11;
196201
UploadArtifactRequest artifact_upload = 12;
197202
UploadArtifactIntentRequest artifact_intent = 13;
203+
DebugDataRequest debug_data = 14;
198204
}
199205

200206
reserved 8;
@@ -289,7 +295,7 @@ message UploadArtifactRequest {
289295

290296
// An optional set of key-value data indicating the state of the device at the time of artifact emission. For example,
291297
// this may capture information about the device at the time of a crash.
292-
map<string, bitdrift_public.protobuf.logging.v1.Data> state_metadata = 5;
298+
map<string, logging.v1.Data> state_metadata = 5;
293299

294300
// The timestamp associated with this upload. This allows us to possibly reject the upload of very old artifacts.
295301
google.protobuf.Timestamp time = 6 [(validate.rules).message = {required: true}];
@@ -425,19 +431,27 @@ message ConfigurationUpdate {
425431
reserved 2;
426432

427433
// The list of buffers.
428-
bitdrift_public.protobuf.config.v1.BufferConfigList buffer_config_list = 3;
434+
config.v1.BufferConfigList buffer_config_list = 3;
429435

430436
// The workflows configuration.
431-
bitdrift_public.protobuf.workflow.v1.WorkflowsConfiguration workflows_configuration = 4;
437+
workflow.v1.WorkflowsConfiguration workflows_configuration = 4;
432438

433439
// The list of active bdtail sessions.
434-
bitdrift_public.protobuf.bdtail.v1.BdTailConfigurations bdtail_configuration = 6;
440+
bdtail.v1.BdTailConfigurations bdtail_configuration = 6;
435441

436442
reserved "insights_configuration";
437443
reserved 7;
438444

439445
// The filters configuration.
440-
bitdrift_public.protobuf.filter.v1.FiltersConfiguration filters_configuration = 8;
446+
filter.v1.FiltersConfiguration filters_configuration = 8;
447+
448+
// The list of workflows to debug. If the workflow is already deployed, debug data will be
449+
// generated for it alongside the deployed workflow. If the workflow is not deployed, the
450+
// workflow will be executed in debug mode, however actions will *not* be executed (metrics,
451+
// flushes, and so on).
452+
// NOTE: "already deployed" implies that the workflow will be found in the
453+
// workflows_configuration field. The server will not de-dup for simplification purposes.
454+
workflow.v1.WorkflowsConfiguration debug_workflows = 9;
441455
}
442456

443457
// A version nonce that can be used for both tracking the last applied update as well as for
@@ -516,6 +530,40 @@ message SankeyIntentResponse {
516530
}
517531
}
518532

533+
// Debug data that is periodically sent when instructed via the DebugControlResponse message.
534+
message DebugDataRequest {
535+
message WorkflowStateDebugData {
536+
// The ID of the state being reported on.
537+
string state_id = 1;
538+
539+
oneof transition_type {
540+
// The index of the transition that was taken to leave this state.
541+
uint32 transition_index = 2;
542+
543+
// Whether this transition was a timeout transition.
544+
bool timeout_transition = 3;
545+
}
546+
547+
// The number of times this state/transition has been transitioned out of.
548+
uint64 transition_count = 4;
549+
550+
// The last time this state/transition was transitioned out of.
551+
google.protobuf.Timestamp last_transition_time = 5;
552+
}
553+
554+
message WorkflowDebugData {
555+
// The ID of the workflow being debugged.
556+
string workflow_id = 1;
557+
558+
// The state debug data for each state in the workflow that has been transitioned.
559+
repeated WorkflowStateDebugData states = 2;
560+
}
561+
562+
// If instructed to debug workflows, this will contain the debug data for each workflow being
563+
// debugged.
564+
repeated WorkflowDebugData workflow_debug_data = 1;
565+
}
566+
519567
// A multiplexed response sent over the bitdrift API.
520568
message ApiResponse {
521569
oneof response_type {

0 commit comments

Comments
 (0)