You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for mapping s3 bucket prefix to OTel resource attributes (open-telemetry#39634)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Introduced the `resource_attrs_to_s3/s3_prefix` configuration field to
enable mapping the S3 bucket prefix to an OpenTelemetry resource
attribute. When this field is set, the S3 prefix is determined by the
specified resource attribute, with `s3uploader/s3_prefix` used as a
fallback if the attribute is missing or empty.
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixesopen-telemetry#37858
<!--Describe what testing was performed and which tests were added.-->
#### Testing
- Added unit tests to verify the functionality of the related code
changes
- Built the OpenTelemetry Collector locally to ensure the component
behaves as intended
<!--Describe the documentation added.-->
#### Documentation
Updated the README to document the new configuration field:
- Described its impact on the component’s behavior
- Clarified how it interacts with the `s3uploader/s3_prefix` setting
- Included an example demonstrating how to use it
<!--Please delete paragraphs that you did not use before submitting.-->
# Use this changelog template to create an entry for release notes.
2
+
3
+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4
+
change_type: enhancement
5
+
6
+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7
+
component: awss3exporter
8
+
9
+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10
+
note: add configuration field `resource_attrs_to_s3/s3_prefix` to support mapping s3 bucket prefix to OTel resource attributes
11
+
12
+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13
+
issues: [37858]
14
+
15
+
# (Optional) One or more lines of additional information to render under the primary note.
16
+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17
+
# Use pipe (|) for multiline entries.
18
+
subtext: If `resource_attrs_to_s3/s3_prefix` is configured, s3 prefix will be determined based on the specified resource attribute and `s3uploader/s3_prefix` will serve as a fallback.
19
+
20
+
# If your change doesn't affect end users or the exported elements of any package,
21
+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22
+
# Optional: The change log or logs in which this entry should be included.
23
+
# e.g. '[user]' or '[user, api]'
24
+
# Include 'user' if the change is relevant to end users.
25
+
# Include 'api' if there is a change to a library API.
Copy file name to clipboardExpand all lines: exporter/awss3exporter/README.md
+32-1
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ The following exporter configuration parameters are supported.
38
38
|`compression`| should the file be compressed | none |
39
39
|`sending_queue`|[exporters common queuing](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md)| disabled |
40
40
|`timeout`|[exporters common timeout](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md)| 5s |
41
-
41
+
|`resource_attrs_to_s3`| determines the mapping of S3 configuration values to resource attribute values for uploading operations. ||
42
42
43
43
### Marshaler
44
44
@@ -61,6 +61,12 @@ See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/
61
61
-`none` (default): No compression will be applied
62
62
-`gzip`: Files will be compressed with gzip. **This does not support `sumo_ic`marshaler.**
63
63
64
+
### resource_attrs_to_s3
65
+
-`s3_prefix`: Defines which resource attribute's value should be used as the S3 prefix.
66
+
When this option is set, it dynamically overrides `s3uploader/s3_prefix`.
67
+
If the specified resource attribute exists in the data,
68
+
its value will be used as the prefix; otherwise, `s3uploader/s3_prefix` will serve as the fallback.
69
+
64
70
# Example Configurations
65
71
66
72
Following example configuration defines to store output in 'eu-central' region and bucket named 'databucket'.
@@ -110,6 +116,31 @@ In this case, logs and traces would be stored in the following path format.
110
116
metric/YYYY/MM/DD/HH/mm
111
117
```
112
118
119
+
## Data routing based on resource attributes
120
+
When `resource_attrs_to_s3/s3_prefix` is configured, the S3 prefix is dynamically derived from a specified resource attribute in your data.
121
+
If the attribute value is unavailable, the prefix will fall back to the value defined in `s3uploader/s3_prefix`.
122
+
```yaml
123
+
exporters:
124
+
awss3:
125
+
s3uploader:
126
+
region: 'eu-central-1'
127
+
s3_bucket: 'databucket'
128
+
s3_prefix: 'metric'
129
+
s3_partition_format: '%Y/%m/%d/%H/%M'
130
+
resource_attrs_to_s3:
131
+
s3_prefix: "com.awss3.prefix"
132
+
```
133
+
In this case, metrics, logs and traces would be stored in the following path format examples:
134
+
135
+
```console
136
+
prefix1/YYYY/MM/DD/HH/mm
137
+
foo-prefix/YYYY/MM/DD/HH/mm
138
+
prefix-bar/YYYY/MM/DD/HH/mm
139
+
metric/YYYY/MM/DD/HH/mm
140
+
...
141
+
```
142
+
143
+
113
144
## AWS Credential Configuration
114
145
115
146
This exporter follows default credential resolution for the
0 commit comments