forked from open-telemetry/opentelemetry-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically generate semantic conventions from the spec (open-telem…
…etry#873) Added documentation.
- Loading branch information
Showing
6 changed files
with
218 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Semantic Conventions | ||
|
||
## Tooling | ||
|
||
The following files | ||
|
||
* [trace/semantic_conventions.h](/api/include/opentelemetry/trace/semantic_conventions.h) | ||
* [sdk/resource/semantic_conventions.h](/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h) | ||
|
||
are generated automatically. | ||
|
||
The source data is in YAML format, located in the | ||
[specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/semantic_conventions/README.md). | ||
|
||
A code [generator](https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/README.md) | ||
parses the YAML data from the specs, | ||
and generate code for various languages using a template engine. | ||
|
||
For opentelemetry-cpp, the templates are located in | ||
[buildscripts](/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2). | ||
|
||
A [generate.sh](/buildscripts/semantic-convention/generate.sh) script | ||
downloads the specs, invokes the generator using Docker, | ||
and generates code for opentelemetry-cpp. | ||
|
||
## Instructions | ||
|
||
### Find latest specifications | ||
|
||
Check for the latest | ||
[specification](https://github.com/open-telemetry/opentelemetry-specification/releases) | ||
release, and note the release tag number. | ||
|
||
For example, tag v1.12.0 | ||
|
||
### Use latest specifications | ||
|
||
Set the `SEMCONV_VERSION` number in the [generate.sh](/buildscripts/semantic-convention/generate.sh) script. | ||
|
||
For example, | ||
|
||
``` | ||
SEMCONV_VERSION=1.12.0 | ||
``` | ||
|
||
|
||
### Generate code | ||
|
||
Run the generate.sh script. | ||
|
||
Inspect the generated files, | ||
to verify they were updated (check the version number in SCHEMA_URL). | ||
|
||
For example, | ||
|
||
``` | ||
static constexpr const char *SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0"; | ||
``` | ||
|
||
|
||
### Format code | ||
|
||
Apply clang-format. | ||
|
||
|
||
### Update CHANGELOG | ||
|
||
Add a `CHANGELOG` entry for the semantic conventions. | ||
|
||
For example, | ||
|
||
``` | ||
* [SEMANTIC CONVENTIONS] Upgrade to version 1.12.0 | ||
``` | ||
|
||
|
||
### Commit | ||
|
||
Commit and file a PR. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters