Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jetbrains: Generate OpenTelemetry-style metric builders #899

Merged
merged 6 commits into from
Nov 5, 2024

Conversation

rli
Copy link
Contributor

@rli rli commented Oct 30, 2024

Problem

At the moment, metrics in the JetBrains extensions are collected as singular datapoints independent of each other. Modern observability frameworks, as well as our long-term goals are to be able to correlate these data flows over a single user flow. This requires the 'trace ID' concept which is high-friction in the current model.

Solution

Generate 'fluent builders' that wrap the OpenTelemetry SDK to allow us to leverage the SDK to record trace/span IDs automatically, but still expose a good amount of type safety based on the metric schema. This PR references base classes proposed in aws/aws-toolkit-jetbrains#4982.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rli rli marked this pull request as ready for review October 31, 2024 18:43
@rli rli requested a review from a team as a code owner October 31, 2024 18:43
rli added a commit to aws/aws-toolkit-jetbrains that referenced this pull request Nov 5, 2024
The OpenTelemetry SDK can automatically attach the same trace ID to spans recorded under the same 'context'. This is somewhat challenging because the JetBrains platform frequently requires switching threads and coroutine scope contexts, which loses the `ThreadLocal` state needed to connect parent->child when spans are started.

This on its own is not too difficult, but becomes a significant ergonomic challenge when we also want to bring some type-safety to how span metadata is built. This PR allows spans generated in aws/aws-toolkit-common#899 to automatically perform context propagation.

See internal documentation for details. A contributor-friendly version of the doc will be written after we validate this pattern with some initial metrics.
@rli rli merged commit ca24bab into main Nov 5, 2024
8 checks passed
@rli rli deleted the rli/otel-generator branch November 5, 2024 00:59
rli added a commit to aws/aws-toolkit-jetbrains that referenced this pull request Nov 6, 2024
…5027)

* Depends on #4982
* Depends on aws/aws-toolkit-common#899
* Rename Unit -> MetricUnit directly in SDK codegen
* Use newer provider convention syntax for input/output in generator task
* expose `passive`/`unit`/`value` as special fields
* add smoke test for `validateRequiredAttributes`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants