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

Collect WebLogic specific attributes #81

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

agoallikmaa
Copy link
Contributor

This adds collection of WebLogic-specific attributes to servlet spans, and also provides middleware name and version through MiddlewareHolder.

Sample output from the logging collector:

Attributes:
     -> middleware.name: STRING(WebLogic Server)
     -> middleware.version: STRING(12.2.1.4.0)
     -> middleware.weblogic.server: STRING(admin-server)
     -> middleware.weblogic.application: STRING(weblogic)
     -> middleware.weblogic.domain: STRING(domain1)

No spans are created at WebLogic instrumentation level (no custom logic required), so this adds an instrumentation that only collects the attribute values, stores them as a map into otel.middleware ServletRequest attribute. The map contents are copied over to the span in another instrumentation where the servlet span is currently active.

WebLogic classes are not published as a public dependency, therefore its classes are accessed with Class.forName and MethodHandle instead of compiling against its classes directly. These are resolved by WebLogicEntity during its static initialization, which also provides wrapper classes for WebLogic classes. As an optimization, the full set of attributes is not collected on every request, but they are cached to a servlet context attribute.

@@ -54,15 +57,29 @@ public void webLogicSmokeTest(String imageName) throws IOException, InterruptedE
// FIXME: APMI-1300
// assertServerHandler(....)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can replace this FIXME with just a comment, that there aren't any server handlers for weblogic because of APMI-1300.

WebLogicEntity.Request request = WebLogicEntity.Request.wrap(servletRequest);

Map<?, ?> attributes = fetchMiddlewareAttributes(request.getContext());
request.instance.setAttribute(REQUEST_ATTRIBUTE_NAME, attributes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering: have you considered adding a field to MiddlewareHolder and storing those attributes there instead of the request?

Choose a reason for hiding this comment

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

The server and application fields may have different values in a single JVM, so the current static field approach MiddlewareHolder would not work there.

@vovencij vovencij merged commit 49fc1cc into signalfx:main Jan 26, 2021
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.

5 participants