-
Notifications
You must be signed in to change notification settings - Fork 5.5k
JSON Schema: HTTP Connection Manager access log #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
705f949
53f5848
ba00be1
1c84dc9
37380b1
28118a6
803ba83
30d5ca3
e9cc037
532a6dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,14 +76,93 @@ const std::string Json::Schema::HTTP_CONN_NETWORK_FILTER_SCHEMA(R"EOF( | |
| { | ||
| "$schema": "http://json-schema.org/schema#", | ||
| "definitions" : { | ||
| "access_log": { | ||
| "status_code" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "path" : {"type" : "string"}, | ||
| "format" : {"type" : "string"}, | ||
| "filter" : {"type" : "object"} | ||
| "type" : { | ||
| "type" : "string", | ||
| "enum" : ["status_code"] | ||
| }, | ||
| "op" : { | ||
| "type" : "string", | ||
| "enum" : ["=>", "="] | ||
| }, | ||
| "value" : {"type" : "integer"}, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about mix and max here as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great suggestion. Added. |
||
| "runtime_key" : {"type" : "string"} | ||
| }, | ||
| "required" : ["type", "op", "value"], | ||
| "additionalProperties" : false | ||
| }, | ||
| "duration" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "type" : { | ||
| "type" : "string", | ||
| "enum" : ["duration"] | ||
| }, | ||
| "op" : { | ||
| "type" : "string", | ||
| "enum" : ["=>", "="] | ||
| }, | ||
| "value" : {"type" : "integer"}, | ||
| "runtime_key" : {"type" : "string"} | ||
| }, | ||
| "required" : ["type", "op", "value"], | ||
| "additionalProperties" : false | ||
| }, | ||
| "not_healthcheck" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "type" : { | ||
| "type" : "string", | ||
| "enum" : ["not_healthcheck"] | ||
| } | ||
| }, | ||
| "required" : ["type"], | ||
| "additionalProperties" : false | ||
| }, | ||
| "logical_and" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "type" : { | ||
| "type" : "string", | ||
| "enum" : ["logical_and"] | ||
| }, | ||
| "filters" : { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change looks good to me, if only we could extract "filters" from here and from logical_or into separate thing and reference it from here and other place.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good call. I didn't think about putting those two together at the time. Thank you! |
||
| "type" : "array", | ||
| "minItems" : 2, | ||
| "items" : { | ||
| "anyOf" : [ | ||
| {"$ref" : "#/defintions/status_code"}, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed. |
||
| {"$ref" : "#/definitions/duration"}, | ||
| {"$ref" : "#/definitions/not_healthcheck"} | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "required" : ["path"], | ||
| "required" : ["type", "filters"], | ||
| "additionalProperties" : false | ||
| }, | ||
| "logical_or" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "type" : { | ||
| "type" : "string", | ||
| "enum" : ["logical_or"] | ||
| }, | ||
| "filters" : { | ||
| "type" : "array", | ||
| "minItems" : 2, | ||
| "items" : { | ||
| "anyOf" : [ | ||
| {"$ref" : "#/defintions/status_code"}, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any of the supported filter types can be here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed. |
||
| {"$ref" : "#/definitions/duration"}, | ||
| {"$ref" : "#/definitions/not_healthcheck"} | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "required" : ["type", "filters"], | ||
| "additionalProperties" : false | ||
| }, | ||
| "tracing" : { | ||
|
|
@@ -133,7 +212,24 @@ const std::string Json::Schema::HTTP_CONN_NETWORK_FILTER_SCHEMA(R"EOF( | |
| "type" : "array", | ||
| "items" : { | ||
| "type" : "object", | ||
| "properties" : {"$ref" : "#/definitions/access_log"} | ||
| "properties" : { | ||
| "path" : {"type" : "string"}, | ||
| "format" : {"type" : "string"}, | ||
| "filter" : { | ||
| "type" : "object", | ||
| "properties" : { | ||
| "oneOf" : [ | ||
| {"$ref" : "#/definitions/status_code"}, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ref should be updated
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll add a test for nested filters |
||
| {"$ref" : "#/definitions/duration"}, | ||
| {"$ref" : "#/definitions/not_healthcheck"}, | ||
| {"$ref" : "#/defintions/logical_and"}, | ||
| {"$ref" : "#/defintions/logical_or"} | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "required" : ["path"], | ||
| "additionalProperties" : false | ||
| } | ||
| }, | ||
| "use_remote_address" : {"type" : "boolean"}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,21 @@ | |
| "access_log": [ | ||
| { | ||
| "path": "/dev/null", | ||
| "filters": [ | ||
| {"type": "status_code", "op": ">=", "value": 500}, | ||
| {"type": "duration", "op": ">=", "value": 1000000} | ||
| ] | ||
| "filter" : { | ||
| "type": "logical_or", | ||
| "filters": [ | ||
| { | ||
| "type": "status_code", | ||
| "op": ">=", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use '=' also in integration test configs, so that it'll have additional coverage
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already coverage for '=' within access_log_impl_tests.cc
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup it's tested, just wanted extra test of that here, either way |
||
| "value": 500 | ||
| }, | ||
| { | ||
| "type": "duration", | ||
| "op": ">=", | ||
| "value": 1000000 | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "path": "/dev/null" | ||
|
|
@@ -88,10 +99,21 @@ | |
| "access_log": [ | ||
| { | ||
| "path": "/dev/null", | ||
| "filters": [ | ||
| {"type": "status_code", "op": ">=", "value": 500}, | ||
| {"type": "duration", "op": ">=", "value": 1000000} | ||
| ] | ||
| "filter" : { | ||
| "type": "logical_or", | ||
| "filters": [ | ||
| { | ||
| "type": "status_code", | ||
| "op": ">=", | ||
| "value": 500 | ||
| }, | ||
| { | ||
| "type": "duration", | ||
| "op": ">=", | ||
| "value": 1000000 | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "path": "/dev/null" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.