chore: extend the helm template for spanDropFilter#298
Conversation
Codecov Report
@@ Coverage Diff @@
## main #298 +/- ##
============================================
+ Coverage 79.58% 79.60% +0.01%
- Complexity 1286 1287 +1
============================================
Files 116 116
Lines 5128 5128
Branches 465 465
============================================
+ Hits 4081 4082 +1
Misses 836 836
+ Partials 211 210 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| {{- end }} | ||
|
|
||
| {{- if hasKey .Values.spanNormalizerConfig.processor "spanDropFilters" }} | ||
| spanDropFilters = {{ .Values.spanNormalizerConfig.processor.spanDropFilters | indent 4 | trim }} |
There was a problem hiding this comment.
toJson not required here?
There was a problem hiding this comment.
I am not loading as JSON, directly reading as a config object. See this example - https://github.com/hypertrace/hypertrace-ingester/blob/main/span-normalizer/span-normalizer/src/test/resources/configs/span-normalizer/application.conf#L30
I observed here that other configs were converted toJson string, will check out that were they read as a string.
There was a problem hiding this comment.
But the value that you are providing in the config is a json, this indent and trim function applies to string
There was a problem hiding this comment.
As shown in the description, I was using the marker |- in YAML that is multi-string notation. So, the entire thing was treated as a big string, and If I apply the toJson function to it, it jsonify the string. As an example below.
Input from the above PR description:
processor:
spanDropFilters: |-
[
[
{
"tagKey": "http.method",
"operator": "EQ",
"tagValue": "GET"
},
{
"tagKey": "http.url",
"operator": "CONTAINS",
"tagValue": "health"
}
],
[
{
"tagKey": "grpc.url",
"operator": "NEQ",
"tagValue": "Sent.TestServiceGetEchos"
}
]
]
Output with toJson on multi-line string using YAML marker |-:
processor {
spanDropFilters = "[\n [\n {\n \"tagKey\": \"http.method\",\n \"operator\": \"EQ\",\n \"tagValue\": \"GET\"\n },\n {\n \"tagKey\": \"http.url\",\n \"operator\": \"CONTAINS\",\n \"tagValue\": \"health\"\n }\n ],\n [\n {\n \"tagKey\": \"grpc.url\",\n \"operator\": \"NEQ\",\n \"tagValue\": \"Sent.TestServiceGetEchos\"\n }\n ]\n]"
}
And, so there was no need for toJson function. However, I modified the code to not use |- multi-string marker, and treat the value as a YAML for spanDropFilters. As you guys pointed out, this will be better to catch any config error by converting it to toJson, so going it with.
So, the input will be:
processor:
spanDropFilters:
[
[
{
"tagKey": "http.method",
"operator": "EQ",
"tagValue": "GET"
},
{
"tagKey": "http.url",
"operator": "CONTAINS",
"tagValue": "health"
}
],
[
{
"tagKey": "grpc.url",
"operator": "NEQ",
"tagValue": "Sent.TestServiceGetEchos"
}
]
]
Output for above using: {{ .Values.spanNormalizerConfig.processor.spanDropFilters | toJson }}
processor {
spanDropFilters = [[{"operator":"EQ","tagKey":"http.method","tagValue":"GET"},{"operator":"CONTAINS","tagKey":"http.url","tagValue":"health"}],[{"operator":"NEQ","tagKey":"grpc.url","tagValue":"Sent.TestServiceGetEchos"}]]
}
There was a problem hiding this comment.
oh ok |- this was present
This comment has been minimized.
This comment has been minimized.
| - '*': | ||
| reason: no available replacement | ||
| expires: 2021-12-31T00:00:00.000Z | ||
| expires: 2022-01-31T00:00:00.000Z |
There was a problem hiding this comment.
As currently there is no fixed version available for this (https://security.snyk.io/vuln/SNYK-JAVA-IONETTY-1042268), I am extending the expiry date for one month, till then it will not be reported as snyk failures.
Do you see anything wrong or missing something? It's YYYY-MM-DD, right?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Added constraints for view-gen framework in this repo, we will update the view-gen separately (hypertrace/view-generator-framework#53). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| "[Medium Severity][https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-2326698] " + | ||
| "in com.fasterxml.jackson.core:jackson-databind@2.12.2") | ||
| } | ||
| implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.17.1") { |
There was a problem hiding this comment.
we should update log4j version in view-generator-framework repository.
| implementation("com.fasterxml.jackson.core:jackson-databind:2.13.1") | ||
|
|
||
| constraints { | ||
| implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.17.1") { |
There was a problem hiding this comment.
we should update log4j version in view-generator-framework repository instead of adding constraint.
|
@rish691 @ravisingal Took care of log4j vuln vai fixing view-gen framework - hypertrace/view-generator-framework#53. Pl. re-approve. |
This PR makes spanDropFilter configurable via helm tempale.
Tested locally by running
helm template ./helmInput into values.yaml file:
Output:
Test example: https://github.com/hypertrace/hypertrace-ingester/blob/main/span-normalizer/span-normalizer/src/test/resources/configs/span-normalizer/application.conf#L30