Disable X-Ray telemetry safely #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to disable telemetry to avoid verbose logging but do so in a safe way without triggering any internal X-Ray panic (nil pointer exception) because telemetry cannot be nil.
Issue
panic: runtime **error:** invalid memory address or nil pointer dereference
telemetry.T.SegmentSent(int64(len(batch)))
👉 We need to initialize telemetry (at least with a dummy implementation) because the X-Ray daemon internally depends on it and we preferabbly don’t want to modify the X-Ray daemon itself.
Testing
I manually tested the new init against the customer example from support with both telemetry settings,
LOCALSTACK_ENABLE_XRAY_TELEMETRY=1
, and disabled by default. No crashes or nil pointer exception occurs anymore.Background
Commit where we made the telemetry init optional: f65b6ad#diff-1ecaca51fe284265507b331fce50acf4fbf6eaedf32000481d7464b7214ef666R136
Telemetry can be quite verbose (e.g., 10+ requests for a single invocation) and given we currently don't use it, we currently disable it by default. Example
PutTelemetryRecords
requests: