Skip to content

get_profile async

get_profile(
    profiling_group_name: ProfilingGroupName,
    *,
    config_overrides: Optional[AsyncCodeGuruProfilerClientConfig] = None,
    start_time: Optional[Timestamp] = None,
    period: Optional[Period] = None,
    end_time: Optional[Timestamp] = None,
    max_depth: Optional[MaxDepth] = None,
    accept: Optional[str] = None,
) -> GetProfileResponse

Gets the aggregated profile of a profiling group for a specified time range. Amazon CodeGuru Profiler collects posted agent profiles for a profiling group into aggregated profiles.

Because aggregated profiles expire over time GetProfile is not idempotent.

Specify the time range for the requested aggregated profile using 1 or 2 of the following parameters: startTime, endTime, period. The maximum time range allowed is 7 days. If you specify all 3 parameters, an exception is thrown. If you specify only period, the latest aggregated profile is returned.

Aggregated profiles are available with aggregation periods of 5 minutes, 1 hour, and 1 day, aligned to UTC. The aggregation period of an aggregated profile determines how long it is retained. For more information, see AggregatedProfileTime . The aggregated profile's aggregation period determines how long it is retained by CodeGuru Profiler.

  • If the aggregation period is 5 minutes, the aggregated profile is retained for 15 days.

  • If the aggregation period is 1 hour, the aggregated profile is retained for 60 days.

  • If the aggregation period is 1 day, the aggregated profile is retained for 3 years.

There are two use cases for calling GetProfile.

  1. If you want to return an aggregated profile that already exists, use ListProfileTimes to view the time ranges of existing aggregated profiles. Use them in a GetProfile request to return a specific, existing aggregated profile.

  2. If you want to return an aggregated profile for a time range that doesn't align with an existing aggregated profile, then CodeGuru Profiler makes a best effort to combine existing aggregated profiles from the requested time range and return them as one aggregated profile.

    If aggregated profiles do not exist for the full time range requested, then aggregated profiles for a smaller time range are returned. For example, if the requested time range is from 00:00 to 00:20, and the existing aggregated profiles are from 00:15 and 00:25, then the aggregated profiles from 00:15 to 00:20 are returned.

Parameters:

  • profiling_group_name (ProfilingGroupName) –

    The name of the profiling group to get.

  • start_time (Optional[Timestamp], default: None ) –

    The start time of the profile to get. Specify using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.

    If you specify startTime, then you must also specify period or endTime, but not both.

  • period (Optional[Period], default: None ) –

    Used with startTime or endTime to specify the time range for the returned aggregated profile. Specify using the ISO 8601 format. For example, P1DT1H1M1S.

    To get the latest aggregated profile, specify only period.

  • end_time (Optional[Timestamp], default: None ) –

    The end time of the requested profile. Specify using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.

    If you specify endTime, then you must also specify period or startTime, but not both.

  • max_depth (Optional[MaxDepth], default: None ) –

    The maximum depth of the stacks in the code that is represented in the aggregated profile. For example, if CodeGuru Profiler finds a method A, which calls method B, which calls method C, which calls method D, then the depth is 4. If the maxDepth is set to 2, then the aggregated profile contains representations of methods A and B.

  • accept (Optional[str], default: None ) –

    The format of the returned profiling data. The format maps to the Accept and Content-Type headers of the HTTP request. You can specify one of the following: or the default .

    • application/json — standard JSON format

    • application/x-amzn-ion — the Amazon Ion data format. For more information, see Amazon Ion.

Raises:

Source code in docs_src/capo_codeguruprofiler/_services/async_code_guru_profiler.py
async def get_profile(
    self,
    profiling_group_name: "capo_codeguruprofiler.types.profiling_group_name.ProfilingGroupName",
    *,
    config_overrides: Optional[AsyncCodeGuruProfilerClientConfig] = None,
    start_time: Optional["capo_codeguruprofiler.types.timestamp.Timestamp"] = None,
    period: Optional["capo_codeguruprofiler.types.period.Period"] = None,
    end_time: Optional["capo_codeguruprofiler.types.timestamp.Timestamp"] = None,
    max_depth: Optional["capo_codeguruprofiler.types.max_depth.MaxDepth"] = None,
    accept: Optional[str] = None,
) -> "capo_codeguruprofiler.types.get_profile_response.GetProfileResponse":
    """<p> Gets the aggregated profile of a profiling group for a specified time range. Amazon CodeGuru Profiler collects posted agent profiles for a profiling group into aggregated profiles. </p> <note> <p> Because aggregated profiles expire over time <code>GetProfile</code> is not idempotent. </p> </note> <p> Specify the time range for the requested aggregated profile using 1 or 2 of the following parameters: <code>startTime</code>, <code>endTime</code>, <code>period</code>. The maximum time range allowed is 7 days. If you specify all 3 parameters, an exception is thrown. If you specify only <code>period</code>, the latest aggregated profile is returned. </p> <p> Aggregated profiles are available with aggregation periods of 5 minutes, 1 hour, and 1 day, aligned to UTC. The aggregation period of an aggregated profile determines how long it is retained. For more information, see <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html"> <code>AggregatedProfileTime</code> </a>. The aggregated profile's aggregation period determines how long it is retained by CodeGuru Profiler. </p> <ul> <li> <p> If the aggregation period is 5 minutes, the aggregated profile is retained for 15 days. </p> </li> <li> <p> If the aggregation period is 1 hour, the aggregated profile is retained for 60 days. </p> </li> <li> <p> If the aggregation period is 1 day, the aggregated profile is retained for 3 years. </p> </li> </ul> <p>There are two use cases for calling <code>GetProfile</code>.</p> <ol> <li> <p> If you want to return an aggregated profile that already exists, use <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ListProfileTimes.html"> <code>ListProfileTimes</code> </a> to view the time ranges of existing aggregated profiles. Use them in a <code>GetProfile</code> request to return a specific, existing aggregated profile. </p> </li> <li> <p> If you want to return an aggregated profile for a time range that doesn't align with an existing aggregated profile, then CodeGuru Profiler makes a best effort to combine existing aggregated profiles from the requested time range and return them as one aggregated profile. </p> <p> If aggregated profiles do not exist for the full time range requested, then aggregated profiles for a smaller time range are returned. For example, if the requested time range is from 00:00 to 00:20, and the existing aggregated profiles are from 00:15 and 00:25, then the aggregated profiles from 00:15 to 00:20 are returned. </p> </li> </ol>

    Args:
        profiling_group_name: <p>The name of the profiling group to get.</p>
        start_time: <p>The start time of the profile to get. Specify using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC.</p> <p> If you specify <code>startTime</code>, then you must also specify <code>period</code> or <code>endTime</code>, but not both. </p>
        period: <p> Used with <code>startTime</code> or <code>endTime</code> to specify the time range for the returned aggregated profile. Specify using the ISO 8601 format. For example, <code>P1DT1H1M1S</code>. </p> <p> To get the latest aggregated profile, specify only <code>period</code>. </p>
        end_time: <p> The end time of the requested profile. Specify using the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020 1:15:02 PM UTC. </p> <p> If you specify <code>endTime</code>, then you must also specify <code>period</code> or <code>startTime</code>, but not both. </p>
        max_depth: <p> The maximum depth of the stacks in the code that is represented in the aggregated profile. For example, if CodeGuru Profiler finds a method <code>A</code>, which calls method <code>B</code>, which calls method <code>C</code>, which calls method <code>D</code>, then the depth is 4. If the <code>maxDepth</code> is set to 2, then the aggregated profile contains representations of methods <code>A</code> and <code>B</code>. </p>
        accept: <p> The format of the returned profiling data. The format maps to the <code>Accept</code> and <code>Content-Type</code> headers of the HTTP request. You can specify one of the following: or the default . </p> <ul> <li> <p> <code>application/json</code> — standard JSON format </p> </li> <li> <p> <code>application/x-amzn-ion</code> — the Amazon Ion data format. For more information, see <a href="http://amzn.github.io/ion-docs/">Amazon Ion</a>. </p> </li> </ul>

    Raises:
        capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_codeguruprofiler.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_codeguruprofiler.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
        capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeguruprofiler.types.get_profile_request.GetProfileRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeguruprofiler.types.get_profile_response.GetProfileResponse"
    ]:
        import capo_codeguruprofiler._operations.code_guru_profiler.get_profile

        (
            output,
            http_response,
        ) = await capo_codeguruprofiler._operations.code_guru_profiler.get_profile.async_get_profile(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetProfile")
    )
    input_: capo_codeguruprofiler.types.get_profile_request.GetProfileRequest = {
        "profiling_group_name": profiling_group_name
    }
    if start_time is not None:
        input_["start_time"] = start_time
    if period is not None:
        input_["period"] = period
    if end_time is not None:
        input_["end_time"] = end_time
    if max_depth is not None:
        input_["max_depth"] = max_depth
    if accept is not None:
        input_["accept"] = accept

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output