[Profiling] fetching latest package version to use in instructions (#160498)

<img width="2461" alt="Screenshot 2023-06-26 at 10 44 41 AM"
src="40c28399-ba1e-4ab3-a8dd-a8d0c2f9e593">
This commit is contained in:
Cauê Marcondes 2023-07-03 18:50:47 -03:00 committed by GitHub
parent 6b02be4488
commit f923e9ddc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -329,7 +329,7 @@ docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-hos
iconType="gear"
fill
href={`${core.http.basePath.prepend(
'/app/integrations/detail/profiler_agent-8.8.0-preview/overview?prerelease=true'
`/app/integrations/detail/profiler_agent-${data?.profilerAgent.version}/overview?prerelease=true`
)}`}
>
{i18n.translate('xpack.profiling.tabs.elasticAgentIntegrarion.step2.button', {

View file

@ -7,6 +7,7 @@
import { SavedObjectsClientContract } from '@kbn/core/server';
import { PackagePolicyClient } from '@kbn/fleet-plugin/server';
import { fetchFindLatestPackageOrThrow } from '@kbn/fleet-plugin/server/services/epm/registry';
import { getCollectorPolicy } from './fleet_policies';
export interface SetupDataCollectionInstructions {
@ -17,6 +18,9 @@ export interface SetupDataCollectionInstructions {
symbolizer: {
host?: string;
};
profilerAgent: {
version: string;
};
}
export async function getSetupInstructions({
@ -28,6 +32,7 @@ export async function getSetupInstructions({
soClient: SavedObjectsClientContract;
apmServerHost?: string;
}): Promise<SetupDataCollectionInstructions> {
const profilerAgent = await fetchFindLatestPackageOrThrow('profiler_agent', { prerelease: true });
const collectorPolicy = await getCollectorPolicy({ packagePolicyClient, soClient });
if (!collectorPolicy) {
@ -46,5 +51,8 @@ export async function getSetupInstructions({
symbolizer: {
host: symbolizerHost,
},
profilerAgent: {
version: profilerAgent.version,
},
};
}