Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/awsxrayexporter]: Add support to string resource attributes #17503

Merged
merged 6 commits into from
Jan 12, 2023

Conversation

rapphil
Copy link
Contributor

@rapphil rapphil commented Jan 10, 2023

Signed-off-by: Raphael Silva [email protected]

Description:
Allow string resource attributes to be used in some resource attributes of type slice in the awsxray exporter so that it is possible to set them using the OTEL_RESOURCE_ATTRIBUTES environment variable.

This is a major source of pain among users since it is not possible to set slice resource attributes using OTEL_RESOURCE_ATTRIBUTES open-telemetry/opentelemetry-specification#2857

Testing: Updated unit tests.

Allow string resource attributes to be used in some resource attributes
of the awsxray exporter.

Signed-off-by: Raphael Silva <[email protected]>
@runforesight
Copy link

runforesight bot commented Jan 10, 2023

Foresight Summary

    
Major Impacts

build-and-test-windows duration(4 seconds) has decreased 44 minutes 20 seconds compared to main branch avg(44 minutes 24 seconds).
View More Details

⭕  build-and-test-windows workflow has finished in 4 seconds (44 minutes 20 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
windows-unittest-matrix -     🔗  N/A See Details
windows-unittest -     🔗  N/A See Details

✅  tracegen workflow has finished in 2 minutes 5 seconds (1 minute 5 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
build-dev -     🔗  N/A See Details
publish-latest -     🔗  N/A See Details
publish-stable -     🔗  N/A See Details

✅  changelog workflow has finished in 2 minutes 9 seconds (7 minutes 19 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
changelog -     🔗  N/A See Details

✅  prometheus-compliance-tests workflow has finished in 3 minutes 43 seconds (5 minutes 11 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
prometheus-compliance-tests -     🔗  ✅ 21  ❌ 0  ⏭ 0    🔗 See Details

✅  check-links workflow has finished in 5 minutes 53 seconds (⚠️ 3 minutes 7 seconds more than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
changed files -     🔗  N/A See Details
check-links -     🔗  N/A See Details

✅  build-and-test workflow has finished in 39 minutes 31 seconds (10 minutes 4 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
unittest-matrix (1.19, internal) -     🔗  ✅ 618  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, extension) -     🔗  ✅ 528  ❌ 0  ⏭ 0    🔗 See Details
correctness-metrics -     🔗  ✅ 2  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, internal) -     🔗  ✅ 618  ❌ 0  ⏭ 0    🔗 See Details
correctness-traces -     🔗  ✅ 17  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, processor) -     🔗  ✅ 1481  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, processor) -     🔗  ✅ 1481  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, extension) -     🔗  ✅ 528  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, receiver-0) -     🔗  ✅ 2565  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, receiver-0) -     🔗  ✅ 2565  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, exporter) -     🔗  ✅ 2465  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, exporter) -     🔗  ✅ 2465  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, receiver-1) -     🔗  ✅ 1883  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, receiver-1) -     🔗  ✅ 1883  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.19, other) -     🔗  ✅ 4429  ❌ 0  ⏭ 0    🔗 See Details
unittest-matrix (1.18, other) -     🔗  ✅ 4429  ❌ 0  ⏭ 0    🔗 See Details
integration-tests -     🔗  ✅ 55  ❌ 0  ⏭ 0    🔗 See Details
setup-environment -     🔗  N/A See Details
checks -     🔗  N/A See Details
check-collector-module-version -     🔗  N/A See Details
lint-matrix (receiver-0) -     🔗  N/A See Details
lint-matrix (receiver-1) -     🔗  N/A See Details
lint-matrix (exporter) -     🔗  N/A See Details
lint-matrix (processor) -     🔗  N/A See Details
lint-matrix (extension) -     🔗  N/A See Details
lint-matrix (internal) -     🔗  N/A See Details
lint-matrix (other) -     🔗  N/A See Details
check-codeowners -     🔗  N/A See Details
build-examples -     🔗  N/A See Details
lint -     🔗  N/A See Details
unittest (1.19) -     🔗  N/A See Details
unittest (1.18) -     🔗  N/A See Details
cross-compile (darwin, amd64) -     🔗  N/A See Details
cross-compile (darwin, arm64) -     🔗  N/A See Details
cross-compile (linux, 386) -     🔗  N/A See Details
cross-compile (linux, amd64) -     🔗  N/A See Details
cross-compile (linux, arm) -     🔗  N/A See Details
cross-compile (linux, arm64) -     🔗  N/A See Details
cross-compile (linux, ppc64le) -     🔗  N/A See Details
cross-compile (windows, 386) -     🔗  N/A See Details
cross-compile (windows, amd64) -     🔗  N/A See Details
build-package (deb) -     🔗  N/A See Details
build-package (rpm) -     🔗  N/A See Details
windows-msi -     🔗  N/A See Details
publish-check -     🔗  N/A See Details
publish-stable -     🔗  N/A See Details
publish-dev -     🔗  N/A See Details

✅  load-tests workflow has finished in 10 minutes 54 seconds (5 minutes 10 seconds less than main branch avg.) and finished at 11th Jan, 2023.


Job Failed Steps Tests
loadtest (TestTraceAttributesProcessor) -     🔗  ✅ 3  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestIdleMode) -     🔗  ✅ 1  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestMetric10kDPS|TestMetricsFromFile) -     🔗  ✅ 6  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestTraceNoBackend10kSPS|TestTrace1kSPSWithAttrs) -     🔗  ✅ 8  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestMetricResourceProcessor|TestTrace10kSPS) -     🔗  ✅ 12  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestTraceBallast1kSPSWithAttrs|TestTraceBallast1kSPSAddAttrs) -     🔗  ✅ 10  ❌ 0  ⏭ 0    🔗 See Details
loadtest (TestBallastMemory|TestLog10kDPS) -     🔗  ✅ 19  ❌ 0  ⏭ 0    🔗 See Details
setup-environment -     🔗  N/A See Details

🔎 See details on Foresight

*You can configure Foresight comments in your organization settings page.

Signed-off-by: Raphael Silva <[email protected]>
@rapphil rapphil marked this pull request as ready for review January 10, 2023 19:09
@rapphil rapphil requested review from a team and djaglowski January 10, 2023 19:09
Copy link
Contributor

@willarmiros willarmiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! We should definitely update the README as well, since we recently added the configuration for this attribute. We should clarify the behavior of setting the Env var + config, and explain when it is appropriate to use one vs. the other.

return s
}

return v.Slice()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, what does this do if v is not of type String or Slice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will have the current behavior, which is to return nil if the type is not Slice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that may be problematic as using nil pdata.Slice values can panic.

// Slice returns the slice value associated with this Value.
// If the Type() is not ValueTypeSlice then returns an invalid slice. Note that using
// such slice can cause panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum.. can we return an empty pdata.Slice?
Resource attributes can be of multiple different types. I think all the code that rely on resource attributes will suffer with this. Is there any recommendation? Like do strict type validation when consuming resource attributes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think returning pcommon.NewSlice() in the case that the value is neither a slice nor a string would be fine.

@rapphil
Copy link
Contributor Author

rapphil commented Jan 10, 2023

This is great! We should definitely update the README as well, since we recently added the configuration for this attribute. We should clarify the behavior of setting the Env var + config, and explain when it is appropriate to use one vs. the other.

Good call. I will update the README and define the behavior.

Signed-off-by: Raphael Silva <[email protected]>
@rapphil rapphil force-pushed the awsxray-support-string-attrs branch from c4f57f8 to 10c4465 Compare January 10, 2023 19:50
@rapphil rapphil requested review from willarmiros and removed request for djaglowski January 10, 2023 20:47
exporter/awsxrayexporter/README.md Outdated Show resolved Hide resolved
exporter/awsxrayexporter/README.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants