opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

[pkg/telemetryquerylanguage] add replace_key_all_patterns function

Open fatsheep9146 opened this issue 3 years ago • 9 comments

Signed-off-by: Ziqi Zhao [email protected]

Description: <Describe what has changed.> fix #12631

fatsheep9146 avatar Aug 07 '22 02:08 fatsheep9146

@fatsheep9146 can you break this into 2 PR, one for the function add and one to the transform processor? It'd be nice to do it all in one PR but any functions added to transformprocessor should have integration tests added to a signals processor_test.go and I think the PR would be too large.

TylerHelmuth avatar Aug 07 '22 02:08 TylerHelmuth

@fatsheep9146 can you break this into 2 PR, one for the function add and one to the transform processor? It'd be nice to do it all in one PR but any functions added to transformprocessor should have integration tests added to a signals processor_test.go and I think the PR would be too large.

I've removed it from transform processor, and I will submit second PR until this one is merged.

fatsheep9146 avatar Aug 07 '22 04:08 fatsheep9146

The integration test seems unrelated to this pr @TylerHelmuth

fatsheep9146 avatar Aug 15 '22 10:08 fatsheep9146

@bogdandrutu @kentquirk curious on your thoughts on this function. It will certainly meet the needs of the user to rename keys in bulk, but we'd end up with replace_match, replace_all_matches, replace_pattern, replace_all_patterns, and replace_key_all_patterns functions, all that are named similarly and do similar, but slightly different things.

For this particular use case we could instead update replace_all_patterns to take a new parameter (string or enum) that specifies whether the function applies to keys or values and update the logic accordingly. This would be a breaking change (which is ok bc the processor/tql is still in alpha), but would keep the number of functions lower.

TylerHelmuth avatar Aug 15 '22 17:08 TylerHelmuth

For this particular use case we could instead update replace_all_patterns to take a new parameter (string or enum) that specifies whether the function applies to keys or values and update the logic accordingly.

@fatsheep9146 please update your implementation to match this comment instead of adding a new function.

TylerHelmuth avatar Aug 18 '22 21:08 TylerHelmuth

For this particular use case we could instead update replace_all_patterns to take a new parameter (string or enum) that specifies whether the function applies to keys or values and update the logic accordingly.

@fatsheep9146 please update your implementation to match this comment instead of adding a new function.

I already add a new parameter, please help review this =D @TylerHelmuth

fatsheep9146 avatar Aug 24 '22 15:08 fatsheep9146

Please help review this again =D @TylerHelmuth

fatsheep9146 avatar Aug 29 '22 10:08 fatsheep9146

All comments are fixed. @TylerHelmuth

fatsheep9146 avatar Aug 31 '22 01:08 fatsheep9146

@bogdandrutu Could you help review this?

fatsheep9146 avatar Sep 06 '22 05:09 fatsheep9146

@fatsheep9146 please address conflicts

TylerHelmuth avatar Sep 22 '22 04:09 TylerHelmuth

@fatsheep9146 please address conflicts

I think the failed task is due to transformprocessor

make[2]: Entering directory '/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/processor/transformprocessor'
Check License finished successfully
running misspell -error
golangci-lint run --allow-parallel-runners
make[2]: Leaving directory '/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/processor/tailsamplingprocessor'
Error: internal/logs/processor_test.go:90:79: td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().InsertString undefined (type pcommon.Map has no field or method InsertString) (typecheck)
				td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().InsertString("url", "http://localhost/health")

Should I fix those in seperate prs? @TylerHelmuth

fatsheep9146 avatar Sep 22 '22 05:09 fatsheep9146

@fatsheep9146 Ya those errors don't seem correct. Attempt to fix in another PR, but I suspect if you create a new branch from main you won't see them.

TylerHelmuth avatar Sep 22 '22 05:09 TylerHelmuth

@fatsheep9146 Ya those errors don't seem correct. Attempt to fix in another PR, but I suspect if you create a new branch from main you won't see them.

Sorry, it's my mistake, the reason is that in transformprocessor test, I also fix some test for this feature, I will fix this.

fatsheep9146 avatar Sep 22 '22 05:09 fatsheep9146

Needs a rebase

Rebase done, I think this is ready-to-merge. @codeboten @TylerHelmuth

fatsheep9146 avatar Sep 24 '22 01:09 fatsheep9146

@TylerHelmuth @codeboten Could you help add ready-to-merge label?

fatsheep9146 avatar Sep 29 '22 03:09 fatsheep9146

Please add a changelog entry.

bogdandrutu avatar Sep 29 '22 06:09 bogdandrutu

@fatsheep9146 please rebase.

TylerHelmuth avatar Sep 30 '22 01:09 TylerHelmuth

This is awesome, thanks so much everyone 🍾

EddieEldridge avatar Oct 06 '22 15:10 EddieEldridge