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

Link workflow run spans together #278

Merged
merged 2 commits into from
Oct 8, 2021
Merged

Link workflow run spans together #278

merged 2 commits into from
Oct 8, 2021

Conversation

Sushisource
Copy link
Member

@Sushisource Sushisource commented Oct 1, 2021

What was changed

Links all spans in a workflow run to whatever was attached to workflow execution start headers

Why?

Best option available at the moment. Ideally everything would be part of one trace which looks best in Jaeger UI but that is currently not feasible due to open-telemetry/opentelemetry-rust#643

In theory this is maybe the more "right" way to do it, but Jaeger isn't good at displaying this sort of thing due to
jaegertracing/jaeger-ui#662

Checklist

  • Update otel interceptor samples -- Let's do this in another PR
  1. Closes

  2. How was this tested:
    Otel manual test

  3. Any docs updates needed?

@Sushisource Sushisource force-pushed the link-run-spans branch 4 times, most recently from 4f4e55a to 6996cc0 Compare October 2, 2021 00:00
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

On the one hand I like that everything connects but I don't like how otel took over the SDK and I'm not sure we want to interfere with user's spans at all.
Let's discuss this.

package.json Outdated Show resolved Hide resolved
packages/common/src/otel.ts Outdated Show resolved Hide resolved
packages/interceptors-opentelemetry/src/workflow/index.ts Outdated Show resolved Hide resolved
packages/test/src/workflows/cancel-fake-progress.ts Outdated Show resolved Hide resolved
packages/worker/src/worker.ts Outdated Show resolved Hide resolved
packages/common/src/otel.ts Outdated Show resolved Hide resolved
for (const j of rest.jobs) {
if (j.startWorkflow != null) {
const ctx = await extractSpanContextFromHeaders(j.startWorkflow.headers ?? {});
if (ctx != null && linkedContext == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Again these are undefineds not null.
I'll add a lint rule to prohibit using ==.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wouldn't just b/c we still need it for not overly verbose checking of null/undef in protos

packages/worker/src/worker.ts Show resolved Hide resolved
packages/common/src/otel.ts Outdated Show resolved Hide resolved
packages/common/src/otel.ts Show resolved Hide resolved
@Sushisource Sushisource force-pushed the link-run-spans branch 2 times, most recently from fd86014 to 0f3a480 Compare October 5, 2021 20:40
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

I'm still not convinced we should mix user spans with framework spans.
In case we decide to go that direction this PR is definitely the way to go.

packages/common/src/otel.ts Outdated Show resolved Hide resolved
packages/interceptors-opentelemetry/src/workflow/index.ts Outdated Show resolved Hide resolved
packages/test/src/workflows/cancel-fake-progress.ts Outdated Show resolved Hide resolved
packages/worker/src/worker.ts Outdated Show resolved Hide resolved
packages/worker/src/worker.ts Outdated Show resolved Hide resolved
packages/worker/src/worker.ts Show resolved Hide resolved
@Sushisource Sushisource force-pushed the link-run-spans branch 2 times, most recently from 835eb01 to a1d382c Compare October 7, 2021 22:45
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

I'm approving, none of my comments are critical enough to block this PR.


export const tracer = otel.trace.getTracer('workflow');
function getTracer(): otel.Tracer {
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Easier on users. They don't have to remember to call this register function

packages/interceptors-opentelemetry/src/workflow/index.ts Outdated Show resolved Hide resolved
makeWorkflowExporter,
OpenTelemetryActivityInboundInterceptor,
} from '@temporalio/interceptors-opentelemetry/lib/worker';
import { OpenTelemetryDependencies } from '@temporalio/interceptors-opentelemetry/lib/workflow';

// Un-skip this test and run it by hand to inspect outputted traces
test.skip('Otel spans connected', async (t) => {
Copy link
Member

Choose a reason for hiding this comment

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

How much work would it be to run this and add assertions?
Doesn't have to be in this PR but I'd at least track it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not a ton. I want to do that as a follow up with fixing the sample.

packages/worker/src/worker.ts Outdated Show resolved Hide resolved
packages/common/src/otel.ts Outdated Show resolved Hide resolved
* Other various improvements to otel interceptors
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.

2 participants