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] Inject agent config directly into APM Fleet policies #99193

Closed

Conversation

ogupte
Copy link
Contributor

@ogupte ogupte commented May 4, 2021

Addresses #95501.

agent-config-fleet-sync-poc

@ogupte ogupte requested a review from a team as a code owner May 4, 2021 12:36
@botelastic botelastic bot added the Team:APM - DEPRECATED Use Team:obs-ux-infra_services. label May 4, 2021
@elasticmachine
Copy link
Contributor

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

@kibanamachine
Copy link
Contributor

kibanamachine commented May 4, 2021

💔 Build Failed

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
apm 36 37 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 4.2MB 4.2MB +1.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
apm 30.1KB 30.5KB +372.0B
Unknown metric groups

API count

id before after diff
apm 36 37 +1

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

Very nice work. Just added some small comments.

Comment on lines +66 to +68
const isFleetSyncLoading =
packagePolicyInputStatus !== FETCH_STATUS.FAILURE &&
packagePolicyInputStatus !== FETCH_STATUS.SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you use Loading instead?

Suggested change
const isFleetSyncLoading =
packagePolicyInputStatus !== FETCH_STATUS.FAILURE &&
packagePolicyInputStatus !== FETCH_STATUS.SUCCESS;
const isFleetSyncLoading = packagePolicyInputStatus === FETCH_STATUS.LOADING

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 also need it to be true when the status is NOT_INITIATED,i'll probably just include that in the check along with your suggestion.

Comment on lines +66 to +68
const { ['@timestamp']: lastTimestamp } = response.hits.hits[0]
._source as { '@timestamp': number };
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it necessary?

},
});
const agentConfigurations = configurationsSearchResponse.hits.hits
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use Type guards to avoid this @ts-ignore?

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'll see what i can do, I did it because _source has unknown property types when querying with the alertingEsClient

@@ -262,6 +284,57 @@ const agentConfigurationAgentNameRoute = createApmServerRoute({
},
});

// enables syncing with fleet-managed apm package policy
const agentConfigurationFleetSync = createApmServerRoute({
endpoint: 'POST /api/apm/settings/agent-configuration/fleet_sync',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also add an API to stop the sync?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want the button to also be a toggle, we can do that, otherwise the user is able to stop syncing by navigating to Stack management and delete the rule.

@@ -62,13 +99,38 @@ export function AgentConfigurations() {
<EuiTitle size="s">
<h2>
{i18n.translate(
'xpack.apm.agentConfig.configurationsPanelTitle',
'xpack.apm.agentConfig.configurationsPanel.title',
Copy link
Contributor

Choose a reason for hiding this comment

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

What was there already was correct according to the Kibana i18n guidelines.

savedObjectsClient,
{ kuery: 'ingest-package-policies.package.name:apm' }
);
const { config } = packagePolicies.items[0].inputs[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

If items is an empty array it returns undefined when you request the first element.

@simitt
Copy link
Contributor

simitt commented Jul 5, 2021

@ogupte was this superseeded by #100744?

@ogupte
Copy link
Contributor Author

ogupte commented Jul 12, 2021

@ogupte was this superseeded by #100744?

yes this can be closed

@ogupte ogupte closed this Jul 12, 2021
@ogupte ogupte deleted the apm-95501-agent-config-fleet-sync-poc branch July 12, 2021 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:APM - DEPRECATED Use Team:obs-ux-infra_services.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants