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

Generate Attribute Registry using Weaver #917

Merged
merged 72 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3818090
First cut at using weaver for markdown generation + attribute registry.
jsuereth Apr 2, 2024
afe784f
More fixes to template for weaver registry demo.
jsuereth Apr 3, 2024
ab101eb
Fix enum rendering in attribute registry 2.
jsuereth Apr 3, 2024
c627216
Update template to write notes and enums
jsuereth Apr 3, 2024
53f8151
Fix inverted notes append
jsuereth Apr 3, 2024
baafd84
Add deprecated attributes to registry generation
jsuereth Apr 4, 2024
e20e20d
Add table of contents to attribute registry demo
jsuereth Apr 4, 2024
bae956c
Update attribute registry link to use opentelemetry.io
jsuereth Apr 10, 2024
2d42799
Update attribute registry gen to match latest semconv repo.
jsuereth Apr 10, 2024
9da787b
Attribute group template now handles deprecated.
jsuereth Apr 10, 2024
4274b09
Update weaver to pull all top-level groups into the same template.
jsuereth Apr 11, 2024
6a5b6bd
Update makefile to actually generate attribute registry and update we…
jsuereth Apr 11, 2024
ea5371c
Actually check in new registry files to visualize them.
jsuereth Apr 11, 2024
9eae511
Fix peer.yaml in attribute registry.
jsuereth Apr 12, 2024
4a67b88
Fix filenames to match markdown lint.
jsuereth Apr 12, 2024
cd4d08e
Fix note rendering to be local, but indexes remain global to the page.
jsuereth Apr 12, 2024
72a900b
Recreate markdown with new notes.
jsuereth Apr 12, 2024
dd5045e
Sort attributes when rendering tables.
jsuereth Apr 12, 2024
b4c3b64
Fix spacing issues in table generation.
jsuereth Apr 12, 2024
2677bbe
Fix spaces sneaking in enum tables.
jsuereth Apr 12, 2024
25122b3
remove leading space from attribute types.
jsuereth Apr 12, 2024
13035b8
Remove extra space in front of badges.
jsuereth Apr 12, 2024
26b0c2f
only return first enum value in examples.
jsuereth Apr 12, 2024
efef7fa
Fix examples where there's only one value.
jsuereth Apr 12, 2024
46b1dff
Fix space on notes.
jsuereth Apr 12, 2024
b5c74f7
Fix template type rendering.
jsuereth Apr 12, 2024
aac91b9
Run markdown lint after codegen.
jsuereth Apr 12, 2024
e74c63f
Rename markdown templates so they don't get linted.
jsuereth Apr 12, 2024
6955829
Run prettier after making attribute registry.
jsuereth Apr 12, 2024
ed5a5d5
remove some code spacing conventions that don't line up with semconv …
jsuereth Apr 12, 2024
f31a54f
Update exception links.
jsuereth Apr 12, 2024
910a024
Use new title case filter for titles.
jsuereth Apr 12, 2024
2c32c77
Update readme ot use title case.
jsuereth Apr 12, 2024
8d3c01f
Update makefile to use weaver for everything.
jsuereth Apr 15, 2024
5e907b0
Update docs for weaver snippet generation.
jsuereth Apr 15, 2024
7520364
Undo unnecesary yaml changes.
jsuereth Apr 15, 2024
b9cc8dd
Fix missing readme components.
jsuereth Apr 16, 2024
270619c
Simplify attribute name macro.
jsuereth Apr 16, 2024
95789c8
Migrate to latest weaver with kebab/title case fixes for k8s/s3.
jsuereth Apr 16, 2024
e258c34
Add header to denote autogenerated files.
jsuereth Apr 16, 2024
2490394
Fix TOC generation for attribute registry namespaces.
jsuereth Apr 16, 2024
bf147c0
Update tempaltes to use fixed kebab-case.
jsuereth Apr 16, 2024
690fafa
Add changelog.
jsuereth Apr 16, 2024
26e0c70
Update contributing for new commands.
jsuereth Apr 16, 2024
c9061e0
Update to latest weaver.
jsuereth Apr 17, 2024
69b0624
update to latest weaver with fix for attribute prefix.
jsuereth Apr 18, 2024
4930b7f
Update to main, re-run doc generation.
jsuereth Apr 18, 2024
7066d20
Remove non-auto-generated markdown from attribute registry.
jsuereth Apr 18, 2024
d01a3a7
Merge main.
jsuereth Apr 19, 2024
0da6a45
Merge main and update latest weaver.
jsuereth Apr 23, 2024
18188f5
Bump to latest weaver version.
jsuereth Apr 23, 2024
dc5c4c0
(fix) Otel scope was a resource group instead of attribute in the reg…
jsuereth Apr 24, 2024
149a196
Update codeowners as requests.
jsuereth Apr 24, 2024
2b0b68f
Revert system-metrics.
jsuereth Apr 24, 2024
8165cd3
Fix system metrics merge issue.
jsuereth Apr 24, 2024
a3ef304
Merge remote-tracking branch 'origin/main' into wip-weaver-attribute-…
jsuereth Apr 24, 2024
a48bbf8
Update codegen from merge.
jsuereth Apr 24, 2024
447eea5
Merge main.
jsuereth Apr 24, 2024
eddc8f0
Merge main, update to latest weaver.
jsuereth Apr 24, 2024
8e6aa16
Remove codeowners of autogenerated files that shouldn't be touched by…
jsuereth Apr 24, 2024
530d428
Merge main, fix merge conflicts.
jsuereth Apr 24, 2024
ed3c38b
Migrate to weaver v0.1.0 and regenerate all markdown.
jsuereth Apr 24, 2024
67f90e5
Add attribute grief to registry generation.
jsuereth Apr 29, 2024
c6d7558
Update registry titles to use acronym filter for correct capitilazati…
jsuereth Apr 29, 2024
ea71f73
Merge main.
jsuereth Apr 29, 2024
d316863
merge main.
jsuereth Apr 29, 2024
ba87316
Add JVM to acronym list.
jsuereth Apr 29, 2024
9ddb829
merge main.
jsuereth Apr 30, 2024
df0cc49
Update attribute registry to use at least three example enum values.
jsuereth Apr 30, 2024
f7fecbf
Merge main and fix deprecated annotations.
jsuereth May 1, 2024
46f06fc
Merge main
jsuereth May 1, 2024
0129c41
Fix attribute registry template for description to match existing sni…
jsuereth May 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .chloggen/917.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
change_type: enhancement
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Migrate Attribute Registry to be completely autogenerated.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [197]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Migrate to using weaver for markdown generation (snippet + registry).
The entirety of the registry now is generated using weaver with templates
under the `templates/` directory. Snippets still require a hardcoded
command.
13 changes: 0 additions & 13 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@
/model/registry/url.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/model/registry/user-agent.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/http/ @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/http.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
jsuereth marked this conversation as resolved.
Show resolved Hide resolved
/docs/attribute-registry/server.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/client.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/network.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/error.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/url.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers
/docs/attribute-registry/user-agent.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-http-approvers

# System semantic conventions approvers
/docs/system/ @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-system-approvers
Expand All @@ -62,14 +55,11 @@

# K8s semantic conventions approvers
/docs/resource/k8s.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-k8s-approvers
/docs/attributes-registry/k8s.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-k8s-approvers
/model/resource/k8s.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-k8s-approvers
/model/registry/k8s.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-k8s-approvers

# Container semantic conventions approvers
/docs/resource/container.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
/docs/attributes-registry/container.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
/docs/attributes-registry/oci.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
/model/resource/container.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
/model/registry/container.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
/model/registry/oci.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-container-approvers
Expand All @@ -79,14 +69,11 @@
/model/registry/aspnetcore.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-dotnet-approver @open-telemetry/semconv-http-approvers
/model/registry/signalr.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-dotnet-approver @open-telemetry/semconv-http-approvers
/docs/dotnet/ @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-dotnet-approver @open-telemetry/semconv-http-approvers
/docs/attributes-registry/aspnetcore.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-dotnet-approver @open-telemetry/semconv-http-approvers
/docs/attributes-registry/signalr.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-dotnet-approver @open-telemetry/semconv-http-approvers

# Gen-AI semantic conventions approvers
/model/registry/gen-ai.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-llm-approvers
/model/metrics/gen-ai.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-llm-approvers
/model/trace/gen-ai.yaml @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-llm-approvers
/docs/gen-ai/ @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-llm-approvers
/docs/attributes-registry/llm.md @open-telemetry/specs-semconv-approvers @open-telemetry/semconv-llm-approvers

# TODO - Add semconv area experts
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ol-prefix:
style: ordered
no-inline-html: false
fenced-code-language: false
no-space-in-code: false
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
/docs/**
!/docs/cloud*
!/docs/cloud*/**
!/docs/attributes-registry*
!/docs/attributes-registry*/**
/model
/schemas
CHANGELOG.md
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ You can also take examples from past changes inside the `schemas` folder.
### 2. Update the markdown files

After updating the YAML file(s), you need to update
the respective markdown files. For this, run the following command:
the respective markdown files. For this, run the following commands:

```bash
make table-generation
make table-generation attribute-registry-generation
```

#### Hugo frontmatter
Expand Down
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CHLOGGEN_CONFIG := .chloggen/config.yaml
# see https://github.com/open-telemetry/build-tools/releases for semconvgen updates
# Keep links in model/README.md and .vscode/settings.json in sync!
SEMCONVGEN_VERSION=0.24.0
WEAVER_VERSION=0.1.0

# TODO: add `yamllint` step to `all` after making sure it works on Mac.
.PHONY: all
Expand Down Expand Up @@ -95,13 +96,31 @@ yamllint:
.PHONY: table-generation
table-generation:
docker run --rm -v $(PWD)/model:/source -v $(PWD)/docs:/spec \
otel/semconvgen:$(SEMCONVGEN_VERSION) -f /source markdown -md /spec
otel/weaver:${WEAVER_VERSION} registry update-markdown \
--registry=/source \
--attribute-registry-base-url="/docs/attributes-registry" \
/spec

# Generate attribute registry markdown.
.PHONY: attribute-registry-generation
attribute-registry-generation:
docker run --rm -v $(PWD)/model:/source -v $(PWD)/docs:/spec -v $(PWD)/templates:/weaver/templates \
otel/weaver:${WEAVER_VERSION} registry generate \
--registry=/source \
--templates=/weaver/templates \
markdown \
/spec/attributes-registry/
npm run fix:format

# Check if current markdown tables differ from the ones that would be generated from YAML definitions
# Check if current markdown tables differ from the ones that would be generated from YAML definitions (weaver).
.PHONY: table-check
table-check:
docker run --rm -v $(PWD)/model:/source -v $(PWD)/docs:/spec \
otel/semconvgen:$(SEMCONVGEN_VERSION) -f /source markdown -md /spec --md-check
otel/weaver:${WEAVER_VERSION} registry update-markdown \
--registry=/source \
--attribute-registry-base-url="/docs/attributes-registry" \
--dry-run \
/spec

LATEST_RELEASED_SEMCONV_VERSION := $(shell git describe --tags --abbrev=0 | sed 's/v//g')
.PHONY: compatibility-check
Expand All @@ -122,14 +141,15 @@ fix-format:
npm run fix:format

# Run all checks in order of speed / likely failure.
# As a last thing, run attribute registry generation and git-diff for differences.
.PHONY: check
check: misspell markdownlint check-format markdown-toc compatibility-check markdown-link-check
check: misspell markdownlint check-format markdown-toc compatibility-check markdown-link-check attribute-registry-generation
git diff --exit-code ':*.md' || (echo 'Generated markdown Table of Contents is out of date, please run "make markdown-toc" and commit the changes in this PR.' && exit 1)
@echo "All checks complete"

# Attempt to fix issues / regenerate tables.
.PHONY: fix
fix: table-generation misspell-correction fix-format markdown-toc
fix: table-generation attribute-registry-generation misspell-correction fix-format markdown-toc
@echo "All autofixes complete"

.PHONY: install-tools
Expand Down
103 changes: 56 additions & 47 deletions docs/attributes-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ linkTitle: Registry
weight: -2
--->

# Attributes Registry
<!-- NOTE: THIS FILE IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/readme.md.j2 -->

# Attribute Registry

The attributes registry is the place where attributes are defined. An attribute definition covers the following properties of an attribute:

Expand All @@ -28,51 +31,57 @@ All registered attributes are listed by namespace in this registry.

Currently, the following namespaces exist:

* [Android](android.md)
* [AWS](aws.md)
* [Browser](browser.md)
* [Client](client.md)
* [Cloud](cloud.md)
* [CloudEvents](cloudevents.md)
* [Code](code.md)
* [Container](container.md)
* [DB](db.md) (database)
* [Deployment](deployment.md)
* [Destination](destination.md)
* [Device](device.md)
* [Disk](disk.md)
* [End user](enduser.md)
* [Error](error.md)
* [Event](event.md)
* [Exception](exception.md)
* [FaaS](faas.md)
* [Feature Flag](feature-flag.md)
* [File](file.md)
* [Google Cloud Platform (GCP)](gcp.md)
* [GraphQl](graphql.md)
* [Heroku](heroku.md)
* [Host](host.md)
* [HTTP](http.md)
* [iOS](ios.md)
* [K8s](k8s.md)
* [Log](log.md)
* [Network](network.md)
* [OCI](oci.md)
* [OpenTelemetry](otel.md)
* [OpenTracing](opentracing.md)
* [OS](os.md)
* [Peer](peer.md)
* [Process](process.md)
* [RPC](rpc.md)
* [Server](server.md)
* [Service](service.md)
* [Session](session.md)
* [Source](source.md)
* [Telemetry](telemetry.md)
* [Thread](thread.md)
* [TLS](tls.md)
* [URL](url.md)
* [User agent](user-agent.md)
* [Webengine](webengine.md)
- [Android](android.md)
- [Aspnetcore](aspnetcore.md)
- [Aws](aws.md)
- [Browser](browser.md)
- [Client](client.md)
- [Cloud](cloud.md)
- [Cloudevents](cloudevents.md)
- [Code](code.md)
- [Container](container.md)
- [Db](db.md)
- [Deployment](deployment.md)
- [Destination](destination.md)
- [Device](device.md)
- [Disk](disk.md)
- [Dns](dns.md)
- [Enduser](enduser.md)
- [Error](error.md)
- [Event](event.md)
- [Exception](exception.md)
- [Faas](faas.md)
- [Feature Flag](feature-flag.md)
- [File](file.md)
- [Gcp](gcp.md)
- [Gen Ai](gen-ai.md)
- [Graphql](graphql.md)
- [Heroku](heroku.md)
- [Host](host.md)
- [Http](http.md)
- [Ios](ios.md)
- [K8s](k8s.md)
- [Log](log.md)
- [Messaging](messaging.md)
- [Network](network.md)
- [Oci](oci.md)
- [Opentracing](opentracing.md)
- [Os](os.md)
- [Otel](otel.md)
- [Peer](peer.md)
- [Process](process.md)
- [Rpc](rpc.md)
- [Server](server.md)
- [Service](service.md)
- [Session](session.md)
- [Signalr](signalr.md)
- [Source](source.md)
- [System](system.md)
- [Telemetry](telemetry.md)
- [Thread](thread.md)
- [Tls](tls.md)
- [Url](url.md)
- [User Agent](user-agent.md)
- [Webengine](webengine.md)

[developers recommendations]: ../general/attribute-naming.md#recommendations-for-application-developers
34 changes: 16 additions & 18 deletions docs/attributes-registry/android.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
# Android
<!--- Hugo front matter used to generate the website version of this page:
--->

<!-- toc -->
<!-- NOTE: THIS FILE IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/attribute_namespace.md.j2 -->

- [Android Attributes](#android-attributes)
- [Deprecated Android Attributes](#deprecated-android-attributes)
# Android

<!-- tocstop -->
- [Android](#android-attributes)
- [Android Deprecated](#android-deprecated-attributes)

## Android Attributes

<!-- semconv registry.android(omit_requirement_level) -->
| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| Attribute | Type | Description | Examples | Stability |
| ---------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------- |
| `android.os.api_level` | string | Uniquely identifies the framework API revision offered by a version (`os.version`) of the android operating system. More information can be found [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels). | `33`; `32` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
<!-- endsemconv -->

## Deprecated Android Attributes
## Android Deprecated Attributes

<!-- semconv registry.android.deprecated(omit_requirement_level) -->
| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| Attribute | Type | Description | Examples | Stability |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------- |
| `android.state` | string | Deprecated use the `device.app.lifecycle` event definition including `android.state` as a payload field instead. [1] | `created` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.

`android.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `created` | Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `background` | Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| Value | Description | Stability |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `created` | Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `background` | Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `foreground` | Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
<!-- endsemconv -->
Loading
Loading