-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Add Agent Keys in APM settings - Create agent keys #120373
Conversation
@kibanamachine merge upstream |
merge conflict between base and head |
68fd4fb
to
0ac9f23
Compare
x-pack/plugins/apm/server/routes/agent_keys/create_agent_key.ts
Outdated
Show resolved
Hide resolved
.filter((x) => !x[1]) | ||
.map((x) => x[0]) | ||
.join(', '); | ||
const error = `${username} is missing the following requested privilege(s): ${missingPrivileges}.\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it makes sense to show this error in the UI as this requirement doesn't seem to be documented. Is it ok if we display whichever error is thrown from this route or hardcode the text in the UI as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cauemarcondes @sqren what do you think?
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Show resolved
Hide resolved
@formgeist could you please have a look at this and #119543 ? |
Pinging @elastic/apm-ui (Team:apm) |
@kibanamachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM - I've added some copy comments and suggestions to the layout in some scenarios
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
...plugins/apm/public/components/app/Settings/agent_keys/create_agent_key/agent_key_callout.tsx
Outdated
Show resolved
Hide resolved
...plugins/apm/public/components/app/Settings/agent_keys/create_agent_key/agent_key_callout.tsx
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Casper Hübertz <[email protected]>
@gbamparop Another request - let me know if you'd rather have a separate issue for this... But I reckon we should move the agent keys closer to the agent configuration in the list of tabs in Settings. Also follows better the alphabetical sorting that (unintentionally) is happening there. |
…llout when invalidating a key
@formgeist thanks for the feedback! All comments have been addressed in this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @gbamparop just added a few comments
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/app/Settings/agent_keys/create_agent_key.tsx
Show resolved
Hide resolved
...plugins/apm/public/components/app/Settings/agent_keys/create_agent_key/agent_key_callout.tsx
Outdated
Show resolved
Hide resolved
</EuiCopy> | ||
} | ||
> | ||
<input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you didn't use <EuiFieldText/>
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the UI pattern from api keys management with a custom EuiFormControlLayout
so we can use the prepend and append elements. I could change it if you think there's a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is addressed in #120765
x-pack/plugins/apm/public/components/app/Settings/agent_keys/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/server/routes/agent_keys/create_agent_key.ts
Outdated
Show resolved
Hide resolved
const [keyName, setKeyName] = useState(''); | ||
const [agentConfigChecked, setAgentConfigChecked] = useState(true); | ||
const [eventWriteChecked, setEventWriteChecked] = useState(true); | ||
const [sourcemapChecked, setSourcemapChecked] = useState(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about combining these into a single state?
const [keyName, setKeyName] = useState(''); | |
const [agentConfigChecked, setAgentConfigChecked] = useState(true); | |
const [eventWriteChecked, setEventWriteChecked] = useState(true); | |
const [sourcemapChecked, setSourcemapChecked] = useState(true); | |
const [agentKeyBody, setAgentKeyBody] = useState<AgentKeyBody>({ | |
name: '', | |
sourcemap: true, | |
event: true, | |
agentConfig: true | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a matter of preference and code consistency when working with forms, I normally use different states but happy to change it if a single state is preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to single state in #120765
@elasticmachine merge upstream |
@cauemarcondes @sqren thanks for the feedback! I have addressed most of the changes, please let me know what you think. |
💛 Build succeeded, but was flaky
Test Failures
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work!
) * Add support for creating agent keys Co-authored-by: Casper Hübertz <[email protected]> Co-authored-by: Cauê Marcondes <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…120652) * Add support for creating agent keys Co-authored-by: Casper Hübertz <[email protected]> Co-authored-by: Cauê Marcondes <[email protected]> Co-authored-by: Giorgos Bamparopoulos <[email protected]> Co-authored-by: Cauê Marcondes <[email protected]>
if (!sourcemap && !event && !agentConfig) { | ||
privileges.push( | ||
PrivilegeType.SOURCEMAP, | ||
PrivilegeType.EVENT, | ||
PrivilegeType.AGENT_CONFIG | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gbamparop Just noticing this. So if all 3 are false, we'll add the privileges for all of them anyway. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #120765
t.partial({ | ||
sourcemap: toBooleanRt, | ||
event: toBooleanRt, | ||
agentConfig: toBooleanRt, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the docs, I think this should simply take a list of the privileges, restricted to the 3 APM privileges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in #120765
Sorry, I too am late to the party 🙃 With Elastic Agent in the picture, I wonder if we should be more descriptive with our UI text. The word "agent" appears a lot on this screen, but it might not be clear to users whether we're referring to Elastic Agent, APM agents, or both. Sure, we're in the APM app, but I don't think that's reason enough for users to assume we're talking about APM agents. What if we changed the buttons to each say, |
@bmorelli25 Very good points, I agree we can be more explicit.
Makes sense to me - will you also look into aligning this in the other tab contents for agent config etc.? |
@bmorelli25 thanks for the feedback, I've changed all ...agent... instances apart from the tab in #120765 |
) * Add support for creating agent keys Co-authored-by: Casper Hübertz <[email protected]> Co-authored-by: Cauê Marcondes <[email protected]>
Summary
This PR adds the following:
Agent keys table was added in #119543
There will be other PRs for the below:
Addresses part of #77966
Screen.Recording.2021-12-03.at.17.10.05.mov