diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000000..08dca47531 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,77 @@ +name: Bug report +description: Create a report to help us improve +labels: ["bug", "triage:needs-triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! Please make sure to fill out the entire form below, providing as much context as you can in order to help us triage and track down your bug as quickly as possible. + + Before filing a bug, please be sure you have searched through [existing bugs](https://github.com/open-telemetry/semantic-conventions/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug) to see if an existing issue covers your bug. + - type: dropdown + id: area + attributes: + label: Area(s) + description: Which area(s) does your bug report concern? If none fits, please select `area:other` + multiple: true + options: + - area:other + # NOTE: The list below is autogenerated using `make generate-gh-issue-templates` + # DO NOT manually edit it. + # Start semconv area list + - area:android + - area:browser + - area:client + - area:cloud + - area:code + - area:container + - area:db + - area:destination + - area:device + - area:disk + - area:dns + - area:error + - area:exception + - area:faas + - area:host + - area:http + - area:k8s + - area:messaging + - area:network + - area:oci + - area:os + - area:process + - area:rpc + - area:server + - area:source + - area:thread + - area:tls + - area:url + - area:user-agent + # End semconv area list + - type: textarea + attributes: + label: What happened? + description: Please provide as much detail as you reasonably can. + value: | + ## Description + + ## Steps to Reproduce (if any) + + ## Expected Result + + ## Actual Result + validations: + required: true + + - type: input + attributes: + label: Semantic convention version + description: What version did you use? (e.g., `v1.24.0`, `1eb551b`, etc) + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: Any additional information you think may be relevant to this issue. diff --git a/.github/ISSUE_TEMPLATE/change_proposal.yaml b/.github/ISSUE_TEMPLATE/change_proposal.yaml new file mode 100644 index 0000000000..edaa3a4a75 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/change_proposal.yaml @@ -0,0 +1,64 @@ +name: Propose changes to existing conventions +description: Propose changes you'd like to be added to existing conventions +labels: ["enhancement", "triage:needs-triage"] +body: + - type: dropdown + id: area + attributes: + label: Area(s) + description: Which area(s) does your change request concern? + multiple: true + options: + # NOTE: The list below is autogenerated using `make generate-gh-issue-templates` + # DO NOT manually edit it. + # Start semconv area list + - area:android + - area:browser + - area:client + - area:cloud + - area:code + - area:container + - area:db + - area:destination + - area:device + - area:disk + - area:dns + - area:error + - area:exception + - area:faas + - area:host + - area:http + - area:k8s + - area:messaging + - area:network + - area:oci + - area:os + - area:process + - area:rpc + - area:server + - area:source + - area:thread + - area:tls + - area:url + - area:user-agent + # End semconv area list + - type: textarea + attributes: + label: Is your change request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/new-conventions.yaml b/.github/ISSUE_TEMPLATE/new-conventions.yaml new file mode 100644 index 0000000000..8a72b6bff2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-conventions.yaml @@ -0,0 +1,73 @@ +name: Propose new semantic conventions +description: Propose new conventions you'd like to be part of the OpenTelemetry project +labels: ["enhancement", "triage:needs-triage", "experts needed"] +body: + - type: markdown + attributes: + value: | + Please make sure to fill out the entire form below, providing as much context as you can in order to help us triage the proposal as quickly as possible. + + Before filing the proposal, please be sure you have searched through [existing issues](https://github.com/open-telemetry/semantic-conventions/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aenhancement+label%3Aarea:new) to see if an existing issue covers your proposal. + + Additionally, make sure to read and follow the guidelines on [Project Proposal](https://github.com/open-telemetry/community/blob/main/project-management.md#project-management), in case the proposal is for a new set of conventions/working group. + - type: dropdown + id: area + attributes: + label: Area(s) + description: Which area(s) does your new conventions concern? If none fits, please select `area:new` + multiple: true + options: + - area:new + # NOTE: The list below is autogenerated using `make generate-gh-issue-templates` + # DO NOT manually edit it. + # Start semconv area list + - area:android + - area:browser + - area:client + - area:cloud + - area:code + - area:container + - area:db + - area:destination + - area:device + - area:disk + - area:dns + - area:error + - area:exception + - area:faas + - area:host + - area:http + - area:k8s + - area:messaging + - area:network + - area:oci + - area:os + - area:process + - area:rpc + - area:server + - area:source + - area:thread + - area:tls + - area:url + - area:user-agent + # End semconv area list + - type: textarea + attributes: + label: Is your change request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a387a9db22..dd48bff2ce 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -97,3 +97,12 @@ jobs: - uses: actions/checkout@v1 - name: verify schemas run: make schema-check + + areas-dropdown-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Components dropdown in issue templates + run: | + make generate-gh-issue-templates + git diff --exit-code '.github/ISSUE_TEMPLATE' || (echo 'Dropdowns in issue templates is out of date, please run "make generate-gh-issue-templates" and commit the changes in this PR.' && exit 1) diff --git a/.github/workflows/generate-registry-area-labels.yml b/.github/workflows/generate-registry-area-labels.yml new file mode 100644 index 0000000000..58f3b62b3a --- /dev/null +++ b/.github/workflows/generate-registry-area-labels.yml @@ -0,0 +1,24 @@ +name: 'Generate registry area labels' +on: + push: + branches: [main] + paths: + - model/registry/** + - ./.github/workflows/generate-registry-area-labels.yml + - ./.github/workflows/scripts/generate-registry-area-labels.sh + workflow_dispatch: + +jobs: + generate-component-labels: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'open-telemetry' }} + steps: + - uses: actions/checkout@v4 + + - name: Run update permissions + run: chmod +x ./.github/workflows/scripts/generate-registry-area-labels.sh + + - name: Generate registry area labels + run: ./.github/workflows/scripts/generate-registry-area-labels.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prepare-new-issue.yml b/.github/workflows/prepare-new-issue.yml new file mode 100644 index 0000000000..345b7dcd1e --- /dev/null +++ b/.github/workflows/prepare-new-issue.yml @@ -0,0 +1,22 @@ +name: 'Prepare new issue' +on: + issues: + types: [opened] + +jobs: + prepare-new-issue: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'open-telemetry' }} + steps: + - uses: actions/checkout@v4 + + - name: Run update permissions + run: chmod +x ./.github/workflows/scripts/prepare-new-issue.sh + + - name: Run prepare-new-issue.sh + run: ./.github/workflows/scripts/prepare-new-issue.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE: ${{ github.event.issue.number }} + BODY: ${{ github.event.issue.body }} + OPENER: ${{ github.event.issue.user.login }} diff --git a/.github/workflows/scripts/generate-registry-area-labels.sh b/.github/workflows/scripts/generate-registry-area-labels.sh new file mode 100755 index 0000000000..bd45812bc5 --- /dev/null +++ b/.github/workflows/scripts/generate-registry-area-labels.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 +# +# Create labels for all semantic convention areas that are in model/registry. +# Existing labels are not affected. +# +# Note that there is a 50-character limit on labels, so some areas may +# not have a corresponding label. + +set -euo pipefail + +CUR_DIRECTORY=$(dirname "$0") +AREAS=$(sh "${CUR_DIRECTORY}/get-registry-areas.sh") + +echo -e "\nStarting to create area labels" +echo -e "--------------------------------\n" + +for AREA in ${AREAS}; do + LABEL_NAME=$(basename "${AREA}" .yaml) + + if (( "${#LABEL_NAME}" > 50 )); then + echo "'${LABEL_NAME}' exceeds GitHubs 50-character limit on labels, skipping" + continue + fi + echo "area:${LABEL_NAME}" + + # gh label create "area:${LABEL_NAME}" -c "#425cc7" +done + +echo -e "\nLabels created successfully" +echo -e "--------------------------------\n" + diff --git a/.github/workflows/scripts/get-registry-areas.sh b/.github/workflows/scripts/get-registry-areas.sh new file mode 100755 index 0000000000..b4fd8b6e18 --- /dev/null +++ b/.github/workflows/scripts/get-registry-areas.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 +# +# Get a list of the semantic conventions areas from the registry. + +CUR_DIRECTORY=$(dirname "$0") +REPO_DIR="$( cd "$CUR_DIRECTORY/../../../" && pwd )" +REGISTRY_DIR="$( cd "$REPO_DIR/model/registry" && pwd )" + + +for entry in $(ls $REGISTRY_DIR | egrep '\.yaml$' | sort) +do + echo "$entry" +done diff --git a/.github/workflows/scripts/prepare-new-issue.sh b/.github/workflows/scripts/prepare-new-issue.sh new file mode 100755 index 0000000000..c8af7d0b4a --- /dev/null +++ b/.github/workflows/scripts/prepare-new-issue.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 +# +# + +# This script extracts the "Area" from the issue body and adds it as a label +# on newly created issues. The area from the issue body comes from +# the "Area" drop-down field in the ISSUE_TEMPLATE, which is auto-generated +# from the files inside model/registry. + +# TODO: This script can be later used to also auto-assign the correct code-owner +# once that is implemented. + +set -euo pipefail + +if [[ -z "${ISSUE:-}" || -z "${BODY:-}" || -z "${OPENER:-}" ]]; then + echo "Missing one of ISSUE, BODY, or OPENER, please ensure all are set." + exit 0 +fi + +LABELS="" +AREAS_SECTION_START=$( (echo "${BODY}" | grep -n '### Area(s)' | awk '{ print $1 }' | grep -oE '[0-9]+') || echo '-1' ) +BODY_AREAS="" + +if [[ "${AREAS_SECTION_START}" != '-1' ]]; then + BODY_AREAS=$(echo "${BODY}" | sed -n $((AREAS_SECTION_START+2))p) +fi + +for AREA in ${BODY_AREAS}; do + # Areas are delimited by ', ' and the for loop separates on spaces, so remove the extra comma. + AREA=${AREA//,/} + + if (( "${#AREA}" > 50 )); then + echo "'${AREA}' exceeds GitHub's 50-character limit on labels, skipping adding a label" + continue + fi + + if [[ -n "${LABELS}" ]]; then + LABELS+="," + fi + LABELS+="${AREA}" +done + +if [[ -v PINGED_AREAS[@] ]]; then + echo "The issue was associated with areas:" "${!PINGED_AREAS[@]}" +else + echo "No related areas were given" +fi + +if [[ -n "${LABELS}" ]]; then + # Notes on this call: + # 1. Labels will be deduplicated by the GitHub CLI. + # 2. The call to edit the issue will fail if any of the + # labels doesn't exist. We can be reasonably sure that + # all labels will exist since they come from a known set. + echo "Adding the following labels: ${LABELS//,/ /}" + gh issue edit "${ISSUE}" --add-label "${LABELS}" || true +else + echo "No labels were found to add" +fi diff --git a/.yamllint b/.yamllint index 70b17e868b..0e43f20a2a 100644 --- a/.yamllint +++ b/.yamllint @@ -3,6 +3,9 @@ extends: default ignore-from-file: - .gitignore +ignore: | + node_modules/* + rules: document-start: disable octal-values: enable @@ -10,6 +13,8 @@ rules: allowed-values: ['true', 'false', 'on'] # 'on' for GH action trigger line-length: max: 200 + ignore: | + .github/* indentation: check-multi-line-strings: false indent-sequences: consistent diff --git a/Makefile b/Makefile index 3ef76b3827..283402f5c0 100644 --- a/Makefile +++ b/Makefile @@ -150,3 +150,9 @@ chlog-preview: $(CHLOGGEN) .PHONY: chlog-update chlog-update: $(CHLOGGEN) $(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --version $(VERSION) + +# Updates the areas (registry yaml file names) on all ISSUE_TEMPLATE +# files that have the "area" dropdown field +.PHONY: generate-gh-issue-templates +generate-gh-issue-templates: + $(TOOLS_DIR)/scripts/update-issue-template-areas.sh diff --git a/internal/tools/scripts/update-issue-template-areas.sh b/internal/tools/scripts/update-issue-template-areas.sh new file mode 100755 index 0000000000..1e7c7cb276 --- /dev/null +++ b/internal/tools/scripts/update-issue-template-areas.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 +# +# Create labels for all semantic convention areas that are in model/registry. +# Existing labels are not affected. +# +# Note that there is a 50-character limit on labels, so some areas may +# not have a corresponding label. + +set -euo pipefail + +CUR_DIRECTORY=$(dirname "$0") +REPO_DIR="$( cd "$CUR_DIRECTORY/../../../" && pwd )" +GITHUB_DIR="$( cd "$REPO_DIR/.github/" && pwd )" +TEMPLATES_DIR="$( cd "$GITHUB_DIR/ISSUE_TEMPLATE" && pwd )" + +AREAS=$(sh "${GITHUB_DIR}/workflows/scripts/get-registry-areas.sh") + +START_AREA_LIST="# Start semconv area list" +END_AREA_LIST="# End semconv area list" + +replacement=" ${START_AREA_LIST}" + +for AREA in ${AREAS}; do + LABEL_NAME=$(basename "${AREA}" .yaml) + replacement="${replacement}\n - area:${LABEL_NAME}" +done + +echo -e "\nStarting to replace areas in ISSUE_TEMPLATES:" +echo -e "---------------------------------------------\n" + +replacement="${replacement}\n ${END_AREA_LIST}" + +echo -e "The replacement text will be:" +echo -e "---------------------------------------------\n" +echo -e $replacement + +find ${TEMPLATES_DIR} -type f -name '*.yaml' -exec sed -i "/$START_AREA_LIST/,/$END_AREA_LIST/c\\$replacement" {} \; + +echo -e "\nISSUE_TEMPLATES updated successfully" +echo -e "---------------------------------------------"