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

Setting root span status explicitly #1449

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/plugins/google-cloud/src/gcpOpenTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ class AdjustingTraceExporter implements SpanExporter {
featuresTelemetry.tick(span, unused, this.logIO, this.projectId);
// Report executions and latency for all flow paths only on the root span
pathsTelemetry.tick(span, paths, this.logIO, this.projectId);
// Set root status explicitly
span.attributes['genkit:rootState'] = span.attributes['genkit:state'];
}
if (type === 'action' && subtype === 'model') {
// Report generate metrics () for all model actions
Expand Down
3 changes: 3 additions & 0 deletions js/plugins/google-cloud/tests/traces_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ describe('GoogleCloudTracing', () => {
spans[0].attributes['genkit/failedPath'],
'/{badFlow,t:flow}/{badStep,t:flowStep}'
);
assert.equal(spans[1].attributes['genkit/isRoot'], true);
assert.equal(spans[1].attributes['genkit/rootState'], 'error');
});

it('labels the root feature', async () => {
Expand All @@ -165,6 +167,7 @@ describe('GoogleCloudTracing', () => {
assert.equal(spans[0].attributes['genkit/feature'], undefined);
assert.equal(spans[1].name, 'niceFlow');
assert.equal(spans[1].attributes['genkit/feature'], 'niceFlow');
assert.equal(spans[1].attributes['genkit/rootState'], 'success');
});

it('adds the genkit/model label for model actions', async () => {
Expand Down
Loading