Adds metric value to the current context object's ``features`` set. :type feature_id: str :param feature_id: The name of the feature to register. Value must be a key in the ``_USERAGENT_FEATURE_MAPPINGS`` dict.
(feature_id)
| 108 | |
| 109 | |
| 110 | def register_feature_id(feature_id): |
| 111 | """Adds metric value to the current context object's ``features`` set. |
| 112 | |
| 113 | :type feature_id: str |
| 114 | :param feature_id: The name of the feature to register. Value must be a key |
| 115 | in the ``_USERAGENT_FEATURE_MAPPINGS`` dict. |
| 116 | """ |
| 117 | ctx = get_context() |
| 118 | if ctx is None: |
| 119 | # Never register features outside the scope of a |
| 120 | # ``botocore.context.start_as_current_context`` context manager. |
| 121 | # Otherwise, the context variable won't be reset and features will |
| 122 | # bleed into all subsequent requests. Return instead of raising an |
| 123 | # exception since this function could be invoked in a public interface. |
| 124 | return |
| 125 | if val := _USERAGENT_FEATURE_MAPPINGS.get(feature_id): |
| 126 | ctx.features.add(val) |
| 127 | |
| 128 | |
| 129 | def register_feature_ids(feature_ids): |