-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add retry mode business metric tracking
- Loading branch information
Showing
5 changed files
with
184 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...codegen/client/smithy/customizations/RetryModeFeatureTrackerRuntimePluginCustomization.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.client.smithy.customizations | ||
|
||
import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext | ||
import software.amazon.smithy.rust.codegen.client.smithy.generators.ServiceRuntimePluginCustomization | ||
import software.amazon.smithy.rust.codegen.client.smithy.generators.ServiceRuntimePluginSection | ||
import software.amazon.smithy.rust.codegen.core.rustlang.InlineDependency | ||
import software.amazon.smithy.rust.codegen.core.rustlang.Writable | ||
import software.amazon.smithy.rust.codegen.core.rustlang.rust | ||
import software.amazon.smithy.rust.codegen.core.rustlang.writable | ||
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType | ||
|
||
class RetryModeFeatureTrackerRuntimePluginCustomization(codegenContext: ClientCodegenContext) : | ||
ServiceRuntimePluginCustomization() { | ||
private val runtimeConfig = codegenContext.runtimeConfig | ||
|
||
override fun section(section: ServiceRuntimePluginSection): Writable = | ||
writable { | ||
when (section) { | ||
is ServiceRuntimePluginSection.RegisterRuntimeComponents -> { | ||
section.registerInterceptor(this) { | ||
rust( | ||
"#T::new()", | ||
RuntimeType.forInlineDependency( | ||
InlineDependency.sdkFeatureTracker(runtimeConfig), | ||
).resolve("retry_mode::RetryModeFeatureTrackerInterceptor"), | ||
) | ||
} | ||
} | ||
|
||
else -> emptySection | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.