| 1 |
# Experimental support for profiling |
| 2 |
|
| 3 |
## Overview |
| 4 |
|
| 5 |
The OpenTelemetry collector has traces, metrics and logs as stable signals. We |
| 6 |
want to start experimenting with support for profiles as an experimental |
| 7 |
signal. But we also don't want to introduce breaking changes in packages |
| 8 |
otherwise considered stable. |
| 9 |
|
| 10 |
This document describes: |
| 11 |
|
| 12 |
* The approach we intend to take to introduce profiling with no breaking changes |
| 13 |
* How the migration will happen once profiling goes stable |
| 14 |
|
| 15 |
### Discarded approaches |
| 16 |
|
| 17 |
#### Refactor everything into per-signal subpackages |
| 18 |
|
| 19 |
A first approach, discussed in [issue |
| 20 |
10207](https://github.com/open-telemetry/opentelemetry-collector/issues/10207) |
| 21 |
has been discarded. |
| 22 |
It aimed to refactor the current packages with per-signal subpackages, so each |
| 23 |
subpackage could have its own stability level, like pdata does. |
| 24 |
|
| 25 |
This has been discarded, as the Collector SIG does not want the profiling |
| 26 |
signal to impact the road to the collector reaching 1.0. |
| 27 |
|
| 28 |
#### Use build tags |
| 29 |
|
| 30 |
An approach would have been to use build tags to limit the availability of |
| 31 |
profiles within packages. |
| 32 |
|
| 33 |
This approach would make the UX very bad though, as most packages are meant to |
| 34 |
be imported and not used in a compiled collector. It would therefore not have |
| 35 |
been possible to specify the appropriate build tags. |
| 36 |
|
| 37 |
This has been discarded, as the usage would have been too difficult. |
| 38 |
|
| 39 |
## Proposed approach |
| 40 |
|
| 41 |
The proposed approach will consist of two main phases: |
| 42 |
|
| 43 |
* Introduce `experimental` packages for each required module of the collector that needs to be profiles-aware. |
| 44 |
* `consumer`, `receiver`, `connector`, `component`, `processor` |
| 45 |
* Mark specific APIs as `experimental` in their godoc for parts that can't be a new package. |
| 46 |
* `service` |
| 47 |
|
| 48 |
### Introduce "experimental" subpackages |
| 49 |
|
| 50 |
Each package that needs to be profiling signal-aware will have its public |
| 51 |
methods and interfaces moves into an internal subpackage. |
| 52 |
|
| 53 |
Then, the original package will get similar API methods and interfaces as the |
| 54 |
ones currently available on the main branch. |
| 55 |
|
| 56 |
The profiling methods and interfaces will be made available in a `profiles` |
| 57 |
subpackage. |
| 58 |
|
| 59 |
See [PR |
| 60 |
#10253](https://github.com/open-telemetry/opentelemetry-collector/pull/10253) |
| 61 |
for an example. |
| 62 |
|
| 63 |
### Mark specific APIs as `experimental` |
| 64 |
|
| 65 |
In order to boot a functional collector with profiles support, some stable |
| 66 |
packages need to be aware of the experimental ones. |
| 67 |
|
| 68 |
To support that case, we will mark new APIs as `experimental` with go docs. |
| 69 |
Every experimental API will be documented as such: |
| 70 |
|
| 71 |
```golang |
| 72 |
// # Experimental |
| 73 |
// |
| 74 |
// Notice: This method is EXPERIMENTAL and may be changed or removed in a |
| 75 |
// later release. |
| 76 |
``` |
| 77 |
|
| 78 |
As documented, APIs marked as experimental may changed or removed across |
| 79 |
releases, without it being considered as a breaking change. |
| 80 |
|
| 81 |
There are no symbols that would need to be marked as experimental today. If |
| 82 |
there ever are then implementers may add an experimental comment to them |
| 83 |
|
| 84 |
#### User specified configuration |
| 85 |
|
| 86 |
The user-specified configuration will let users specify a `profiles` pipeline: |
| 87 |
|
| 88 |
``` |
| 89 |
service: |
| 90 |
pipelines: |
| 91 |
profiles: |
| 92 |
receivers: [otlp] |
| 93 |
exporters: [otlp] |
| 94 |
``` |
| 95 |
|
| 96 |
When an experimental signal is being used, the collector will log a warning at |
| 97 |
boot. |
| 98 |
|
| 99 |
## Signal status change |
| 100 |
|
| 101 |
If the profiling signal becomes stable, all the experimental packages will be |
| 102 |
merged back into their stable counterpart, and the `service` module's imports |
| 103 |
will be updated. |
| 104 |
|
| 105 |
If the profiling signal is removed, all the experimental packages will be |
| 106 |
removed from the repository, and support for them will be removed in the |
| 107 |
`service` module. |