Skip to content

Add javaagent config with filter jars#47

Merged
shashank11p merged 3 commits intomainfrom
addJavaAgentConfig
Feb 10, 2021
Merged

Add javaagent config with filter jars#47
shashank11p merged 3 commits intomainfrom
addJavaAgentConfig

Conversation

@shashank11p
Copy link
Copy Markdown
Contributor

No description provided.

@jcchavezs
Copy link
Copy Markdown
Contributor

jcchavezs commented Feb 5, 2021 via email

Comment thread config.proto Outdated
// JavaAgent has the configs specific to javaagent
message JavaAgent {
// opa_evaluator_jar_path is the path to opa evaluator jar
google.protobuf.StringValue opa_evaluator_jar_path = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@davexroth maybe this should be a list?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

yep, it should be a list.

Also, it should be generic for any jar which implements the filter interface. Maybe rename to something like filter_jar_path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this is a list we should clarify whether ordering is important, if all of them happen serial and if the result of one affect the others.

Copy link
Copy Markdown
Contributor Author

@shashank11p shashank11p Feb 8, 2021

Choose a reason for hiding this comment

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

This list will be used to load jars that implement filter interface, and it does not matter which order they are given. They will all be loaded and checked for blocking.. As per current logic in HT javaagent, If any one of the filter implementations returns true to block, the call will be blocked.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is a list we should clarify whether ordering is important, if all of them happen serial and if the result of one affect the others.

+1

the semantics is as follows: block the request if any of the evaluators return true.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that said the filters do not mutate state between each other, they should be totally independent.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

filters can add attributes right? I think it makes sense to define the order in which the filters run as the order they are defined here.

This would allow one fitter to add an attribute, and subsequent filters to change behavior based on those previously set attributes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would allow one fitter to add an attribute, and subsequent filters to change behavior based on those previously set attributes.

The ordering is tricky since we use Java service loader to load filter provider implementations. The service loader does not guarantee the ordering. Though, we could work around it by creating a new classloader per filter jar.

I am not sure if we want to introduce coupling between filters, the other issue is that there is no read API on the span for attributes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 on having decoupled filters. Passing it in a config file sounds very fragile and not explicit. Could you elaborate on the exact use case @davexroth? Has other alternatives (like composing filters) being analyzed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's move this forward without explicit ordering. Ordering can be added later once we know why and how. Ordering won't be backwards incompatible.

@shashank11p
Copy link
Copy Markdown
Contributor Author

shashank11p commented Feb 8, 2021

Does it make sense to point a reference implementation for such opa evaluator? Like us there any examples out there? Otherwise LGTM

Here is an implementation of the filter interface and an evaluator.
https://github.com/Traceableai/libopa/pull/30

@shashank11p shashank11p marked this pull request as ready for review February 8, 2021 09:28
Comment thread config.proto Outdated
@pavolloffay pavolloffay changed the title Adding javaagent config Add javaagent config with filter jars Feb 9, 2021
@shashank11p shashank11p merged commit f950aa5 into main Feb 10, 2021
@shashank11p shashank11p deleted the addJavaAgentConfig branch February 10, 2021 16:48
Comment thread config.proto

// JavaAgent has the configs specific to javaagent
message JavaAgent {
// filter_jar_paths is the list of path to filter jars, separated by `,`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

separated by , is a env var detail so I would remove it.

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.

4 participants