1 # Telemetry API Deprecation Procedure 2 3 ## Procedure for hard deprecation: 4 1. Determine a deprecation time-frame. 5 2. Create documentation on suggested refactor/workarounds if applicable. 6 3. Apply applicable warnings for users about the deprecation. 7 4. Announce deprecation. 8 5. (Optional) Audit important users for usage of deprecated code prior to deletion. 9 6. Delete the offending code. 10 11 ## Determine deprecation time-frame. 12 13 The default time-frame is 18 weeks. If the expected user refractors are expected to take more than a third of that time to complete, this timeframe may be extended on a case-by-case basis as appropriate prior to announcement. 14 15 ## Create documentation on suggested refactor/workarounds if applicable. 16 17 If a large refactor is expected for the users to stop using the deprecated code, documentation with suggested alternatives should be created. This may include examples (placed in the examples folder in the appropriate location), a wiki page documenting the change and/or our suggested workarounds/refactors, and/or a link to any replacement features. 18 19 ## Apply applicable warnings for users about the deprecation. 20 21 This should include any applicable documentation (or links there to), deprecation deadline (as determined in step 1). 22 23 ### For Python code: 24 25 1. All functions and classes to be deprecated should use a deprecation decorator. 26 You must pass in the deprecation deadline as determined by step 1 (counted from time of the CL containing these changes) into the decorator. The decorator will contain a warning message using the DeprecationWarning category and outlining the following: 27 * A warning of the function being deprecated. 28 * The deadline to refactor their code before the function is deleted. 29 * An (externally available) email they can use to contact us requesting an extension to the proposed deletion date. 30 * A warning that the deadline will only rarely be extended, and only for cases with obvious need and significant forewarning. 31 32 2. All functions should log links to any applicable documentation for refactoring, or references to replacement API. 33 34 ## Announce deprecation 35 An email should be sent out to telemetry-announce (a] chromium.org announcing the API being deprecated, the reason(s) for the deprecation, the deprecation deadline, and include any (links to) documentation. 36 Extension of deprecation deadline 37 This should happen extremely rarely, if ever. If a user brings up extenuating circumstances, contributors may be asked to give input, and are welcome to make suggestions, on whether we should give an extension to the deadline. The final decision is at the discretion of the PM and TL/TLM for the team owning the portion of the codebase in question, and should take any blocked future work for the product, and timeliness of the request into account. 38 39 ## (Optional) Audit important users for usage of deprecated code prior to deletion. 40 41 In some circumstances, it may be worthwhile to check chromium (or other important users) for usage of deprecated APIs prior to deletion. It may be done on a case by case basis as needed for deprecation of important features. 42 43 ## Delete the offending code. 44 1. Commit CL deleting code. 45 2. ??? 46 3. Profit. 47