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

Added initial commit of camunda instrumentation #12830

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

cb645j
Copy link

@cb645j cb645j commented Dec 3, 2024

related to issue #12122

Copy link

linux-foundation-easycla bot commented Dec 3, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@cb645j cb645j marked this pull request as ready for review December 3, 2024 21:02
@cb645j cb645j requested a review from a team as a code owner December 3, 2024 21:02
@cb645j
Copy link
Author

cb645j commented Dec 3, 2024

@robododge

@cb645j
Copy link
Author

cb645j commented Dec 4, 2024

@laurit can you please review this

@laurit
Copy link
Contributor

laurit commented Dec 5, 2024

@laurit can you please review this

There are no tests. You didn't add your module to settings.gradle.kts so it is unknown whether it compiles.

@robododge
Copy link
Contributor

Thanks @cb645j for starting this submission. Yes @laurit is correct, this needs to be integrated with settings.gradle and the full test suite.

A few questions.

There a lot of files in this PR, I counted 7 distinct TypeInstrumentations for the following Camunda classes:

  1. org.camunda.bpm.engine.impl.bpmn.behavior.CallableElementActivityBehavior
  2. org.camunda.bpm.engine.impl.bpmn.behavior.TerminateEndEventActivityBehavior
  3. org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior
  4. org.camunda.bpm.engine.impl.bpmn.behavior.TaskActivityBehavior
  5. org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler
  6. org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder
  7. org.camunda.bpm.client.topic.impl.TopicSubscriptionManager

First question: Can you merge the instrumentation for the like-components?... I.e. All the "Behavior" components go through a single TypeInstrumentation?

Second question: What about the version, does this handle only Camunda 7? or does this handle camunda 7 and greater? What version is targeted?

Thanks

@cb645j
Copy link
Author

cb645j commented Dec 5, 2024

Thanks @cb645j for starting this submission. Yes @laurit is correct, this needs to be integrated with settings.gradle and the full test suite.

A few questions.

There a lot of files in this PR, I counted 7 distinct TypeInstrumentations for the following Camunda classes:

1. org.camunda.bpm.engine.impl.bpmn.behavior.CallableElementActivityBehavior

2. org.camunda.bpm.engine.impl.bpmn.behavior.TerminateEndEventActivityBehavior

3. org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior

4. org.camunda.bpm.engine.impl.bpmn.behavior.TaskActivityBehavior

5. org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler

6. org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder

7. org.camunda.bpm.client.topic.impl.TopicSubscriptionManager

First question: Can you merge the instrumentation for the like-components?... I.e. All the "Behavior" components go through a single TypeInstrumentation?

Second question: What about the version, does this handle only Camunda 7? or does this handle camunda 7 and greater? What version is targeted?

Thanks

Thanks Steve. I think I can probably merge a few of those typeinstrumentations into single classes, i will take a look! Yes, i tested with versions 7 and 8 but I believe it should handle anything above 7 as I did not see anything in later versions that would break so i left the max version undefined in the settings muzzle.pass, I think thats what your suppose to do when it supports version x and above? Camunda noticed that will no longer support versions 6 and under so I did not worry about those ones.

@cb645j
Copy link
Author

cb645j commented Dec 5, 2024

@laurit can you please review this

There are no tests. You didn't add your module to settings.gradle.kts so it is unknown whether it compiles.

Opps, I add it as a module but forgot to check that file in, ill update.. Ill work on adding unit test. thanks

@robododge
Copy link
Contributor

Thanks Steve. I think I can probably merge a few of those typeinstrumentations into single classes, i will take a look! Yes, i tested with versions 7 and 8 but I believe it should handle anything above 7 as I did not see anything in later versions that would break so i left the max version undefined in the settings muzzle.pass, I think thats what your suppose to do when it supports version x and above? Camunda noticed that will no longer support versions 6 and under so I did not worry about those ones.

@cb645j Cory, that v7 and above support is great.

Recommendation 1: versioning: I'd recommend moving everything into directory that states "camunda-7", which covers all of 7 and possibly 8 if the right classes. This version 7, 8 support can be is enforced in the override of the classLoaderMatcher() method of InstrumentationModule, you want to choose a class that is really unique to version 7 at least. Also, you muzzle config will want to drop back down to the 7.0 or the lowest level of version 7 you aim to support.

Recommendation 2: folder structure: I'd recommend restructurctuing the entire thing to adhere to the Folder Structure Style Guide. where you have 3 main directories, javaagent, library and testing directories.

Recommendation 3: testing:
Also, maybe you want to take a look at the Contibuting.md, especially the sections regarding testing. You want the classes that kick off your instrumentation in the format that the Opentelemetry-Java-Instrumentation project expects, this means having a *Tracing and *TracingBuilder entry point. Detailed Testing section.

@laurit
Copy link
Contributor

laurit commented Dec 6, 2024

Recommendation 2: folder structure: I'd recommend restructurctuing the entire thing to adhere to the Folder Structure Style Guide. where you have 3 main directories, javaagent, library and testing directories.

This only makes sense if you are going to have both library and agent instrumentations. If you are going to have only the javaagent instrumentation only that module is enough. No need to have a separate testing module.

Recommendation 3: testing: Also, maybe you want to take a look at the Contibuting.md, especially the sections regarding testing. You want the classes that kick off your instrumentation in the format that the Opentelemetry-Java-Instrumentation project expects, this means having a *Tracing and *TracingBuilder entry point. Detailed Testing section.

Again if you are going to have only the agent instrumentation then you don't really need to create abstract test classes that have only 1 implementaion.

@robododge
Copy link
Contributor

Thanks @laurit for clearing up the Library vs Agent instrumentation. I was assuming that the rule was you need to create both as that was what I was required to do for Jetty-Httpclient-9.2. So, now, if we don't feel the necessity for a Library-based instrumentation, then we can choose to simply implement Javagent only?

Thanks

@robododge
Copy link
Contributor

So, now, if we don't feel the necessity for a Library-based instrumentation, then we can choose to simply implement Javagent only?

I took another look at the Writing Instumentation doc. It seems the rule of thumb is if you have target classes that can support Library-style instrumentation, then you should provide the library feature as an option.

@laurit
Copy link
Contributor

laurit commented Dec 7, 2024

Thanks @laurit for clearing up the Library vs Agent instrumentation. I was assuming that the rule was you need to create both as that was what I was required to do for Jetty-Httpclient-9.2. So, now, if we don't feel the necessity for a Library-based instrumentation, then we can choose to simply implement Javagent only?

Thanks

If a library instrumentation can be built we definitely would like to have one, but it is not always possible to write one.

@grandemtn
Copy link

Thank you for working on this! This will be a great help to many of my projects as we use SpringBoot and Camunda 7 extensively. Recently we have started integrating with Datadog.

Request: can you include the businessKey in the CamundaCommonRequest and code that populates it? That would help us identify the traces/spans.
Ideally there's another variable in our executions that identifies the global transaction id that would be wonderful to have on the spans as well, but it's specific to our implementation. Could you provide a config value with the name of the execution variable to include as well? Or some way to pull another variable out of the execution and include it in the span attributes?

I am new to OpenTelemetry, Observability and Instrumentation in general. I have quite a lot of experience with Java, Spring and Camunda. If there is something I could to do help with this, please let me know!

@cb645j
Copy link
Author

cb645j commented Dec 11, 2024

Thank you for working on this! This will be a great help to many of my projects as we use SpringBoot and Camunda 7 extensively. Recently we have started integrating with Datadog.

Request: can you include the businessKey in the CamundaCommonRequest and code that populates it? That would help us identify the traces/spans. Ideally there's another variable in our executions that identifies the global transaction id that would be wonderful to have on the spans as well, but it's specific to our implementation. Could you provide a config value with the name of the execution variable to include as well? Or some way to pull another variable out of the execution and include it in the span attributes?

I am new to OpenTelemetry, Observability and Instrumentation in general. I have quite a lot of experience with Java, Spring and Camunda. If there is something I could to do help with this, please let me know!

Yes, I should be able to add the businesskey. As far as implementation specific variables, i did plan to add something exactly as your describing - the ability for the user to identify additional execution variables they want to be captured (via a comma separated config property), however I plan to make this change as a separate enhancement after I get this PR merged. I would like to just get this basic implementation in before making additional enhancements, but i can add the businesskey as part of this PR since that is a global camunda property and will be easy to do.

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