Skip to content

Conversation

pnowojski
Copy link
Contributor

What is the purpose of the change

https://cwiki.apache.org/confluence/display/FLINK/FLIP-483%3A+Add+support+for+children+Spans

Brief change log

Please check individual commit messages.

Verifying this change

Adds a couple of unit tests and extends the existing ITCase

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@pnowojski pnowojski changed the title FLIP-483: Add support for children Spans [FLINK-38353][spans] FLIP-483: Add support for children Spans Sep 12, 2025
@flinkbot
Copy link
Collaborator

flinkbot commented Sep 12, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

.defaultValue(CheckpointSpanDetailLevel.SPANS_PER_CHECKPOINT)
.withDescription(
"Detail level for reporting checkpoint spans. Possible values:\n"
+ "- SPAN_PER_CHECKPOINT (default): Single span per checkpoint. Aggregated sum/max for submetrics from all tasks and subtasks per checkpoint\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ "- SPAN_PER_CHECKPOINT (default): Single span per checkpoint. Aggregated sum/max for submetrics from all tasks and subtasks per checkpoint\n"
+ "- SPANS_PER_CHECKPOINT (default): Single span per checkpoint. Aggregated sum/max for submetrics from all tasks and subtasks per checkpoint\n"

Same for a few more times across the description

Copy link
Contributor

Choose a reason for hiding this comment

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

@Efrat19 in the case of SPAN_PER_CHECKPOINT there is only one span so singular makes sense top me. The others could have multiple so are SPANS.

SPANS_PER_TASK will have a SPAN for each task plus one for the PARENT, so is a bit misleading. We could say
CHILDEN_SPANS_PER_TASK and CHILDEN_SPANS_PER_SUBTASK if we think this is clearer. WDYT @pnowojski ? I do not have strong views to change this, but thought I would bring it to your attention.

Copy link
Contributor Author

@pnowojski pnowojski Sep 17, 2025

Choose a reason for hiding this comment

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

Yeah, lets keep the first two singular other plural with CHILDREN_SPANS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also re-used constants to avoid problems with names getting out of sync.

// TODO: not yet supported
// for (Span childSpan : span.getChildren()) {
// notifyOfAddedSpanInternal(childSpan, currentOtelSpan);
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove comment? (code is identical to the loop below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has been removed?

@github-actions github-actions bot added the community-reviewed PR has been reviewed by the community. label Sep 14, 2025
@pnowojski pnowojski requested a review from Efrat19 September 17, 2025 13:10
Comment on lines 91 to 107
.withDescription(
String.format(
"Detail level for reporting checkpoint spans. Possible values:\n"
+ "- %s (default): Single span per checkpoint. Aggregated sum/max for submetrics from all tasks and subtasks per checkpoint\n"
+ "- %s: Single span per checkpoint. Same as %s, plus arrays of aggregated values per task.\n"
+ "- %s: Same as %s plus children spans per each task. Each task span with aggregated sum/max submetrics from subtasks.\n"
+ "- %s: Same as %s plus children spans per each subtask. Child spans for tasks and grand-child spans for subtasks.",
CheckpointSpanDetailLevel.SPAN_PER_CHECKPOINT.name(),
CheckpointSpanDetailLevel.SPAN_PER_CHECKPOINT_WITH_TASKS
.name(),
CheckpointSpanDetailLevel.SPAN_PER_CHECKPOINT.name(),
CheckpointSpanDetailLevel.CHILDREN_SPANS_PER_TASK
.name(),
CheckpointSpanDetailLevel.SPAN_PER_CHECKPOINT.name(),
CheckpointSpanDetailLevel.CHILDREN_SPANS_PER_SUBTASK
.name(),
CheckpointSpanDetailLevel.CHILDREN_SPANS_PER_TASK
Copy link
Contributor

@RocMarshal RocMarshal Sep 18, 2025

Choose a reason for hiding this comment

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

Could we use the APIs 'Description.builder().list() ... ' to construct the description ?
Such as PipelineOptions#SERIALIZATION_CONFIG...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer, I was not aware of that utility.

assertThat(reportedEvents.size()).isEqualTo(1);

Map<String, Object> expected = new HashMap<>();
expected.put("checkpointId", 42L);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this constants be extracted as immutable strings?

  • One advantage of doing so is that it avoids using them directly in multiple places.
  • Of course, such a change might come at the cost of some readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is worth here due to the sheer amount of the constants 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks.

Could this constants be extracted as immutable strings?

Just a trivial comment. Please ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-reviewed PR has been reviewed by the community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants