From 5a94098c2a80417f4d5bde58ed470314290ed7da Mon Sep 17 00:00:00 2001
From: Alexandra Konrad <10500694+trisch-me@users.noreply.github.com>
Date: Thu, 28 Mar 2024 10:59:43 +0100
Subject: [PATCH] add new ECS file namespace (#732)

Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
---
 .chloggen/file.yaml                         | 22 ++++++++++++++
 .github/ISSUE_TEMPLATE/bug_report.yaml      |  1 +
 .github/ISSUE_TEMPLATE/change_proposal.yaml |  1 +
 .github/ISSUE_TEMPLATE/new-conventions.yaml |  1 +
 docs/attributes-registry/README.md          |  1 +
 docs/attributes-registry/file.md            | 18 +++++++++++
 model/registry/file.yaml                    | 33 +++++++++++++++++++++
 7 files changed, 77 insertions(+)
 create mode 100755 .chloggen/file.yaml
 create mode 100644 docs/attributes-registry/file.md
 create mode 100644 model/registry/file.yaml

diff --git a/.chloggen/file.yaml b/.chloggen/file.yaml
new file mode 100755
index 0000000000..20bcdca15b
--- /dev/null
+++ b/.chloggen/file.yaml
@@ -0,0 +1,22 @@
+# Use this changelog template to create an entry for release notes.
+#
+# If your change doesn't affect end users you should instead start
+# your pull request title with [chore] or use the "Skip Changelog" label.
+
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: new_component
+
+# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
+component: file
+
+# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: Add new file namespace
+
+# 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: [732]
+
+# (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:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml
index 42e2d38a75..de2be6b191 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yaml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yaml
@@ -37,6 +37,7 @@ body:
         - area:exception
         - area:faas
         - area:feature-flag
+        - area:file
         - area:gcp-cloud-run
         - area:gcp-gce
         - area:host
diff --git a/.github/ISSUE_TEMPLATE/change_proposal.yaml b/.github/ISSUE_TEMPLATE/change_proposal.yaml
index b4ba2ee211..5b1f182e55 100644
--- a/.github/ISSUE_TEMPLATE/change_proposal.yaml
+++ b/.github/ISSUE_TEMPLATE/change_proposal.yaml
@@ -30,6 +30,7 @@ body:
         - area:exception
         - area:faas
         - area:feature-flag
+        - area:file
         - area:gcp-cloud-run
         - area:gcp-gce
         - area:host
diff --git a/.github/ISSUE_TEMPLATE/new-conventions.yaml b/.github/ISSUE_TEMPLATE/new-conventions.yaml
index a289b3b6bd..da5ba98845 100644
--- a/.github/ISSUE_TEMPLATE/new-conventions.yaml
+++ b/.github/ISSUE_TEMPLATE/new-conventions.yaml
@@ -39,6 +39,7 @@ body:
         - area:exception
         - area:faas
         - area:feature-flag
+        - area:file
         - area:gcp-cloud-run
         - area:gcp-gce
         - area:host
diff --git a/docs/attributes-registry/README.md b/docs/attributes-registry/README.md
index 8d8cd7e466..07c0d1754a 100644
--- a/docs/attributes-registry/README.md
+++ b/docs/attributes-registry/README.md
@@ -44,6 +44,7 @@ Currently, the following namespaces exist:
 * [Exception](exception.md)
 * [FaaS](faas.md)
 * [Feature Flag](feature-flag.md)
+* [File](file.md)
 * [Google Cloud Run](gcp-cloud-run.md)
 * [Google Compute Engine](gcp-gce.md)
 * [Host](host.md)
diff --git a/docs/attributes-registry/file.md b/docs/attributes-registry/file.md
new file mode 100644
index 0000000000..1848908a45
--- /dev/null
+++ b/docs/attributes-registry/file.md
@@ -0,0 +1,18 @@
+<!--- Hugo front matter used to generate the website version of this page:
+--->
+
+# File
+
+## File Attributes
+
+<!-- semconv registry.file(omit_requirement_level) -->
+| Attribute  | Type | Description  | Examples  |
+|---|---|---|---|
+| `file.directory` | string | Directory where the file is located. It should include the drive letter, when appropriate. | `/home/user`; `C:\Program Files\MyApp` |
+| `file.extension` | string | File extension, excluding the leading dot. [1] | `png`; `gz` |
+| `file.name` | string | Name of the file including the extension, without the directory. | `example.png` |
+| `file.path` | string | Full path to the file, including the file name. It should include the drive letter, when appropriate. | `/home/alice/example.png`; `C:\Program Files\MyApp\myapp.exe` |
+| `file.size` | int | File size in bytes. |  |
+
+**[1]:** When the file name has multiple extensions (example.tar.gz), only the last one should be captured ("gz", not "tar.gz").
+<!-- endsemconv -->
diff --git a/model/registry/file.yaml b/model/registry/file.yaml
new file mode 100644
index 0000000000..6a86aa9f9b
--- /dev/null
+++ b/model/registry/file.yaml
@@ -0,0 +1,33 @@
+groups:
+  - id: registry.file
+    prefix: file
+    type: attribute_group
+    brief: "Describes file attributes."
+    attributes:
+      - id: directory
+        type: string
+        brief: >
+          Directory where the file is located. It should include the drive letter, when appropriate.
+        examples: ['/home/user', 'C:\Program Files\MyApp']
+      - id: extension
+        type: string
+        brief: >
+          File extension, excluding the leading dot.
+        examples: ['png', 'gz']
+        note: >
+          When the file name has multiple extensions (example.tar.gz), only the last one should
+          be captured ("gz", not "tar.gz").
+      - id: name
+        type: string
+        brief: >
+          Name of the file including the extension, without the directory.
+        examples: ['example.png']
+      - id: path
+        type: string
+        brief: >
+          Full path to the file, including the file name. It should include the drive letter, when appropriate.
+        examples: ['/home/alice/example.png', 'C:\Program Files\MyApp\myapp.exe']
+      - id: size
+        type: int
+        brief: >
+          File size in bytes.