Skip to content
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

Make traceID, startTime, endTime, duration and traceName available for Link Patterns #1178

Merged

Conversation

MUI-Pop
Copy link
Contributor

@MUI-Pop MUI-Pop commented Feb 4, 2023

Which problem is this PR solving?

This change makes trace related keys like traceID, traceName, startTime, endTime and duration be available for Link Patterns.

It partially solves part of #578

Short description of the changes

  • Pass 'trace' object as additional parameter to LinksPatterns GetLink, there by trace variable would be accessible when computing link patterns for process, tags and logs type.

…r process, tags and logs linkpatterns

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
@MUI-Pop MUI-Pop force-pushed the inject-trace-details-to-linkpatterns branch from ff9f39f to 0318def Compare February 4, 2023 18:43
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

Overall looks good, but I have some suggestions, some to address in this PR, and a larger scoped issue #1179

Q: why does the description say that "It partially solves part of #578"? Could you please list which aspects it does not solve?

].map(processLinkPattern);

const spans = [
{ depth: 0, process: {}, tags: [{ key: 'myKey', value: 'valueOfMyKey' }] },
{ depth: 1, process: {}, logs: [{ fields: [{ key: 'myOtherKey', value: 'valueOfMy+Other+Key' }] }] },
{ depth: 1, process: {}, tags: [{ key: 'myThirdKey', value: 'valueOfThirdMyKey' }] },
Copy link
Member

Choose a reason for hiding this comment

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

seem redundant adding a new span, just add a new tag to one of the other spans

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed - added a new to existing span.

{
type: 'tags',
key: 'myThirdKey',
url: 'http://example.com/?myKey1=#{myKey}&myKey=#{myThirdKey}&traceID=#{traceID}&startTime=#{startTime}',
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's a good idea that you can reference trace-level attributes without qualification. I can see it for traceID, but why does startTime refer to trace-level and not span-level?

My preference would be to use trace.traceID, trace.startTime, etc. to clearly indicate the scope, not to try to infer it automatically.

Copy link
Member

Choose a reason for hiding this comment

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

Reading more into the existing code I am not a big fan of how it automatically ascends into ancestor spans when looking for tags. #1179

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed - now trace level are accessible only with trace.<data> qualification in template variables.

@MUI-Pop
Copy link
Contributor Author

MUI-Pop commented Feb 5, 2023

I said it partial because the current change makes trace related data accessible to logs, process and tags link pattern types but not span related data.

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Base: 95.26% // Head: 95.47% // Increases project coverage by +0.20% 🎉

Coverage data is based on head (4991ce3) compared to base (0395ce1).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1178      +/-   ##
==========================================
+ Coverage   95.26%   95.47%   +0.20%     
==========================================
  Files         243      243              
  Lines        7562     7575      +13     
  Branches     1895     1898       +3     
==========================================
+ Hits         7204     7232      +28     
+ Misses        351      336      -15     
  Partials        7        7              
Impacted Files Coverage Δ
...ePage/TraceTimelineViewer/VirtualizedTraceView.tsx 96.66% <100.00%> (+0.72%) ⬆️
packages/jaeger-ui/src/model/link-patterns.tsx 95.41% <100.00%> (+0.51%) ⬆️
...mponents/TracePage/TraceStatistics/tableValues.tsx 98.62% <0.00%> (+4.82%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
@MUI-Pop MUI-Pop requested review from yurishkuro and removed request for tiffon, everett980 and rubenvp8510 February 6, 2023 21:19
packages/jaeger-ui/src/model/link-patterns.tsx Outdated Show resolved Hide resolved
it('calls getLinks with expected params', () => {
const span = trace.spans[1];
instance.linksGetter(span, span.tags, 0);
expect(getLinksSpy).toHaveBeenCalledWith(span, span.tags, 0, trace);
Copy link
Member

Choose a reason for hiding this comment

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

it would be better to validate the actual value returned, which, as I understand, is [{url, text}]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't find a clean way to initialize linkPatterns for tests, so I exported the const processedLinks in link-patterns.tsx.

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
yurishkuro
yurishkuro previously approved these changes Feb 7, 2023
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

lgtm, just a couple minor comments.

I didn't find a clean way to initialize linkPatterns for tests, so I exported the const processedLinks in link-patterns.tsx.

yeah, the API feels unnecessarily complicated, it could've just accepted processed patterns as optional arg, since the methods to process patterns are exported anyway.

Comment on lines 194 to 197
const traceKV = getParameterInTrace(parameter.split('trace.')[1], trace);
if (traceKV) {
entry = traceKV;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const traceKV = getParameterInTrace(parameter.split('trace.')[1], trace);
if (traceKV) {
entry = traceKV;
}
entry = getParameterInTrace(parameter.split('trace.')[1], trace);

getLinks.processedLinks.push(...origLinkPatterns);
});

it('calls getLinks with expected params', () => {
Copy link
Member

Choose a reason for hiding this comment

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

stale title

@@ -22,6 +22,7 @@ import { DEFAULT_HEIGHTS, VirtualizedTraceViewImpl } from './VirtualizedTraceVie
import traceGenerator from '../../../demo/trace-generators';
import transformTraceData from '../../../model/transform-trace-data';
import updateUiFindSpy from '../../../utils/update-ui-find';
import * as getLinks from '../../../model/link-patterns';
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
import * as getLinks from '../../../model/link-patterns';
import * as linkPatterns from '../../../model/link-patterns';

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
@yurishkuro yurishkuro merged commit e2297dc into jaegertracing:main Feb 8, 2023
@yurishkuro
Copy link
Member

Thanks! 🎉

Could you also make a PR in the documentation repo to describe this change in https://www.jaegertracing.io/docs/1.42/frontend-ui/#link-patterns ?

yurishkuro pushed a commit to jaegertracing/documentation that referenced this pull request Feb 8, 2023
Updating the documentation for the linkPatterns change done in jaeger ui
in PR jaegertracing/jaeger-ui#1178

Signed-off-by: Kanahathi Mohideen <kpmfazal@gmail.com>
@yurishkuro yurishkuro changed the title Make traceID, startTime, endTime, duration and traceName available fo… Make traceID, startTime, endTime, duration and traceName available for Link Patterns Mar 14, 2023
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.

None yet

2 participants