Skip to content

Commit

Permalink
POA-1341 Add path_param_alg field to HTTPMethodMetadata (#13)
Browse files Browse the repository at this point in the history
Tracks which path-parameter inference algorithm was used to produce a
given Method.
  • Loading branch information
liujed authored Jul 2, 2024
1 parent 548fc4a commit 96a4c69
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 217 deletions.
382 changes: 229 additions & 153 deletions go/api_spec/method.pb.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions proto/api_spec/method.proto
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@ message HTTPMethodMeta {
// This measurement is from the last byte of the HTTP request to the
// first byte of the HTTP response, ignoring time spent in transmission.
float processing_latency = 4;

// Identifies the path parameter inference algorithm used to create this
// method. This is `unknown` for witnesses (which do not have any associated
// inference algorithm) and for methods that were created before the
// introduction of this field.
enum PathParameterInferenceAlgorithm {
UNKNOWN = 0;
v1 = 1;
v2 = 2;
v3 = 3;
}
PathParameterInferenceAlgorithm path_param_alg = 5;
}

message MethodMeta {
Expand Down
67 changes: 56 additions & 11 deletions py/api_spec/method_pb2.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions ts/api_spec/api_type_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

goog.exportSymbol('proto.api_spec.ApiType', null, global);
/**
Expand Down
11 changes: 11 additions & 0 deletions ts/api_spec/method_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,8 @@ export class HTTPMethodMeta extends jspb.Message {
setHost(value: string): HTTPMethodMeta;
getProcessingLatency(): number;
setProcessingLatency(value: number): HTTPMethodMeta;
getPathParamAlg(): HTTPMethodMeta.PathParameterInferenceAlgorithm;
setPathParamAlg(value: HTTPMethodMeta.PathParameterInferenceAlgorithm): HTTPMethodMeta;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HTTPMethodMeta.AsObject;
Expand All @@ -984,7 +986,16 @@ export namespace HTTPMethodMeta {
pathTemplate: string,
host: string,
processingLatency: number,
pathParamAlg: HTTPMethodMeta.PathParameterInferenceAlgorithm,
}

export enum PathParameterInferenceAlgorithm {
UNKNOWN = 0,
V1 = 1,
V2 = 2,
V3 = 3,
}

}

export class MethodMeta extends jspb.Message {
Expand Down
75 changes: 61 additions & 14 deletions ts/api_spec/method_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

var api_type_pb = require('./api_type_pb.js');
goog.object.extend(proto, api_type_pb);
Expand All @@ -46,6 +46,7 @@ goog.exportSymbol('proto.api_spec.HTTPHeader', null, global);
goog.exportSymbol('proto.api_spec.HTTPMeta', null, global);
goog.exportSymbol('proto.api_spec.HTTPMeta.LocationCase', null, global);
goog.exportSymbol('proto.api_spec.HTTPMethodMeta', null, global);
goog.exportSymbol('proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm', null, global);
goog.exportSymbol('proto.api_spec.HTTPMultipart', null, global);
goog.exportSymbol('proto.api_spec.HTTPPath', null, global);
goog.exportSymbol('proto.api_spec.HTTPQuery', null, global);
Expand Down Expand Up @@ -3179,7 +3180,8 @@ proto.api_spec.Primitive.prototype.getFormatsMap = function(opt_noLazyCreate) {
*/
proto.api_spec.Primitive.prototype.clearFormatsMap = function() {
this.getFormatsMap().clear();
return this;};
return this;
};


/**
Expand Down Expand Up @@ -3504,7 +3506,8 @@ proto.api_spec.Struct.prototype.getFieldsMap = function(opt_noLazyCreate) {
*/
proto.api_spec.Struct.prototype.clearFieldsMap = function() {
this.getFieldsMap().clear();
return this;};
return this;
};


/**
Expand Down Expand Up @@ -4217,7 +4220,8 @@ proto.api_spec.OneOf.prototype.getOptionsMap = function(opt_noLazyCreate) {
*/
proto.api_spec.OneOf.prototype.clearOptionsMap = function() {
this.getOptionsMap().clear();
return this;};
return this;
};


/**
Expand Down Expand Up @@ -6798,7 +6802,8 @@ proto.api_spec.Data.prototype.getExampleValuesMap = function(opt_noLazyCreate) {
*/
proto.api_spec.Data.prototype.clearExampleValuesMap = function() {
this.getExampleValuesMap().clear();
return this;};
return this;
};



Expand Down Expand Up @@ -7097,7 +7102,8 @@ proto.api_spec.HTTPMethodMeta.toObject = function(includeInstance, msg) {
method: jspb.Message.getFieldWithDefault(msg, 1, ""),
pathTemplate: jspb.Message.getFieldWithDefault(msg, 2, ""),
host: jspb.Message.getFieldWithDefault(msg, 3, ""),
processingLatency: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0)
processingLatency: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0),
pathParamAlg: jspb.Message.getFieldWithDefault(msg, 5, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -7150,6 +7156,10 @@ proto.api_spec.HTTPMethodMeta.deserializeBinaryFromReader = function(msg, reader
var value = /** @type {number} */ (reader.readFloat());
msg.setProcessingLatency(value);
break;
case 5:
var value = /** @type {!proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm} */ (reader.readEnum());
msg.setPathParamAlg(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -7207,9 +7217,26 @@ proto.api_spec.HTTPMethodMeta.serializeBinaryToWriter = function(message, writer
f
);
}
f = message.getPathParamAlg();
if (f !== 0.0) {
writer.writeEnum(
5,
f
);
}
};


/**
* @enum {number}
*/
proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm = {
UNKNOWN: 0,
V1: 1,
V2: 2,
V3: 3
};

/**
* optional string method = 1;
* @return {string}
Expand Down Expand Up @@ -7282,6 +7309,24 @@ proto.api_spec.HTTPMethodMeta.prototype.setProcessingLatency = function(value) {
};


/**
* optional PathParameterInferenceAlgorithm path_param_alg = 5;
* @return {!proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm}
*/
proto.api_spec.HTTPMethodMeta.prototype.getPathParamAlg = function() {
return /** @type {!proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};


/**
* @param {!proto.api_spec.HTTPMethodMeta.PathParameterInferenceAlgorithm} value
* @return {!proto.api_spec.HTTPMethodMeta} returns this
*/
proto.api_spec.HTTPMethodMeta.prototype.setPathParamAlg = function(value) {
return jspb.Message.setProto3EnumField(this, 5, value);
};



/**
* Oneof group definitions for this message. Each group defines the field
Expand Down Expand Up @@ -7716,7 +7761,8 @@ proto.api_spec.Method.prototype.getArgsMap = function(opt_noLazyCreate) {
*/
proto.api_spec.Method.prototype.clearArgsMap = function() {
this.getArgsMap().clear();
return this;};
return this;
};


/**
Expand All @@ -7738,7 +7784,8 @@ proto.api_spec.Method.prototype.getResponsesMap = function(opt_noLazyCreate) {
*/
proto.api_spec.Method.prototype.clearResponsesMap = function() {
this.getResponsesMap().clear();
return this;};
return this;
};


/**
Expand Down
23 changes: 13 additions & 10 deletions ts/api_spec/sequence_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

var method_pb = require('./method_pb.js');
goog.object.extend(proto, method_pb);
Expand Down Expand Up @@ -2714,7 +2714,8 @@ proto.api_spec.StructTemplate.prototype.getFieldTemplatesMap = function(opt_noLa
*/
proto.api_spec.StructTemplate.prototype.clearFieldTemplatesMap = function() {
this.getFieldTemplatesMap().clear();
return this;};
return this;
};



Expand Down Expand Up @@ -3699,7 +3700,8 @@ proto.api_spec.MethodTemplate.prototype.getArgTemplatesMap = function(opt_noLazy
*/
proto.api_spec.MethodTemplate.prototype.clearArgTemplatesMap = function() {
this.getArgTemplatesMap().clear();
return this;};
return this;
};


/**
Expand All @@ -3721,7 +3723,8 @@ proto.api_spec.MethodTemplate.prototype.getResponsesMap = function(opt_noLazyCre
*/
proto.api_spec.MethodTemplate.prototype.clearResponsesMap = function() {
this.getResponsesMap().clear();
return this;};
return this;
};


/**
Expand Down
17 changes: 9 additions & 8 deletions ts/api_spec/spec_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

var method_pb = require('./method_pb.js');
goog.object.extend(proto, method_pb);
Expand Down Expand Up @@ -257,7 +257,8 @@ proto.api_spec.APISpec.prototype.getTagsMap = function(opt_noLazyCreate) {
*/
proto.api_spec.APISpec.prototype.clearTagsMap = function() {
this.getTagsMap().clear();
return this;};
return this;
};



Expand Down
14 changes: 7 additions & 7 deletions ts/api_spec/types_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js');
goog.object.extend(proto, google_protobuf_wrappers_pb);
Expand Down
14 changes: 7 additions & 7 deletions ts/api_spec/witness_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();

var method_pb = require('./method_pb.js');
goog.object.extend(proto, method_pb);
Expand Down

0 comments on commit 96a4c69

Please sign in to comment.