-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add govet with atomicalign #2008
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
Conversation
😉 |
I'm not following this. The project added atomic alignment tests to avoid such panics at runtime. They were non-descriptive, not deterministically triggered, and caused a lot of issues. Currently we have curated alignment tests. If we want to switch to this analyzer it should support more than just simple cases and be a replacement for the existing solution. If it is not, I do not agree that the switch is worth making. |
Codecov Report
@@ Coverage Diff @@
## main #2008 +/- ##
=======================================
+ Coverage 72.8% 73.0% +0.2%
=======================================
Files 169 171 +2
Lines 8667 8687 +20
=======================================
+ Hits 6311 6348 +37
+ Misses 2084 2070 -14
+ Partials 272 269 -3
|
The panic at runtime can still happen. Here is an example: https://github.com/open-telemetry/opentelemetry-go/runs/2839025678. However, the panic is very descriptive. But still, I think that alignment tests are VERY valuable. As one may know that there could be a problem with an alignment test when looking at: https://github.com/open-telemetry/opentelemetry-go/runs/2839026086
I do not say that we should get rid of the alignment tests. I just think that we can use the static analyzer as an additional safety net. The
Moreover, I think that the analyzer's output is far superior. See an example here: https://github.com/open-telemetry/opentelemetry-go/runs/2851467579 - it detected a misalignment for
After a second look, I see that it can detect complex cases. But still, it does not detect every possible use case as it can be seen in the previously mentioned GH workflow run: https://github.com/open-telemetry/opentelemetry-go/runs/2839026086 |
|
Please let me know if you do think that introducing the If yes, then I can update the branch and get rid of intentional bugs. If not, then feel free to close the PR. |
|
Thanks for opening this, but I do not see the necessary motivation to include these changes at this time. There appears an added benefit to including the analyzer as it provides dynamic inventory of the code and then validation. However, given we have a working solution to this and the included changes are not being submitted with the intent that and documentation of how this is a drop in replacement of the existing solution I do not want to include these changes at this point. Please feel free to resubmit the changes if they can be verified to replace the existing solution and provide additional benefit to the project. Ideally, this would be documented and presented in a SIG meeting agenda item or an issue. |
Resolve open-telemetry#7030 This generation fixes the following: - The `semconv/weaver.yaml` file is moved to the `semconv/templates/registry/go` to [fix the generation](open-telemetry#7030 (comment)). - Deprecated enum `var`s are no longer generate. - The deprecation of the previous `OSTypeZOS` (`z_os`) conflicts with the replacement (`zos`). - This matches all other generations where deprecated types are not generated and the migration docs identify users need to upgrade when upgrading packages. - Fix metric description rendering to handle multi-line metric descriptions. - Fix filter of deprecated metrics in weaver configuration (see open-telemetry/weaver#847). The release notes for v1.35.0 are included as we do not plan to add a package for that release and it includes breaking changes being released here (i.e. `az.namespace` and `az.service_request_id`) ## [`v1.36.0` semantic convention release notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.36.0) <div data-pjax="true" data-test-selector="body-content" data-view-component="true" class="markdown-body my-3"><h3>🚩 Deprecations 🚩</h3> <ul> <li><code>os</code>: Adds the 'deprecated:' tag/attribute to the <code>z_os</code> enum value of <code>os.type</code>. This value was recently deprecated in v1.35.0. (<a href="open-telemetry/semantic-conventions#2479" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2479/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2479</a>)</li> </ul> <h3>💡 Enhancements 💡</h3> <ul> <li><code>otel</code>: Replaces <code>otel.sdk.span.ended</code> with <code>otel.sdk.span.started</code> and allow differentiation based on the parent span origin (<a href="open-telemetry/semantic-conventions#2431" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2431/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2431</a>)</li> <li><code>db</code>: Add database context propagation via <code>SET CONTEXT_INFO</code> for SQL Server (<a href="open-telemetry/semantic-conventions#2162" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2162/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2162</a>)</li> <li><code>entities</code>: Adds support for Entity registry and Entity stabilization policies. (<a href="open-telemetry/semantic-conventions#2246" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2246/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2246</a>)</li> </ul> <h3>🧰 Bug fixes 🧰</h3> <ul> <li><code>cloud</code>: Exclude deprecated Azure members from code generation on the <code>cloud.platform</code> attribute (<a href="open-telemetry/semantic-conventions#2477" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2477/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2477</a>, <a href="open-telemetry/semantic-conventions#2455" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2455/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2455</a>)</li> </ul> ## [`v1.35.0` semantic convention release notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.35.0) <div data-pjax="true" data-test-selector="body-content" data-view-component="true" class="markdown-body my-3"><h3>🛑 Breaking changes 🛑</h3> <ul> <li> <p><code>azure</code>: Align azure events, attributes, and enum members with general naming guidelines. (<a href="open-telemetry/semantic-conventions#608" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/608/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#608</a>, <a href="open-telemetry/semantic-conventions#1708" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1708/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1708</a>, <a href="open-telemetry/semantic-conventions#1698" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1698/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1698</a>)</p> <ul> <li>Renamed attributes: <ul> <li><code>az.service_request_id</code> to <code>azure.service.request.id</code></li> <li><code>az.namespace</code> to <code>azure.resource_provider.namespace</code></li> </ul> </li> <li>Renamed events: <ul> <li><code>az.resource.log</code> to <code>azure.resource.log</code></li> </ul> </li> <li>Renamed enum members: <ul> <li><code>az.ai.inference</code> to <code>azure.ai.inference</code> (on <code>gen_ai.system</code>)</li> <li><code>az.ai.openai</code> to <code>azure.ai.openai</code> (on <code>gen_ai.system</code>)</li> <li><code>azure_aks</code> to <code>azure.aks</code> (on <code>cloud.platform</code>)</li> <li><code>azure_app_service</code> to <code>azure.app_service</code> (on <code>cloud.platform</code>)</li> <li><code>azure_container_apps</code> to <code>azure.container_apps</code> (on <code>cloud.platform</code>)</li> <li><code>azure_container_instances</code> to <code>azure.container_instances</code> (on <code>cloud.platform</code>)</li> <li><code>azure_functions</code> to <code>azure.functions</code> (on <code>cloud.platform</code>)</li> <li><code>azure_openshift</code> to <code>azure.open_shift</code> (on <code>cloud.platform</code>)</li> <li><code>azure_vm</code> to <code>azure.vm</code> (on <code>cloud.platform</code>)</li> </ul> </li> </ul> </li> <li> <p><code>system</code>: Revert the change that moved <code>system.cpu.*</code> to <code>cpu.*</code>. The 3 affected metrics are back in <code>system.cpu.*</code>. (<a href="open-telemetry/semantic-conventions#1873" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1873/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1873</a>)</p> </li> <li> <p><code>system</code>: Changes system.network.connections to system.network.connection.count (<a href="open-telemetry/semantic-conventions#1800" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1800/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1800</a>)</p> </li> <li> <p><code>k8s</code>: Change instrument type for .limit/.request container metrics from gauge to updowncounter (<a href="open-telemetry/semantic-conventions#2354" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2354/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2354</a>)</p> </li> </ul> <h3>🚩 Deprecations 🚩</h3> <ul> <li><code>os</code>: Deprecate os.type='z_os' and replace with os.type='zos' (<a href="open-telemetry/semantic-conventions#1687" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1687/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1687</a>)</li> </ul> <h3>🚀 New components 🚀</h3> <ul> <li><code>mainframe, zos</code>: Add initial semantic conventions for mainframes (<a href="open-telemetry/semantic-conventions#1687" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1687/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1687</a>)</li> </ul> <h3>💡 Enhancements 💡</h3> <ul> <li> <p><code>dotnet</code>: Define .NET-specific network spans for DNS resolution, TLS handshake, and socket connections, along with HTTP-level spans to (optionally) record relationships between HTTP requests and connections.<br> (<a href="open-telemetry/semantic-conventions#1192" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1192/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1192</a>)</p> </li> <li> <p><code>k8s</code>: Add <code>k8s.node.allocatable.cpu</code>, <code>k8s.node.allocatable.ephemeral_storage</code>, <code>k8s.node.allocatable.memory</code>, <code>k8s.node.allocatable.pods</code> metrics (<a href="open-telemetry/semantic-conventions#2243" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2243/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2243</a>)</p> </li> <li> <p><code>k8s</code>: Add k8s.container.restart.count metric (<a href="open-telemetry/semantic-conventions#2191" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2191/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2191</a>)</p> </li> <li> <p><code>k8s</code>: Add K8s container resource related metrics (<a href="open-telemetry/semantic-conventions#2074" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2074/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2074</a>)</p> </li> <li> <p><code>k8s</code>: Add k8s.container.ready metric (<a href="open-telemetry/semantic-conventions#2074" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2074/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2074</a>)</p> </li> <li> <p><code>k8s</code>: Add k8s.node.condition metric (<a href="open-telemetry/semantic-conventions#2077" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2077/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2077</a>)</p> </li> <li> <p><code>k8s</code>: Add k8s resource quota metrics (<a href="open-telemetry/semantic-conventions#2076" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2076/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2076</a>)</p> </li> <li> <p><code>events</code>: Update general event guidance to allow complex attributes on events and use them instead of the body fields.<br> (<a href="open-telemetry/semantic-conventions#1651" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1651/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1651</a>, <a href="open-telemetry/semantic-conventions#1669" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1669/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1669</a>)</p> </li> <li> <p><code>k8s</code>: Add k8s.container.status.state and k8s.container.status.reason metrics (<a href="open-telemetry/semantic-conventions#1672" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1672/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#1672</a>)</p> </li> <li> <p><code>feature_flags</code>: Mark feature flag semantic convention as release candidate. (<a href="open-telemetry/semantic-conventions#2277" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2277/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2277</a>)</p> </li> <li> <p><code>k8s</code>: Add new resource attributes for <code>k8s.hpa</code> to capture the <code>scaleTargetRef</code> fields (<a href="open-telemetry/semantic-conventions#2008" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2008/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2008</a>)<br> Adds below attributes to the <code>k8s.hpa</code> resource:</p> <ul> <li><code>k8s.hpa.scaletargetref.kind</code></li> <li><code>k8s.hpa.scaletargetref.name</code></li> <li><code>k8s.hpa.scaletargetref.api_version</code></li> </ul> </li> <li> <p><code>k8s</code>: Adds metrics and attributes to track k8s HPA's metric target values for CPU resources. (<a href="open-telemetry/semantic-conventions#2182" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2182/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2182</a>)<br> Below metrics are introduced to provide insight into HPA scaling configuration for CPU.</p> <ul> <li><code>k8s.hpa.metric.target.cpu.value</code></li> <li><code>k8s.hpa.metric.target.cpu.average_value</code></li> <li><code>k8s.hpa.metric.target.cpu.average_utilization</code></li> </ul> </li> <li> <p><code>k8s</code>: Explains the rationale behind the Kubernetes resource naming convention. (<a href="open-telemetry/semantic-conventions#2245" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2245/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2245</a>)</p> </li> <li> <p><code>all</code>: Adds modelling guide for resource and entity. (<a href="open-telemetry/semantic-conventions#2246" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2246/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2246</a>)</p> </li> <li> <p><code>service</code>: Adds stability policies for Entity groups. (<a href="open-telemetry/semantic-conventions#2378" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2378/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2378</a>)<br> Entity groups now require <code>role</code> to be filled for attributes.</p> </li> <li> <p><code>otel</code>: Specifies component.type values for Zipkin and Prometheus exporters (<a href="open-telemetry/semantic-conventions#2229" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2229/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2229</a>)</p> </li> </ul> <h3>🧰 Bug fixes 🧰</h3> <ul> <li><code>otel</code>: Removes <code>otel.scope</code> entity. (<a href="open-telemetry/semantic-conventions#2310" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2310/hovercard" aria-keyshortcuts="Alt+ArrowUp">open-telemetry#2310</a>)</li> </ul>
What
atomicalignanalyzer as an additional safety net against https://golang.org/pkg/sync/atomic/#pkg-note-BUGlintworkflow additionally withGOARCH=386Remarks
atomicalignanalyzer works only on 32bit arch: https://cs.opensource.google/go/x/tools/+/refs/tags/v0.1.3:go/analysis/passes/atomicalign/atomicalign.go;l=33-35. Here I checked that it works on x86: https://github.com/open-telemetry/opentelemetry-go/pull/2008/checks?check_run_id=2838943826atomicalignonly finds simple cases. We should not rely on itatomicusage should be detected byci / compatibility-testjobs (runtime panics)