Skip to content

Add SAPM AccessTokenPassthrough #349

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

Merged
merged 2 commits into from
Jun 24, 2020
Merged

Add SAPM AccessTokenPassthrough #349

merged 2 commits into from
Jun 24, 2020

Conversation

rmfitzpatrick
Copy link
Contributor

Description: Adding the access_token_passthrough config option and functionality to SAPM receiver and exporter similar to that of the SignalFx metric receiver and exporter from f361e4d. These changes add a com.splunk.signalfx.access_token attribute with a value taken from X-Sf-Token headers, if provided, that will be used for subsequent trace submissions in the SAPM exporter by its client.

Testing: Added and modified unit tests and e2e run configuration.

Documentation: Updated relevant readmes.

@rmfitzpatrick rmfitzpatrick requested a review from a team June 22, 2020 20:21
@codecov
Copy link

codecov bot commented Jun 22, 2020

Codecov Report

Merging #349 into master will increase coverage by 0.36%.
The diff coverage is 95.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #349      +/-   ##
==========================================
+ Coverage   82.78%   83.15%   +0.36%     
==========================================
  Files         170      170              
  Lines        9070     9116      +46     
==========================================
+ Hits         7509     7580      +71     
+ Misses       1236     1217      -19     
+ Partials      325      319       -6     
Flag Coverage Δ
#integration 0.00% <ø> (ø)
#unit 83.15% <95.08%> (+0.36%) ⬆️
Impacted Files Coverage Δ
exporter/sapmexporter/config.go 100.00% <ø> (+54.54%) ⬆️
exporter/sapmexporter/exporter.go 88.88% <94.00%> (+53.17%) ⬆️
exporter/sapmexporter/factory.go 100.00% <100.00%> (+14.28%) ⬆️
receiver/sapmreceiver/trace_receiver.go 76.40% <100.00%> (+2.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a00790d...e76accf. Read the comment docs.

for i := 0; i < resourceSpans.Len(); i++ {
resourceSpan := resourceSpans.At(i)
if resourceSpan.IsNil() {
// Invalid trace so nothing to export
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about hits. @pjanotti do we need to export empty Span slice to make sure our metrics are correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be fine: we want the exported metrics to reflect the actual number of exported spans and since a nil span is not exported that is correct.

@rmfitzpatrick just double checking: this is just defensive programming, right? or did you encounter it in practice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines 73 to 76
// tracesByAccessToken takes a pdata.Traces struct and will iterate through its ResourceSpans' attributes,
// regrouping by any SFx access token label value if Config.AccessTokenPassthrough is enabled. It will drop any
// set token label in any case to prevent serialization.
// It returns a map of newly constructed pdata.Traces keyed by access token, defaulting to empty string.
Copy link
Member

Choose a reason for hiding this comment

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

👍

if err != nil {
return td.SpanCount(), consumererror.Permanent(err)
// tracesByAccessToken takes a pdata.Traces struct and will iterate through its ResourceSpans' attributes,
// regrouping by any SFx access token label value if Config.AccessTokenPassthrough is enabled. It will drop any
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// regrouping by any SFx access token label value if Config.AccessTokenPassthrough is enabled. It will drop any
// regrouping by any SFx access token label value if Config.AccessTokenPassthrough is enabled. It will delete any

continue
}

exportErr := se.client.ExportWithAccessToken(ctx, batches, accessToken)
Copy link
Member

Choose a reason for hiding this comment

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

If accessToken is "" is the default access token used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tigrannajaryan
Copy link
Member

@rmfitzpatrick please resolve the conflicts.

@rmfitzpatrick
Copy link
Contributor Author

@rmfitzpatrick please resolve the conflicts.

Done

@tigrannajaryan tigrannajaryan merged commit c2c6e22 into open-telemetry:master Jun 24, 2020
@rmfitzpatrick rmfitzpatrick deleted the sapm_token_passthrough branch June 24, 2020 19:33
wyTrivail referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 13, 2020
Adding the `access_token_passthrough` config option and functionality to SAPM receiver and exporter similar to that of the SignalFx metric receiver and exporter from f361e4d.  These changes add a `com.splunk.signalfx.access_token` attribute with a value taken from `X-Sf-Token` headers, if provided, that will be used for subsequent trace submissions in the SAPM exporter by its client.

**Testing:** Added and modified unit tests and e2e run configuration.

**Documentation:** Updated relevant readmes.
mxiamxia referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 22, 2020
* Bump Jaeger version, refactor jaegerreceiver and healthcheck

Signed-off-by: Annanay <[email protected]>

* Run gofmt

Signed-off-by: Annanay <[email protected]>

* Fix goimports error

Signed-off-by: Annanay <[email protected]>

* Fix healthcheck tests, refactor code

Signed-off-by: Annanay <[email protected]>

* Fix healthcheck

Signed-off-by: Annanay <[email protected]>

* Address review comments

Signed-off-by: Annanay <[email protected]>
ljmsc referenced this pull request in ljmsc/opentelemetry-collector-contrib Feb 21, 2022
* Remove AddLink & Link from Span Interface

I have remove AddLink and Link from the interface and all it refereneces and replaced AddLink with addlink, Also Removed respective unit tests

Signed-off-by: vineeth <[email protected]>

* removing the unused code from unit tests

Signed-off-by: VineethReddy02 <[email protected]>
codeboten added a commit that referenced this pull request Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants