Skip to content

Commit 3ef58fd

Browse files
authored
[exporterhelper] Preserve request span context in the persistent queue (#13188)
Alternative to #13176 that doesn't involve custom encoder but exposes new public module `pdata/xpdata/request` The actual change set is pretty small. Most of the code is generated protobuf
1 parent 1921e21 commit 3ef58fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1732
-112
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
5+
component: exporterhelper
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: QueueBatchEncoding interface is changed to support marshaling and unmarshaling of request context.
9+
10+
# One or more tracking issues or pull requests related to the change
11+
issues: [13188]
12+
13+
# Optional: The change log or logs in which this entry should be included.
14+
# e.g. '[user]' or '[user, api]'
15+
# Include 'user' if the change is relevant to end users.
16+
# Include 'api' if there is a change to a library API.
17+
# Default: '[user]'
18+
change_logs: [api]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
5+
component: exporterhelper
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Add an option to preserve request span context in the persistent queue
9+
10+
# One or more tracking issues or pull requests related to the change
11+
issues: [11740]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
Currently, it is behind the exporter.PersistRequestContext feature gate, which can be enabled by adding
18+
`--feature-gates=exporter.PersistRequestContext` to the collector command line. An exporter buffer stored by
19+
a previous version of the collector (or by a collector with the feature gate disabled) can be read by a newer
20+
collector with the feature enabled. However, the reverse is not supported: a buffer stored by a newer collector with
21+
the feature enabled cannot be read by an older collector (or by a collector with the feature gate disabled).
22+
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: [user]

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ coverage:
1919

2020
ignore:
2121
- "pdata/internal/data/protogen/**/*"
22+
- "**/*.pb.go"
2223
- "cmd/mdatagen/third_party/**/*"

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ jobs:
125125
run: |
126126
make gogenerate
127127
git diff --exit-code || (echo 'Generated code is out of date, please run "make gogenerate" and commit the changes in this PR.' && exit 1)
128+
- name: Generate proto files
129+
run: |
130+
make genproto
131+
git diff --exit-code || (echo 'Generated code is out of date, please run "make genproto" and commit the changes in this PR.' && exit 1)
128132
- name: Gen Pdata
129133
run: |
130134
make genpdata

.github/workflows/utils/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@
445445
"xexporter",
446446
"xexporterhelper",
447447
"xextension",
448+
"xpdata",
448449
"xpipeline",
449450
"xprocessor",
450451
"xprocessorhelper",

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ gotidy:
9494
gogenerate:
9595
cd cmd/mdatagen && $(GOCMD) install .
9696
@$(MAKE) for-all-target TARGET="generate"
97-
$(MAKE) genproto_internal
9897
$(MAKE) fmt
9998

10099
.PHONY: addlicense
@@ -206,6 +205,7 @@ genproto: genproto-cleanup
206205
curl -sSL https://api.github.com/repos/open-telemetry/opentelemetry-proto/tarball/${OPENTELEMETRY_PROTO_VERSION} | tar xz --strip 1 -C ${OPENTELEMETRY_PROTO_SRC_DIR}
207206
# Call a sub-make to ensure OPENTELEMETRY_PROTO_FILES is populated
208207
$(MAKE) genproto_sub
208+
$(MAKE) genproto_internal
209209
$(MAKE) fmt
210210
$(MAKE) genproto-cleanup
211211

@@ -250,10 +250,9 @@ genpdata:
250250
pushd pdata/ && $(GOCMD) run ./internal/cmd/pdatagen/main.go && popd
251251
$(MAKE) fmt
252252

253-
INTERNAL_PROTO_SRC_DIRS := exporter/exporterhelper/internal/queue
254-
# INTERNAL_PROTO_SRC_DIRS += path/to/other/proto/dirs
253+
INTERNAL_PROTO_SRC_DIRS := exporter/exporterhelper/internal/queue pdata/xpdata/request/internal
255254
INTERNAL_PROTO_FILES := $(foreach dir,$(INTERNAL_PROTO_SRC_DIRS),$(wildcard $(dir)/*.proto))
256-
INTERNAL_PROTOC := $(DOCKERCMD) run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} --go_out=${PWD}
255+
INTERNAL_PROTOC := $(DOCKERCMD) run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} -I/usr/include/github.com/gogo/protobuf -I${PWD}/$(PROTO_INTERMEDIATE_DIR) --go_out=${PWD}
257256

258257
.PHONY: genproto_internal
259258
genproto_internal:

cmd/builder/internal/builder/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ var replaceModules = []string{
9595
"/pdata",
9696
"/pdata/testdata",
9797
"/pdata/pprofile",
98+
"/pdata/xpdata",
9899
"/pipeline",
99100
"/pipeline/xpipeline",
100101
"/processor",

cmd/otelcorecol/builder-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ replaces:
9696
- go.opentelemetry.io/collector/pdata => ../../pdata
9797
- go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
9898
- go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
99+
- go.opentelemetry.io/collector/pdata/xpdata => ../../pdata/xpdata
99100
- go.opentelemetry.io/collector/pipeline => ../../pipeline
100101
- go.opentelemetry.io/collector/pipeline/xpipeline => ../../pipeline/xpipeline
101102
- go.opentelemetry.io/collector/processor => ../../processor

cmd/otelcorecol/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ require (
122122
go.opentelemetry.io/collector/pdata v1.34.0 // indirect
123123
go.opentelemetry.io/collector/pdata/pprofile v0.128.0 // indirect
124124
go.opentelemetry.io/collector/pdata/testdata v0.128.0 // indirect
125+
go.opentelemetry.io/collector/pdata/xpdata v0.0.0-00010101000000-000000000000 // indirect
125126
go.opentelemetry.io/collector/pipeline v0.128.0 // indirect
126127
go.opentelemetry.io/collector/pipeline/xpipeline v0.128.0 // indirect
127128
go.opentelemetry.io/collector/processor/processorhelper v0.128.0 // indirect
@@ -291,6 +292,8 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
291292

292293
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
293294

295+
replace go.opentelemetry.io/collector/pdata/xpdata => ../../pdata/xpdata
296+
294297
replace go.opentelemetry.io/collector/pipeline => ../../pipeline
295298

296299
replace go.opentelemetry.io/collector/pipeline/xpipeline => ../../pipeline/xpipeline

exporter/debugexporter/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ require (
5050
go.opentelemetry.io/collector/extension/xextension v0.128.0 // indirect
5151
go.opentelemetry.io/collector/featuregate v1.34.0 // indirect
5252
go.opentelemetry.io/collector/internal/telemetry v0.128.0 // indirect
53+
go.opentelemetry.io/collector/pdata/xpdata v0.0.0-00010101000000-000000000000 // indirect
5354
go.opentelemetry.io/collector/pipeline v0.128.0 // indirect
5455
go.opentelemetry.io/collector/pipeline/xpipeline v0.128.0 // indirect
5556
go.opentelemetry.io/collector/receiver v1.34.0 // indirect
@@ -127,3 +128,5 @@ replace go.opentelemetry.io/collector/extension/xextension => ../../extension/xe
127128
replace go.opentelemetry.io/collector/internal/telemetry => ../../internal/telemetry
128129

129130
replace go.opentelemetry.io/collector/client => ../../client
131+
132+
replace go.opentelemetry.io/collector/pdata/xpdata => ../../pdata/xpdata

0 commit comments

Comments
 (0)