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

[APM] Use `ProcessorEvent` constants everywhere instead of literals #52134

Open
sqren opened this issue Dec 3, 2019 · 4 comments · May be fixed by #53096
Open

[APM] Use `ProcessorEvent` constants everywhere instead of literals #52134

sqren opened this issue Dec 3, 2019 · 4 comments · May be fixed by #53096

Comments

@sqren
Copy link
Member

@sqren sqren commented Dec 3, 2019

We have a ProcessorEvent enum:
https://github.com/elastic/kibana/blob/d1de029b8873e29c35df4bf6ce95f987efd83874/x-pack/legacy/plugins/apm/common/processor_event.ts#L7-L12

This should be used instead of string literals:

// bad
term: { [PROCESSOR_EVENT]: 'transaction' }

// good
term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction }

Examples where ProcessorEvent is used:

{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },

Examples where ProcessorEvent should be used:

terms: { [PROCESSOR_EVENT]: ['transaction', 'error', 'metric'] }

const indexNames = processorEvent
? [processorEvent]
: ['transaction' as const, 'metric' as const, 'error' as const];

t.literal('transaction'),
t.literal('metric'),
t.literal('error')

... and many other places.

@elasticmachine

This comment has been minimized.

Copy link
Contributor

@elasticmachine elasticmachine commented Dec 3, 2019

Pinging @elastic/apm-ui (Team:apm)

@zufishanali

This comment has been minimized.

Copy link

@zufishanali zufishanali commented Dec 10, 2019

Hi @sqren. This is my first time with Typescript. May I look into this issue?

@sqren

This comment has been minimized.

Copy link
Member Author

@sqren sqren commented Dec 10, 2019

Hi @zufishanali,

Sure, I'll assign it to you. Let me know if you have any questions.

@sqren

This comment has been minimized.

Copy link
Member Author

@sqren sqren commented Dec 11, 2019

@zufishanali The easiest way to start working on Elastic APM is by following the APM UI readme to setup the stack: https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/apm/readme.md

zufishanali added a commit to zufishanali/kibana that referenced this issue Dec 16, 2019
@zufishanali zufishanali linked a pull request that will close this issue Dec 16, 2019
0 of 7 tasks complete
zufishanali added a commit to zufishanali/kibana that referenced this issue Dec 18, 2019
zufishanali added a commit to zufishanali/kibana that referenced this issue Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.