createInstrumentationConfiguration method
- required CaptureConfiguration captureConfiguration,
- required String environment,
- required InstrumentationType instrumentationType,
- required Location location,
- required String service,
- required DynamicInstrumentationSignalType signalType,
- List<
Map< ? attributeFilters,String, String> > - String? description,
- DateTime? expiresAt,
- List<
Tag> ? tags,
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.
May throw ConflictException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter captureConfiguration :
Specifies what to capture when the instrumentation point is hit. Specify
CodeCapture for code-level capture settings.
Parameter environment :
The environment that the service is running in, such as
eks:cluster-prod/namespace or ec2:production.
Parameter instrumentationType :
Type of instrumentation: BREAKPOINT (temporary) or PROBE (permanent)
Parameter location :
The location where instrumentation should be applied. Specify a
CodeLocation for code-level instrumentation.
Parameter service :
The name of the service to instrument. This should match the
service.name resource attribute reported by the application.
Parameter signalType :
The telemetry signal type to emit for this instrumentation. The supported
value is SNAPSHOT.
Parameter attributeFilters :
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.
Parameter description :
An optional short description (up to 50 characters) that explains the
purpose of this instrumentation.
Parameter expiresAt :
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.
Parameter tags :
An optional list of key-value pairs to associate with the instrumentation
configuration. Tags can help you organize and categorize your resources.
Implementation
Future<CreateInstrumentationConfigurationResponse>
createInstrumentationConfiguration({
required CaptureConfiguration captureConfiguration,
required String environment,
required InstrumentationType instrumentationType,
required Location location,
required String service,
required DynamicInstrumentationSignalType signalType,
List<Map<String, String>>? attributeFilters,
String? description,
DateTime? expiresAt,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'CaptureConfiguration': captureConfiguration,
'Environment': environment,
'InstrumentationType': instrumentationType.value,
'Location': location,
'Service': service,
'SignalType': signalType.value,
if (attributeFilters != null) 'AttributeFilters': attributeFilters,
if (description != null) 'Description': description,
if (expiresAt != null) 'ExpiresAt': unixTimestampToJson(expiresAt),
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/create-instrumentation-configuration',
exceptionFnMap: _exceptionFns,
);
return CreateInstrumentationConfigurationResponse.fromJson(response);
}