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

Add support for XXL-JOB #10421

Merged
merged 16 commits into from
Mar 12, 2024
Merged

Add support for XXL-JOB #10421

merged 16 commits into from
Mar 12, 2024

Conversation

steverao
Copy link
Contributor

@steverao steverao commented Feb 6, 2024

Resolves #8084

@steverao steverao requested a review from a team as a code owner February 6, 2024 12:42
@steverao steverao changed the title Added support for XXL-JOB. Added support for XXL-JOB Feb 6, 2024
2. Found there is a bug in setting span status in 2.3.0+, so added a new module of xxl-job-2.3.0 to solve it.
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Feb 24, 2024
@steverao steverao mentioned this pull request Feb 25, 2024
@laurit laurit removed the test native This label can be applied to PRs to trigger them to run native tests label Feb 26, 2024
@laurit
Copy link
Contributor

laurit commented Feb 26, 2024

closing and reopening to trigger checks

@laurit laurit closed this Feb 26, 2024
@laurit laurit reopened this Feb 26, 2024
@steverao steverao requested a review from laurit February 29, 2024 10:01
laurit and others added 2 commits March 1, 2024 22:29
* Rework xxl job instrumentation

* simplify
@steverao steverao changed the title Added support for XXL-JOB Add support for XXL-JOB Mar 1, 2024
public String extract(XxlJobProcessRequest request) {
GlueTypeEnum glueType = request.getGlueType();
if (SCRIPT_JOB_TYPE.contains(glueType.getDesc())) {
return glueType.getDesc() + ".ID-" + request.getJobId();
Copy link
Contributor

Choose a reason for hiding this comment

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

span names like GLUE(Shell).ID-2 don't follow general span naming guidelines outlined in https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/trace/api.md#span the id portion should be removed from the span name.
GLUE(Shell) feels a bit weird to me, but looking at the xxl-job doc I get the feeling that this is what the xxl-job ui displays. If that is the case then I think it is fine to keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

span names like GLUE(Shell).ID-2 don't follow general span naming guidelines outlined in https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/trace/api.md#span the id portion should be removed from the span name. GLUE(Shell) feels a bit weird to me, but looking at the xxl-job doc I get the feeling that this is what the xxl-job ui displays. If that is the case then I think it is fine to keep it.

It backs to discussion above. If we remove the id portion from spanName, it will cause no way to distinguish specific GLUE(Shell) job in system. Such as there are three Shell jobs, their jobIds are 1,2,3. Without jobId in spanName, they are same spanName in APM. it's hard for user to troubleshooting.

Copy link
Contributor

Choose a reason for hiding this comment

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

@trask could you provide guidance on this. Should the job id be added to the span name (I guess it doesn't have a particularly high cardinality so perhaps a bit similar to http.route) or added as an attribute to to the span?

Copy link
Member

Choose a reason for hiding this comment

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

@steverao can you help us understand the Job ID a bit better?

a couple of questions in particular,

  • how does a user correspond a Job ID back to their workflow?
  • is the Job ID stable, meaning a given workflow will always have the same job ID? or can a given workflow's job ID sometimes change over time?

Copy link
Contributor Author

@steverao steverao Mar 8, 2024

Choose a reason for hiding this comment

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

@steverao can you help us understand the Job ID a bit better?

a couple of questions in particular,

  • how does a user correspond a Job ID back to their workflow?
  • is the Job ID stable, meaning a given workflow will always have the same job ID? or can a given workflow's job ID sometimes change over time?

Sure, answers to related questions are as follows:

  1. The job ID is generated by job system, when users create a job in xxl-job console, it will have a unique ID. Users can find their job by job ID in console, just like picture below:
    image
  2. Yes, the Job ID is unique, it's a unique key to store job content in the system database. it can't be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it possible to use the "Job description" instead of the "Job ID"? that looks more similar to existing span names for other instrumentations

I think the "Job description" is not good choose, because it has no restrictions on the input values, so jobs of the same type may have the same description.

Copy link
Member

Choose a reason for hiding this comment

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

jobs of the same type may have the same description

is this common?

we could still capture job id as a span attribute (just doesn't seem to be the best span name, since span name is ideally more human readable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this common?

yes

we could still capture job id as a span attribute (just doesn't seem to be the best span name, since span name is ideally more human readable)

ok, I understand it, but I have an alternative span name GLUE(Shell).{jobId}, then we can add the relevant jobId to a non ExperimentalAttributeExtractor for script job. It's will be more friendly to users to find jobId in attribute. What do you think of this? @trask @laurit

Copy link
Member

Choose a reason for hiding this comment

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

(sorry I haven't read the code) is the Job ID only included in span name for "GLUE" type jobs? what does the span name look like for other jobs? thanks

Copy link
Contributor Author

@steverao steverao Mar 12, 2024

Choose a reason for hiding this comment

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

(sorry I haven't read the code) is the Job ID only included in span name for "GLUE" type jobs? what does the span name look like for other jobs? thanks

In fact, the Job Id just be used in script job, such as Shell or Python script, they may not have method name. you can refer to #10421 (comment). Other jobs type are designed for java, so I can get their className and methodName, I use className.methodName as span name. They look like CustomizedGroovyHandler.execute. You can see more cases in relevant test code:) https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/10421/files#diff-46bda3c71cf5f790cba801eca4373fa35faebeebace4431b64c82695277a96a9
I communicated with @laurit today, considering the community release plan, we first use GLUE(Shell) as span name and set a jobId in experimental attribute for script job in 2.2.0, I will restart a subsequent PR to discuss a better span name later.

@laurit laurit added this to the v2.2.0 milestone Mar 6, 2024
@steverao steverao requested review from laurit and trask March 11, 2024 12:25
@trask trask merged commit 86c3263 into open-telemetry:main Mar 12, 2024
49 checks passed
@steverao steverao deleted the main-xxljob branch March 13, 2024 11:54
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.

Instrumentation for xxl-job
3 participants