Skip to content

Commit 94b2968

Browse files
committed
[FLINK-38353][docs] Update docs for children spans
1 parent 20eebe9 commit 94b2968

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

docs/content.zh/docs/ops/traces.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,30 @@ Flink exposes a tracing system that allows gathering and exposing traces to exte
3333
## Reporting traces
3434

3535
You can access the tracing system from any user function that extends [RichFunction]({{< ref "docs/dev/datastream/user_defined_functions" >}}#rich-functions) by calling `getRuntimeContext().getMetricGroup()`.
36-
This method returns a `MetricGroup` object via which you can report a new single span trace.
36+
This method returns a `MetricGroup` object via which you can report a new single trace with tree of spans.
3737

3838
### Reporting single Span
3939

4040

4141
A `Span` represents some process that happened in Flink at certain point of time for a certain duration, that will be reported to a `TraceReporter`.
4242
To report a `Span` you can use the `MetricGroup#addSpan(SpanBuilder)` method.
4343

44-
Currently, we don't support traces with multiple spans. Each `Span` is self-contained and represents things like a checkpoint or recovery.
44+
Currently, we support traces with a single tree of spans, but all the children spans have to be reported all at once in one `MetricGroup#addSpan` call.
45+
You can not report child or parent spans independently.
4546
{{< tabs "9612d275-bdda-4322-a01f-ae6da805e917" >}}
4647
{{< tab "Java" >}}
4748
```java
4849
public class MyClass {
4950
void doSomething() {
5051
// (...)
5152
metricGroup.addSpan(
52-
Span.builder(MyClass.class, "SomeAction")
53-
.setStartTsMillis(startTs) // Optional
54-
.setEndTsMillis(endTs) // Optional
55-
.setAttribute("foo", "bar");
53+
Span.builder(MyClass.class, "SomeAction")
54+
.setStartTsMillis(startTs) // Optional
55+
.setEndTsMillis(endTs) // Optional
56+
.setAttribute("foo", "bar") // Optional
57+
.addChild(Span.builder(MyClass.class, "ChildAction") // Optional
58+
.addChildren(List.of(
59+
Span.builder(MyClass.class, "AnotherChildAction")); // Optional
5660
}
5761
}
5862
```

docs/content/docs/ops/traces.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,30 @@ Flink exposes a tracing system that allows gathering and exposing traces to exte
3333
## Reporting traces
3434

3535
You can access the tracing system from any user function that extends [RichFunction]({{< ref "docs/dev/datastream/user_defined_functions" >}}#rich-functions) by calling `getRuntimeContext().getMetricGroup()`.
36-
This method returns a `MetricGroup` object via which you can report a new single span trace.
36+
This method returns a `MetricGroup` object via which you can report a new single trace with tree of spans.
3737

3838
### Reporting single Span
3939

4040

4141
A `Span` represents some process that happened in Flink at certain point of time for a certain duration, that will be reported to a `TraceReporter`.
4242
To report a `Span` you can use the `MetricGroup#addSpan(SpanBuilder)` method.
4343

44-
Currently, we don't support traces with multiple spans. Each `Span` is self-contained and represents things like a checkpoint or recovery.
44+
Currently, we support traces with a single tree of spans, but all the children spans have to be reported all at once in one `MetricGroup#addSpan` call.
45+
You can not report child or parent spans independently.
4546
{{< tabs "9612d275-bdda-4322-a01f-ae6da805e917" >}}
4647
{{< tab "Java" >}}
4748
```java
4849
public class MyClass {
4950
void doSomething() {
5051
// (...)
5152
metricGroup.addSpan(
52-
Span.builder(MyClass.class, "SomeAction")
53-
.setStartTsMillis(startTs) // Optional
54-
.setEndTsMillis(endTs) // Optional
55-
.setAttribute("foo", "bar");
53+
Span.builder(MyClass.class, "SomeAction")
54+
.setStartTsMillis(startTs) // Optional
55+
.setEndTsMillis(endTs) // Optional
56+
.setAttribute("foo", "bar") // Optional
57+
.addChild(Span.builder(MyClass.class, "ChildAction") // Optional
58+
.addChildren(List.of(
59+
Span.builder(MyClass.class, "AnotherChildAction")); // Optional
5660
}
5761
}
5862
```

docs/layouts/shortcodes/generated/trace_configuration.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
</tr>
99
</thead>
1010
<tbody>
11+
<tr>
12+
<td><h5>traces.checkpoint.span-detail-level</h5></td>
13+
<td style="word-wrap: break-word;">SPAN_PER_CHECKPOINT</td>
14+
<td><p>Enum</p></td>
15+
<td>Detail level for reporting checkpoint spans. Possible values:
16+
- SPAN_PER_CHECKPOINT (default): Single span per checkpoint. Aggregated sum/max for submetrics from all tasks and subtasks per checkpoint
17+
- SPAN_PER_CHECKPOINT_WITH_TASKS: Single span per checkpoint. Same as SPAN_PER_CHECKPOINT, plus arrays of aggregated values per task.
18+
- CHILDREN_SPANS_PER_TASK: Same as SPAN_PER_CHECKPOINT plus children spans per each task. Each task span with aggregated sum/max submetrics from subtasks.
19+
- CHILDREN_SPANS_PER_SUBTASK: Same as CHILDREN_SPANS_PER_TASK plus children spans per each subtask. Child spans for tasks and grand-child spans for subtasks.<br /><br />Possible values:<ul><li>"SPAN_PER_CHECKPOINT"</li><li>"SPAN_PER_CHECKPOINT_WITH_TASKS"</li><li>"CHILDREN_SPANS_PER_TASK"</li><li>"CHILDREN_SPANS_PER_SUBTASK"</li></ul></td>
20+
</tr>
1121
<tr>
1222
<td><h5>traces.reporter.&lt;name&gt;.&lt;parameter&gt;</h5></td>
1323
<td style="word-wrap: break-word;">(none)</td>

0 commit comments

Comments
 (0)