Skip to content

create_instrumentation_configuration

create_instrumentation_configuration(
    instrumentation_type: InstrumentationType,
    service: str,
    environment: str,
    signal_type: DynamicInstrumentationSignalType,
    location: Location,
    capture_configuration: CaptureConfiguration,
    *,
    config_overrides: Optional[ApplicationSignalsClientConfig] = None,
    description: Optional[str] = None,
    expires_at: Optional[datetime] = None,
    attribute_filters: Optional[DynamicInstrumentationAttributeFilters] = None,
    tags: Optional[TagList] = None,
) -> CreateInstrumentationConfigurationResponse

Creates a dynamic instrumentation configuration for a specific code or endpoint location within a service and environment. Configurations are immutable after creation.

For BREAKPOINT type configurations, they expire after 24 hours unless a shorter expiration is provided. For PROBE type configurations, they persist until explicitly deleted; an expiration cannot be set for PROBE configurations.

If a configuration already exists for the same service, environment, signal type, and location, this operation returns a conflict instead of overwriting it. Use attribute filters and capture settings to control where the instrumentation runs and which data is collected.

Parameters:

  • instrumentation_type (InstrumentationType) –

    Type of instrumentation: BREAKPOINT (temporary) or PROBE (permanent)

  • service (str) –

    The name of the service to instrument. This should match the service.name resource attribute reported by the application.

  • environment (str) –

    The environment that the service is running in, such as eks:cluster-prod/namespace or ec2:production.

  • signal_type (DynamicInstrumentationSignalType) –

    The telemetry signal type to emit for this instrumentation. The supported value is SNAPSHOT.

  • location (Location) –

    The location where instrumentation should be applied. Specify a CodeLocation for code-level instrumentation.

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

    An optional short description (up to 50 characters) that explains the purpose of this instrumentation.

  • expires_at (Optional[datetime], default: None ) –

    For BREAKPOINT: optional, defaults to 24 hours, must be between 5 min and 24 hours. For PROBE: not supported. PROBE configurations are permanent and persist until explicitly deleted.

  • attribute_filters (Optional[DynamicInstrumentationAttributeFilters], default: None ) –

    Client-side filters that target specific instances. Each object in the array is AND-matched on its keys, and multiple objects are OR-matched to decide where to apply the instrumentation.

  • capture_configuration (CaptureConfiguration) –

    Specifies what to capture when the instrumentation point is hit. Specify CodeCapture for code-level capture settings.

  • tags (Optional[TagList], default: None ) –

    An optional list of key-value pairs to associate with the instrumentation configuration. Tags can help you organize and categorize your resources.

Raises:

Source code in docs_src/capo_application_signals/_services/application_signals.py
def create_instrumentation_configuration(
    self,
    instrumentation_type: "capo_application_signals.types.instrumentation_type.InstrumentationType",
    service: str,
    environment: str,
    signal_type: "capo_application_signals.types.dynamic_instrumentation_signal_type.DynamicInstrumentationSignalType",
    location: "capo_application_signals.types.location.Location",
    capture_configuration: "capo_application_signals.types.capture_configuration.CaptureConfiguration",
    *,
    config_overrides: Optional[ApplicationSignalsClientConfig] = None,
    description: Optional[str] = None,
    expires_at: Optional[datetime.datetime] = None,
    attribute_filters: Optional[
        "capo_application_signals.types.dynamic_instrumentation_attribute_filters.DynamicInstrumentationAttributeFilters"
    ] = None,
    tags: Optional["capo_application_signals.types.tag_list.TagList"] = None,
) -> "capo_application_signals.types.create_instrumentation_configuration_response.CreateInstrumentationConfigurationResponse":
    """<p>Creates a dynamic instrumentation configuration for a specific code or endpoint location within a service and environment. Configurations are immutable after creation.</p> <p>For <code>BREAKPOINT</code> type configurations, they expire after 24 hours unless a shorter expiration is provided. For <code>PROBE</code> type configurations, they persist until explicitly deleted; an expiration cannot be set for <code>PROBE</code> configurations.</p> <p>If a configuration already exists for the same service, environment, signal type, and location, this operation returns a conflict instead of overwriting it. Use attribute filters and capture settings to control where the instrumentation runs and which data is collected.</p>

    Args:
        instrumentation_type: Type of instrumentation: BREAKPOINT (temporary) or PROBE (permanent)
        service: <p>The name of the service to instrument. This should match the <code>service.name</code> resource attribute reported by the application.</p>
        environment: <p>The environment that the service is running in, such as <code>eks:cluster-prod/namespace</code> or <code>ec2:production</code>.</p>
        signal_type: <p>The telemetry signal type to emit for this instrumentation. The supported value is <code>SNAPSHOT</code>.</p>
        location: <p>The location where instrumentation should be applied. Specify a <code>CodeLocation</code> for code-level instrumentation.</p>
        description: <p>An optional short description (up to 50 characters) that explains the purpose of this instrumentation.</p>
        expires_at: For BREAKPOINT: optional, defaults to 24 hours, must be between 5 min and 24 hours. For PROBE: not supported. PROBE configurations are permanent and persist until explicitly deleted.
        attribute_filters: <p>Client-side filters that target specific instances. Each object in the array is AND-matched on its keys, and multiple objects are OR-matched to decide where to apply the instrumentation.</p>
        capture_configuration: <p>Specifies what to capture when the instrumentation point is hit. Specify <code>CodeCapture</code> for code-level capture settings.</p>
        tags: <p>An optional list of key-value pairs to associate with the instrumentation configuration. Tags can help you organize and categorize your resources.</p>

    Raises:
        capo_application_signals.errors.conflict_exception.ConflictException: <p>This operation attempted to create a resource that already exists.</p>
        capo_application_signals.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This request exceeds a service quota.</p>
        capo_application_signals.errors.throttling_exception.ThrottlingException: <p>The request was throttled because of quota limits.</p>
        capo_application_signals.errors.validation_exception.ValidationException: <p>The resource is not valid.</p>
        capo_application_signals.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_application_signals.types.create_instrumentation_configuration_request.CreateInstrumentationConfigurationRequest]",
    ) -> OperationResponse[
        "capo_application_signals.types.create_instrumentation_configuration_response.CreateInstrumentationConfigurationResponse"
    ]:
        import capo_application_signals._operations.application_signals.create_instrumentation_configuration

        output, http_response = (
            capo_application_signals._operations.application_signals.create_instrumentation_configuration.create_instrumentation_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInstrumentationConfiguration")
    )
    input_: capo_application_signals.types.create_instrumentation_configuration_request.CreateInstrumentationConfigurationRequest = {
        "instrumentation_type": instrumentation_type,
        "service": service,
        "environment": environment,
        "signal_type": signal_type,
        "location": location,
        "capture_configuration": capture_configuration,
    }
    if description is not None:
        input_["description"] = description
    if expires_at is not None:
        input_["expires_at"] = expires_at
    if attribute_filters is not None:
        input_["attribute_filters"] = attribute_filters
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output