Skip to content

Fix URI path in EnrichedSpanUtils#197

Merged
pavan-traceable merged 3 commits intomainfrom
bugfix/master/kong-module-9
May 29, 2021
Merged

Fix URI path in EnrichedSpanUtils#197
pavan-traceable merged 3 commits intomainfrom
bugfix/master/kong-module-9

Conversation

@pavan-traceable
Copy link
Copy Markdown
Contributor

Description

While retrieving http url it should also check attribute map apart from first class fields

Testing

Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2021

Codecov Report

Merging #197 (9e2cf1b) into main (23bd0d7) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #197      +/-   ##
============================================
- Coverage     79.51%   79.50%   -0.01%     
+ Complexity     1133     1131       -2     
============================================
  Files           101      101              
  Lines          4370     4363       -7     
  Branches        406      405       -1     
============================================
- Hits           3475     3469       -6     
  Misses          704      704              
+ Partials        191      190       -1     
Flag Coverage Δ
unit 79.50% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...nrichedspan/constants/utils/EnrichedSpanUtils.java 53.45% <100.00%> (+0.29%) ⬆️
...ormalizer/fieldgenerators/HttpFieldsGenerator.java 93.93% <100.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23bd0d7...9e2cf1b. Read the comment docs.

@github-actions

This comment has been minimized.

}

return Optional.empty();
String httpUrl = getStringAttribute(event, EnrichedSpanConstants.getValue(Http.HTTP_URL));
Copy link
Copy Markdown
Contributor

@skjindal93 skjindal93 May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we get rid of reading everything off from first class fields, at least for this method? If the intention is to make this more of a safer change as a fallback, we should be doing the same thing here

https://github.com/hypertrace/hypertrace-ingester/blob/main/span-normalizer/span-normalizer/src/main/java/org/hypertrace/core/spannormalizer/fieldgenerators/HttpFieldsGenerator.java#L427

But, I feel if the intention is to get rid of the first class fields, then let's move towards it, and completely get rid of reading the values from first class fields

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already ongoing effort to clean up all the fields, if i have completely get rid of first class completely then all the logic HttpFieldsGenerator should be copied to here as well, which i don't want to do it. In case if that logic not able to find http url, we can fallback to checking the attribute map which i am doing here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removal of first class fields is tracked under this issue hypertrace/hypertrace#245, idea is to move logic for populating first class field to a common lib, consumers can then either directly read attributes or leverage this lib

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i have completely get rid of first class completely then all the logic HttpFieldsGenerator should be copied to here as well

Basically, I have couple of concerns

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Fixed please check now.

HTTP_REQUEST_QUERY_PARAM = 2 [(string_value) = "http.request.query.param"];
HTTP_HOST = 3 [(string_value) = "HTTP_HOST"]; // We should probably stick to a standard of keeping all enriched attributes in capital letters.
HTTP_REQUEST_PATH_PARAM = 4 [(string_value) = "http.request.path.param"];
HTTP_URL = 5 [(string_value) = "http.url"];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http.url isn't an enriched attribute. It's a raw span attribute. There is no need to add it here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

return Optional.empty();
String httpUrl = getStringAttribute(event, EnrichedSpanConstants.getValue(Http.HTTP_URL));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this var is also not needed

Pavan Kumar Kolamuri added 2 commits May 28, 2021 18:29
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@pavan-traceable pavan-traceable merged commit 9cd99c4 into main May 29, 2021
@pavan-traceable pavan-traceable deleted the bugfix/master/kong-module-9 branch May 29, 2021 05:57
@github-actions
Copy link
Copy Markdown

Unit Test Results

  65 files  ±0    65 suites  ±0   47s ⏱️ ±0s
315 tests ±0  315 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9cd99c4. ± Comparison against base commit 23bd0d7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants