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

chore: added tracing also for authz remote #1056

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

omerlh
Copy link
Contributor

@omerlh omerlh commented Jan 30, 2023

Related issue(s)

Basically follow #995 just for authorizers

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@omerlh omerlh requested a review from aeneasr as a code owner January 30, 2023 10:49
@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Merging #1056 (7cb06f8) into master (daa2994) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1056   +/-   ##
=======================================
  Coverage   77.79%   77.79%           
=======================================
  Files          81       81           
  Lines        3967     3967           
=======================================
  Hits         3086     3086           
  Misses        600      600           
  Partials      281      281           
Impacted Files Coverage Δ
driver/registry_memory.go 90.49% <100.00%> (ø)
pipeline/authz/remote.go 71.95% <100.00%> (ø)
pipeline/authz/remote_json.go 88.05% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

aeneasr
aeneasr previously approved these changes Feb 6, 2023
@aeneasr aeneasr requested a review from alnr February 6, 2023 16:47
@alnr
Copy link
Collaborator

alnr commented Feb 7, 2023

Hi @omerlh, thanks for the PR! We've recently done some work to move Oathkeeper's instrumentation from OpenTracing to OpenTelemetry (#1047, #1050). Your change uses the (obsoletex.TraceRequest) function. Sorry, we haven't gotten around to remove it yet.

Would you mind changing your PR to instead inject the tracer into the authorizer's constructor instead?

Something like this:

// NewAuthorizerRemote creates a new AuthorizerRemote.
func NewAuthorizerRemote(c configuration.Provider, d interface{ Tracer() trace.Tracer }) *AuthorizerRemote {
	return &AuthorizerRemote{
		c:      c,
		client: httpx.NewResilientClient(httpx.ResilientClientWithTracer(d.Tracer())).StandardClient(),
		t:      x.NewTemplate("remote"),
	}
}

And change the call sites to something like

			a := NewAuthorizerRemote(p, otelx.NewNoop(l, p.TracingConfig()))

for tests and

			authz.NewAuthorizerRemote(r.c, r),

in registry_memory.go

Thanks for your contribution!

@omerlh
Copy link
Contributor Author

omerlh commented Feb 7, 2023

Yeah sure, just pushed a fix

@alnr
Copy link
Collaborator

alnr commented Feb 7, 2023

Thank you! Seems like you missed a spot. Also kindly run make format 👍

@omerlh omerlh force-pushed the chore/tracing-authz-remote branch 3 times, most recently from 70a57e9 to c65421c Compare February 7, 2023 16:33
@omerlh
Copy link
Contributor Author

omerlh commented Feb 7, 2023

Yes, sorry! Fixed all the issues I think. Waiting for the tests 🙏

@omerlh
Copy link
Contributor Author

omerlh commented Feb 7, 2023

Any pointer on how I can solve the testing error? I have no idea why it is happening

@alnr
Copy link
Collaborator

alnr commented Feb 7, 2023

In driver/registry_memory_test.go, you need

			c, err := configuration.NewKoanfProvider(context.Background(), nil, logrusx.New("", ""))
			require.NoError(t, err)
			r := NewRegistry(c)

instead of

r := NewRegistryMemory()

(two occurences)

@omerlh
Copy link
Contributor Author

omerlh commented Feb 8, 2023

Thanks! That fixed it :)

@omerlh omerlh force-pushed the chore/tracing-authz-remote branch from 6a68e82 to 7cb06f8 Compare February 8, 2023 05:29
@aeneasr aeneasr merged commit 7e7d45e into ory:master Feb 8, 2023
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