Skip to content

Commit

Permalink
chore(sdk): add handlerName to HandlerConfig (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnons authored Dec 5, 2024
1 parent e4afb7f commit d633f97
Show file tree
Hide file tree
Showing 14 changed files with 635 additions and 43 deletions.
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ write_source_files(
name = "write_gen",
files = {
"packages/protos/processor.proto": "//processor/protos:proto_file",
"packages/protos/src/chainquery/protos/chainquery.ts": "//chainquery/protos:chainquery_ts_proto",
# "packages/protos/src/chainquery/protos/chainquery.ts": "//chainquery/protos:chainquery_ts_proto",
"packages/protos/src/processor/protos/processor.ts": "//processor/protos:processor_ts_proto_no_deprecate",
"packages/protos/src/service/price/protos/price.ts": "//service/price/protos:protos_ts_proto",
"packages/protos/src/service/common/protos/common.ts": "//service/common/protos:protos_ts_proto",
Expand Down
3 changes: 3 additions & 0 deletions packages/protos/processor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ message TraceHandlerConfig {
string signature = 1;
int32 handler_id = 2;
EthFetchConfig fetch_config = 3;
string handler_name = 4;
}

message TransactionHandlerConfig {
Expand All @@ -303,6 +304,7 @@ message LogHandlerConfig {
repeated LogFilter filters = 1;
int32 handler_id = 2;
EthFetchConfig fetch_config = 3;
string handler_name = 4;
}

message FuelAssetHandlerConfig {
Expand Down Expand Up @@ -857,6 +859,7 @@ message EventTrackingResult {
LogLevel severity = 7;
string message = 8;
RuntimeInfo runtime_info = 5;
common.RichStruct attributes2 = 9;

// TODO remove this after driver don't use old event tracker
bool no_metric = 3;
Expand Down
55 changes: 53 additions & 2 deletions packages/protos/src/processor/protos/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ export interface TraceHandlerConfig {
signature: string;
handlerId: number;
fetchConfig: EthFetchConfig | undefined;
handlerName: string;
}

export interface TransactionHandlerConfig {
Expand All @@ -667,6 +668,7 @@ export interface LogHandlerConfig {
filters: LogFilter[];
handlerId: number;
fetchConfig: EthFetchConfig | undefined;
handlerName: string;
}

export interface FuelAssetHandlerConfig {
Expand Down Expand Up @@ -1239,6 +1241,7 @@ export interface EventTrackingResult {
severity: LogLevel;
message: string;
runtimeInfo: RuntimeInfo | undefined;
attributes2: RichStruct | undefined;
noMetric: boolean;
}

Expand Down Expand Up @@ -4086,7 +4089,7 @@ export const EthFetchConfig = {
};

function createBaseTraceHandlerConfig(): TraceHandlerConfig {
return { signature: "", handlerId: 0, fetchConfig: undefined };
return { signature: "", handlerId: 0, fetchConfig: undefined, handlerName: "" };
}

export const TraceHandlerConfig = {
Expand All @@ -4100,6 +4103,9 @@ export const TraceHandlerConfig = {
if (message.fetchConfig !== undefined) {
EthFetchConfig.encode(message.fetchConfig, writer.uint32(26).fork()).ldelim();
}
if (message.handlerName !== "") {
writer.uint32(34).string(message.handlerName);
}
return writer;
},

Expand Down Expand Up @@ -4131,6 +4137,13 @@ export const TraceHandlerConfig = {

message.fetchConfig = EthFetchConfig.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}

message.handlerName = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand All @@ -4145,6 +4158,7 @@ export const TraceHandlerConfig = {
signature: isSet(object.signature) ? globalThis.String(object.signature) : "",
handlerId: isSet(object.handlerId) ? globalThis.Number(object.handlerId) : 0,
fetchConfig: isSet(object.fetchConfig) ? EthFetchConfig.fromJSON(object.fetchConfig) : undefined,
handlerName: isSet(object.handlerName) ? globalThis.String(object.handlerName) : "",
};
},

Expand All @@ -4159,6 +4173,9 @@ export const TraceHandlerConfig = {
if (message.fetchConfig !== undefined) {
obj.fetchConfig = EthFetchConfig.toJSON(message.fetchConfig);
}
if (message.handlerName !== "") {
obj.handlerName = message.handlerName;
}
return obj;
},

Expand All @@ -4172,6 +4189,7 @@ export const TraceHandlerConfig = {
message.fetchConfig = (object.fetchConfig !== undefined && object.fetchConfig !== null)
? EthFetchConfig.fromPartial(object.fetchConfig)
: undefined;
message.handlerName = object.handlerName ?? "";
return message;
},
};
Expand Down Expand Up @@ -4253,7 +4271,7 @@ export const TransactionHandlerConfig = {
};

function createBaseLogHandlerConfig(): LogHandlerConfig {
return { filters: [], handlerId: 0, fetchConfig: undefined };
return { filters: [], handlerId: 0, fetchConfig: undefined, handlerName: "" };
}

export const LogHandlerConfig = {
Expand All @@ -4267,6 +4285,9 @@ export const LogHandlerConfig = {
if (message.fetchConfig !== undefined) {
EthFetchConfig.encode(message.fetchConfig, writer.uint32(26).fork()).ldelim();
}
if (message.handlerName !== "") {
writer.uint32(34).string(message.handlerName);
}
return writer;
},

Expand Down Expand Up @@ -4298,6 +4319,13 @@ export const LogHandlerConfig = {

message.fetchConfig = EthFetchConfig.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}

message.handlerName = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand All @@ -4312,6 +4340,7 @@ export const LogHandlerConfig = {
filters: globalThis.Array.isArray(object?.filters) ? object.filters.map((e: any) => LogFilter.fromJSON(e)) : [],
handlerId: isSet(object.handlerId) ? globalThis.Number(object.handlerId) : 0,
fetchConfig: isSet(object.fetchConfig) ? EthFetchConfig.fromJSON(object.fetchConfig) : undefined,
handlerName: isSet(object.handlerName) ? globalThis.String(object.handlerName) : "",
};
},

Expand All @@ -4326,6 +4355,9 @@ export const LogHandlerConfig = {
if (message.fetchConfig !== undefined) {
obj.fetchConfig = EthFetchConfig.toJSON(message.fetchConfig);
}
if (message.handlerName !== "") {
obj.handlerName = message.handlerName;
}
return obj;
},

Expand All @@ -4339,6 +4371,7 @@ export const LogHandlerConfig = {
message.fetchConfig = (object.fetchConfig !== undefined && object.fetchConfig !== null)
? EthFetchConfig.fromPartial(object.fetchConfig)
: undefined;
message.handlerName = object.handlerName ?? "";
return message;
},
};
Expand Down Expand Up @@ -11671,6 +11704,7 @@ function createBaseEventTrackingResult(): EventTrackingResult {
severity: 0,
message: "",
runtimeInfo: undefined,
attributes2: undefined,
noMetric: false,
};
}
Expand All @@ -11695,6 +11729,9 @@ export const EventTrackingResult = {
if (message.runtimeInfo !== undefined) {
RuntimeInfo.encode(message.runtimeInfo, writer.uint32(42).fork()).ldelim();
}
if (message.attributes2 !== undefined) {
RichStruct.encode(message.attributes2, writer.uint32(74).fork()).ldelim();
}
if (message.noMetric !== false) {
writer.uint32(24).bool(message.noMetric);
}
Expand Down Expand Up @@ -11750,6 +11787,13 @@ export const EventTrackingResult = {

message.runtimeInfo = RuntimeInfo.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}

message.attributes2 = RichStruct.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 24) {
break;
Expand All @@ -11774,6 +11818,7 @@ export const EventTrackingResult = {
severity: isSet(object.severity) ? logLevelFromJSON(object.severity) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
runtimeInfo: isSet(object.runtimeInfo) ? RuntimeInfo.fromJSON(object.runtimeInfo) : undefined,
attributes2: isSet(object.attributes2) ? RichStruct.fromJSON(object.attributes2) : undefined,
noMetric: isSet(object.noMetric) ? globalThis.Boolean(object.noMetric) : false,
};
},
Expand All @@ -11798,6 +11843,9 @@ export const EventTrackingResult = {
if (message.runtimeInfo !== undefined) {
obj.runtimeInfo = RuntimeInfo.toJSON(message.runtimeInfo);
}
if (message.attributes2 !== undefined) {
obj.attributes2 = RichStruct.toJSON(message.attributes2);
}
if (message.noMetric !== false) {
obj.noMetric = message.noMetric;
}
Expand All @@ -11819,6 +11867,9 @@ export const EventTrackingResult = {
message.runtimeInfo = (object.runtimeInfo !== undefined && object.runtimeInfo !== null)
? RuntimeInfo.fromPartial(object.runtimeInfo)
: undefined;
message.attributes2 = (object.attributes2 !== undefined && object.attributes2 !== null)
? RichStruct.fromPartial(object.attributes2)
: undefined;
message.noMetric = object.noMetric ?? false;
return message;
},
Expand Down
Loading

0 comments on commit d633f97

Please sign in to comment.