mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-18 03:22:12 +02:00
db74d18729
Based on #5394 This removes `event.go`, `resource.go`, and `trace.go` from generation because they now only contain references to the attribute registry. Thus, they will generate empty files. This also does not include any deprecated semantic convention. Users of deprecated semantic conventions should continue to use them from the previous versions that have been published. [v1.26.0 semantic conventions release notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.26.0): <div data-pjax="true" data-test-selector="body-content" data-view-component="true" class="markdown-body my-3"><h2>v1.26.0</h2> <h3>🛑 Breaking changes 🛑</h3> <ul> <li> <p><code>db</code>: Rename <code>db.statement</code> to <code>db.query.text</code> and introduce <code>db.query.parameter.<key></code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2123681817" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/716" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/716/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/716">#716</a>)</p> </li> <li> <p><code>db</code>: Renames <code>db.sql.table</code>, <code>db.cassandra.table</code>, <code>db.mongodb.collection</code>, and <code>db.cosmosdb.container</code> attributes to <code>db.collection.name</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2221821104" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/870" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/870/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/870">#870</a>)</p> </li> <li> <p><code>db</code>: Rename <code>db.operation</code> to <code>db.operation.name</code>. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2226761377" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/884" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/884/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/884">#884</a>)</p> </li> <li> <p><code>messaging</code>: Rename <code>messaging.operation</code> to <code>messaging.operation.type</code>, add <code>messaging.operation.name</code>. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2227637055" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/890" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/890/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/890">#890</a>)</p> </li> <li> <p><code>db</code>: Deprecate the <code>db.user</code> attribute. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2226817211" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/885" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/885/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/885">#885</a>)</p> </li> <li> <p><code>db</code>: Rename <code>db.name</code> and <code>db.redis.database_index</code> to <code>db.namespace</code>, deprecate <code>db.mssql.instance_name</code>. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2226817211" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/885" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/885/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/885">#885</a>)</p> </li> <li> <p><code>db</code>: Remove <code>db.instance.id</code>. For Elasticsearch, replace with <code>db.elasticsearch.node.name</code>. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266411070" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/972" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/972/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/972">#972</a>)</p> </li> <li> <p><code>db</code>: Clarify database span name format and fallback values. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266545339" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/974" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/974/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/974">#974</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2123611008" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/704" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/704/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/704">#704</a>)</p> </li> <li> <p><code>db</code>: Rename <code>db.client.connections.*</code> metric namespace to <code>db.client.connection.*</code> and rename <code>db.client.connection.usage</code> to <code>db.client.connection.count</code>.<br> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1815993771" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/201" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/201/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/201">#201</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2262290114" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/967" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/967/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/967">#967</a>)</p> </li> <li> <p><code>db</code>: Rename <code>pool.name</code> to <code>db.client.connections.pool.name</code> and <code>state</code> to <code>db.client.connections.state</code>. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2232095641" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/909" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/909/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/909">#909</a>)</p> </li> <li> <p><code>system</code>: Deprecate <code>shared</code> from <code>system.memory.state</code> values and make it a standalone metric (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1993746916" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/522" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/522/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/522">#522</a>)</p> </li> <li> <p><code>device.app.lifecycle</code>: Reformat and update the <code>device.app.lifecycle</code> event description adds constraints for the possible values of the <code>android.state</code> and <code>ios.state</code>.<br> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2170421333" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/794" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/794/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/794">#794</a>)<br> Removes the <code>ios.lifecycle.events</code> and <code>android.lifecycle.events</code> attributes from the global registry and adds constraints for the possible values of the <code>android.state</code> and <code>ios.state</code> attributes.</p> </li> <li> <p><code>messaging</code>: Rename <code>messaging.client_id</code> to <code>messaging.client.id</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2250463504" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/935" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/935/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/935">#935</a>)</p> </li> <li> <p><code>rpc</code>: Rename<code>message.*</code> attributes under <code>rpc</code> to <code>rpc.message.*</code>. Deprecate old <code>message.*</code> attributes. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2211426432" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/854" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/854/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/854">#854</a>)</p> </li> </ul> <h3>🚀 New components 🚀</h3> <ul> <li><code>gen-ai</code>: Introducing semantic conventions for GenAI clients. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1897516973" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/327" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/327/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/327">#327</a>)</li> </ul> <h3>💡 Enhancements 💡</h3> <ul> <li> <p><code>all</code>: Markdown snippets are now generated by jinja templates in the <code>templates</code> directory. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2276527861" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/1000" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1000/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/1000">#1000</a>)</p> </li> <li> <p><code>db, messaging, gen_ai</code>: Clarify that <code>db.system</code>, <code>messaging.system</code>, <code>gen_ai.system</code> attributes capture the client perception and may differ from the actual product name. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2184898831" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/813" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/813/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/813">#813</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2286519206" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/1016" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1016/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/1016">#1016</a>)</p> </li> <li> <p><code>messaging</code>: Show all applicable attributes in individual messaging semantic conventions. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2221751255" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/869" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/869/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/869">#869</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2286733771" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/1018" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1018/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/1018">#1018</a>)</p> </li> <li> <p><code>process</code>: Add additional attributes to process attribute registry (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2015129430" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/564" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/564/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/564">#564</a>)</p> </li> <li> <p><code>messaging</code>: Add a GCP Pub/Sub unary pull example and the new GCP messaging attributes: - <code>messaging.gcp_pubsub.message.ack_deadline</code>, - <code>messaging.gcp_pubsub.message.ack_id</code>, - <code>messaging.gcp_pubsub.message.delivery_attempt</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1995123229" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/527" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/527/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/527">#527</a>)</p> </li> <li> <p><code>db</code>: Add <code>db.client.operation.duration</code> metric (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1991797441" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/512" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/512/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/512">#512</a>)</p> </li> <li> <p><code>messaging</code>: Adds `messaging.destination.partition.id`` to the messaging attributes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2185047744" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/814" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/814/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/814">#814</a>)</p> </li> <li> <p><code>exception</code>: Replace constraints with requirement levels on exceptions. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2216070269" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/862" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/862/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/862">#862</a>)</p> </li> <li> <p><code>process</code>: Replace constraints with requirement_level in process attributes. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2216082891" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/863" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/863/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/863">#863</a>)</p> </li> <li> <p><code>db</code>: Reorganize DB conventions to be shared across span and metric conventions. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2232098784" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/910" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/910/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/910">#910</a>)</p> </li> <li> <p><code>all</code>: Migrate Attribute Registry to be completely autogenerated. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1811747563" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/197" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/197/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/197">#197</a>)<br> Migrate to using weaver for markdown generation (snippet + registry).<br> The entirety of the registry now is generated using weaver with templates<br> under the <code>templates/</code> directory. Snippets still require a hardcoded<br> command.</p> </li> <li> <p><code>http</code>: List all HTTP client and server attributes in the corresponding table, remove common attributes from yaml and markdown. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2249267191" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/928" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/928/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/928">#928</a>)</p> </li> <li> <p><code>other</code>: Document patterns and suggestions for semconv code generation. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2005434950" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/551" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/551/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/551">#551</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2260022392" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/953" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/953/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/953">#953</a>)</p> </li> <li> <p><code>db</code>: Show applicable common attributes in individual database semantic conventions. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266443235" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/973" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/973/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/973">#973</a>)</p> </li> <li> <p><code>db</code>: Add <code>error.type</code> attribute to the database span and operation duration metric. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266561839" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/975" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/975/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/975">#975</a>)</p> </li> <li> <p><code>db</code>: Parameterized query text does not need to be sanitized by default (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266574593" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/976" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/976/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/976">#976</a>)</p> </li> <li> <p><code>http</code>: List experimental HTTP attributes applicable to HTTP client and server spans. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2272874112" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/989" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/989/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/989">#989</a>)</p> </li> <li> <p><code>db</code>: Finalizes the migration requirement for instrumentations to follow when updating to stable database semconv. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2124200768" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/719" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/719/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/719">#719</a>)</p> </li> <li> <p><code>http</code>: New <code>url.template</code> attribute added to URL, HTTP client attributes are extended with optional low-cardinality <code>url.template</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2107516610" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/675" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/675/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/675">#675</a>)</p> </li> <li> <p><code>db</code>: Add note to <code>db.collection.name</code>, <code>db.namespace</code>, and <code>db.operation.name</code> about capturing those without attempting to do any case normalization.<br> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2226822323" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/886" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/886/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/886">#886</a>)</p> </li> <li> <p><code>events</code>: Provides additional definitions of log events and their structure. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2139735298" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/755" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/755/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/755">#755</a>)</p> </li> <li> <p><code>k8s</code>: add container.status.last_terminated_reason resource attribute (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2243002863" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/922" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/922/hovercard" href="https://github.com/open-telemetry/semantic-conventions/issues/922">#922</a>)</p> </li> </ul> <h3>🧰 Bug fixes 🧰</h3> <ul> <li><code>http</code>: Add previously deprecated http attributes to registry (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2288411532" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/1025" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1025/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/1025">#1025</a>)<br> These attributes were deprecated in 1.13</li> <li><code>net</code>: Add previously deprecated net attributes to registry (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2289802107" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/semantic-conventions/issues/1029" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1029/hovercard" href="https://github.com/open-telemetry/semantic-conventions/pull/1029">#1029</a>)<br> These attributes were deprecated in 1.13</li> </ul></div> ### Follow up work - [ ] Update all dependencies on semconv to v1.26.0 --------- Co-authored-by: Tyler Yahn <codingalias@gmail.com> Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
298 lines
9.4 KiB
Makefile
298 lines
9.4 KiB
Makefile
# Copyright The OpenTelemetry Authors
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
TOOLS_MOD_DIR := ./internal/tools
|
|
|
|
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
|
|
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
|
|
OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS))
|
|
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort)
|
|
|
|
GO = go
|
|
TIMEOUT = 60
|
|
|
|
.DEFAULT_GOAL := precommit
|
|
|
|
.PHONY: precommit ci
|
|
precommit: generate license-check misspell go-mod-tidy golangci-lint-fix verify-readmes test-default
|
|
ci: generate license-check lint vanity-import-check verify-readmes build test-default check-clean-work-tree test-coverage
|
|
|
|
# Tools
|
|
|
|
TOOLS = $(CURDIR)/.tools
|
|
|
|
$(TOOLS):
|
|
@mkdir -p $@
|
|
$(TOOLS)/%: $(TOOLS_MOD_DIR)/go.mod | $(TOOLS)
|
|
cd $(TOOLS_MOD_DIR) && \
|
|
$(GO) build -o $@ $(PACKAGE)
|
|
|
|
MULTIMOD = $(TOOLS)/multimod
|
|
$(TOOLS)/multimod: PACKAGE=go.opentelemetry.io/build-tools/multimod
|
|
|
|
SEMCONVGEN = $(TOOLS)/semconvgen
|
|
$(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen
|
|
|
|
CROSSLINK = $(TOOLS)/crosslink
|
|
$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink
|
|
|
|
SEMCONVKIT = $(TOOLS)/semconvkit
|
|
$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit
|
|
|
|
GOLANGCI_LINT = $(TOOLS)/golangci-lint
|
|
$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
MISSPELL = $(TOOLS)/misspell
|
|
$(TOOLS)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell
|
|
|
|
GOCOVMERGE = $(TOOLS)/gocovmerge
|
|
$(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge
|
|
|
|
STRINGER = $(TOOLS)/stringer
|
|
$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer
|
|
|
|
PORTO = $(TOOLS)/porto
|
|
$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto
|
|
|
|
GOJQ = $(TOOLS)/gojq
|
|
$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
|
|
|
GOTMPL = $(TOOLS)/gotmpl
|
|
$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl
|
|
|
|
GORELEASE = $(TOOLS)/gorelease
|
|
$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease
|
|
|
|
GOVULNCHECK = $(TOOLS)/govulncheck
|
|
$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck
|
|
|
|
.PHONY: tools
|
|
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE)
|
|
|
|
# Virtualized python tools via docker
|
|
|
|
# The directory where the virtual environment is created.
|
|
VENVDIR := venv
|
|
|
|
# The directory where the python tools are installed.
|
|
PYTOOLS := $(VENVDIR)/bin
|
|
|
|
# The pip executable in the virtual environment.
|
|
PIP := $(PYTOOLS)/pip
|
|
|
|
# The directory in the docker image where the current directory is mounted.
|
|
WORKDIR := /workdir
|
|
|
|
# The python image to use for the virtual environment.
|
|
PYTHONIMAGE := python:3.11.3-slim-bullseye
|
|
|
|
# Run the python image with the current directory mounted.
|
|
DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE)
|
|
|
|
# Create a virtual environment for Python tools.
|
|
$(PYTOOLS):
|
|
# The `--upgrade` flag is needed to ensure that the virtual environment is
|
|
# created with the latest pip version.
|
|
@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip"
|
|
|
|
# Install python packages into the virtual environment.
|
|
$(PYTOOLS)/%: $(PYTOOLS)
|
|
@$(DOCKERPY) $(PIP) install -r requirements.txt
|
|
|
|
CODESPELL = $(PYTOOLS)/codespell
|
|
$(CODESPELL): PACKAGE=codespell
|
|
|
|
# Generate
|
|
|
|
.PHONY: generate
|
|
generate: go-generate vanity-import-fix
|
|
|
|
.PHONY: go-generate
|
|
go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%)
|
|
go-generate/%: DIR=$*
|
|
go-generate/%: $(STRINGER) $(GOTMPL)
|
|
@echo "$(GO) generate $(DIR)/..." \
|
|
&& cd $(DIR) \
|
|
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./...
|
|
|
|
.PHONY: vanity-import-fix
|
|
vanity-import-fix: $(PORTO)
|
|
@$(PORTO) --include-internal -w .
|
|
|
|
# Generate go.work file for local development.
|
|
.PHONY: go-work
|
|
go-work: $(CROSSLINK)
|
|
$(CROSSLINK) work --root=$(shell pwd)
|
|
|
|
# Build
|
|
|
|
.PHONY: build
|
|
|
|
build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%)
|
|
build/%: DIR=$*
|
|
build/%:
|
|
@echo "$(GO) build $(DIR)/..." \
|
|
&& cd $(DIR) \
|
|
&& $(GO) build ./...
|
|
|
|
build-tests/%: DIR=$*
|
|
build-tests/%:
|
|
@echo "$(GO) build tests $(DIR)/..." \
|
|
&& cd $(DIR) \
|
|
&& $(GO) list ./... \
|
|
| grep -v third_party \
|
|
| xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null
|
|
|
|
# Tests
|
|
|
|
TEST_TARGETS := test-default test-bench test-short test-verbose test-race
|
|
.PHONY: $(TEST_TARGETS) test
|
|
test-default test-race: ARGS=-race
|
|
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=.
|
|
test-short: ARGS=-short
|
|
test-verbose: ARGS=-v -race
|
|
$(TEST_TARGETS): test
|
|
test: $(OTEL_GO_MOD_DIRS:%=test/%)
|
|
test/%: DIR=$*
|
|
test/%:
|
|
@echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $(DIR)/..." \
|
|
&& cd $(DIR) \
|
|
&& $(GO) list ./... \
|
|
| grep -v third_party \
|
|
| xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS)
|
|
|
|
COVERAGE_MODE = atomic
|
|
COVERAGE_PROFILE = coverage.out
|
|
.PHONY: test-coverage
|
|
test-coverage: $(GOCOVMERGE)
|
|
@set -e; \
|
|
printf "" > coverage.txt; \
|
|
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
|
echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \
|
|
(cd "$${dir}" && \
|
|
$(GO) list ./... \
|
|
| grep -v third_party \
|
|
| grep -v 'semconv/v.*' \
|
|
| xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \
|
|
$(GO) tool cover -html=coverage.out -o coverage.html); \
|
|
done; \
|
|
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
|
|
|
|
# Adding a directory will include all benchmarks in that directory if a filter is not specified.
|
|
BENCHMARK_TARGETS := sdk/trace
|
|
.PHONY: benchmark
|
|
benchmark: $(BENCHMARK_TARGETS:%=benchmark/%)
|
|
BENCHMARK_FILTER = .
|
|
# You can override the filter for a particular directory by adding a rule here.
|
|
benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample
|
|
benchmark/%:
|
|
@echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \
|
|
&& cd $* \
|
|
$(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter))
|
|
|
|
.PHONY: golangci-lint golangci-lint-fix
|
|
golangci-lint-fix: ARGS=--fix
|
|
golangci-lint-fix: golangci-lint
|
|
golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%)
|
|
golangci-lint/%: DIR=$*
|
|
golangci-lint/%: $(GOLANGCI_LINT)
|
|
@echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \
|
|
&& cd $(DIR) \
|
|
&& $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS)
|
|
|
|
.PHONY: crosslink
|
|
crosslink: $(CROSSLINK)
|
|
@echo "Updating intra-repository dependencies in all go modules" \
|
|
&& $(CROSSLINK) --root=$(shell pwd) --prune
|
|
|
|
.PHONY: go-mod-tidy
|
|
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
|
|
go-mod-tidy/%: DIR=$*
|
|
go-mod-tidy/%: crosslink
|
|
@echo "$(GO) mod tidy in $(DIR)" \
|
|
&& cd $(DIR) \
|
|
&& $(GO) mod tidy -compat=1.21
|
|
|
|
.PHONY: lint-modules
|
|
lint-modules: go-mod-tidy
|
|
|
|
.PHONY: lint
|
|
lint: misspell lint-modules golangci-lint govulncheck
|
|
|
|
.PHONY: vanity-import-check
|
|
vanity-import-check: $(PORTO)
|
|
@$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 )
|
|
|
|
.PHONY: misspell
|
|
misspell: $(MISSPELL)
|
|
@$(MISSPELL) -w $(ALL_DOCS)
|
|
|
|
.PHONY: govulncheck
|
|
govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%)
|
|
govulncheck/%: DIR=$*
|
|
govulncheck/%: $(GOVULNCHECK)
|
|
@echo "govulncheck ./... in $(DIR)" \
|
|
&& cd $(DIR) \
|
|
&& $(GOVULNCHECK) ./...
|
|
|
|
.PHONY: codespell
|
|
codespell: $(CODESPELL)
|
|
@$(DOCKERPY) $(CODESPELL)
|
|
|
|
.PHONY: license-check
|
|
license-check:
|
|
@licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \
|
|
awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \
|
|
done); \
|
|
if [ -n "$${licRes}" ]; then \
|
|
echo "license header checking failed:"; echo "$${licRes}"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: check-clean-work-tree
|
|
check-clean-work-tree:
|
|
@if ! git diff --quiet; then \
|
|
echo; \
|
|
echo 'Working tree is not clean, did you forget to run "make precommit"?'; \
|
|
echo; \
|
|
git status; \
|
|
exit 1; \
|
|
fi
|
|
|
|
SEMCONVPKG ?= "semconv/"
|
|
.PHONY: semconv-generate
|
|
semconv-generate: $(SEMCONVGEN) $(SEMCONVKIT)
|
|
[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 )
|
|
[ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 )
|
|
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
|
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=metric -f metric.go -t "$(SEMCONVPKG)/metric_template.j2" -s "$(TAG)"
|
|
$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)"
|
|
|
|
.PHONY: gorelease
|
|
gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%)
|
|
gorelease/%: DIR=$*
|
|
gorelease/%:| $(GORELEASE)
|
|
@echo "gorelease in $(DIR):" \
|
|
&& cd $(DIR) \
|
|
&& $(GORELEASE) \
|
|
|| echo ""
|
|
|
|
.PHONY: prerelease
|
|
prerelease: $(MULTIMOD)
|
|
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
|
$(MULTIMOD) verify && $(MULTIMOD) prerelease -m ${MODSET}
|
|
|
|
COMMIT ?= "HEAD"
|
|
.PHONY: add-tags
|
|
add-tags: $(MULTIMOD)
|
|
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
|
$(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT}
|
|
|
|
.PHONY: lint-markdown
|
|
lint-markdown:
|
|
docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md
|
|
|
|
.PHONY: verify-readmes
|
|
verify-readmes:
|
|
./verify_readmes.sh
|