-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Pass OpenTelemetry to SystemAccessControl #18899
Conversation
core/trino-main/src/main/java/io/trino/security/AccessControlManager.java
Outdated
Show resolved
Hide resolved
|
||
interface SystemAccessControlContext | ||
{ | ||
OpenTelemetry getOpenTelemetry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need an instance of OpenTelemetry? Generally, all you need is a properly configured Tracer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see how access control needs would be different than those of a connector. I followed ConnectorContext
where @electrum added both
trino/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorContext.java
Lines 31 to 39 in bda3510
default OpenTelemetry getOpenTelemetry() | |
{ | |
throw new UnsupportedOperationException(); | |
} | |
default Tracer getTracer() | |
{ | |
throw new UnsupportedOperationException(); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any authoritative docs or code comments, thus may be drawing wrong conclusions, but both are expected here
https://github.com/airlift/airlift/blob/c55517863fe246f8921b0a03034b0e2f0d7a31c9/http-client/src/main/java/io/airlift/http/client/HttpClientModule.java#L121-L131
and both are later used, if provided.
This is necessary for SystemAccessControl implementation to participate in tracing. Useful when the implementation does e.g. network communication when performing access control.
332e0bc
to
23d59aa
Compare
{ | ||
return new SystemAccessControlContext() | ||
{ | ||
private final Tracer tracer = openTelemetry.getTracer("trino.system-access-control." + systemAccessControlName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: verify that systemAccessControlName is not empty or null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is verified by the caller within the class and the method is private
also, empty string is currently valid factory name :)
This is necessary for SystemAccessControl implementation to participate in tracing. Useful when the implementation does e.g. network communication when performing access control.