dstandish commented on PR #61897: URL: https://github.com/apache/airflow/pull/61897#issuecomment-3939734796
> BTW @dstandish, if you _do_ want to generate spans for a full dag run or task execution, I don't think that should be too hard to do. > > The basic idea is that the parent span doesn't need to exist from the start. Only its span _context_ (i.e. its allocated trace ID and span ID) needs to be allocated from the beginning. So you'd generate the span context for the dag run (and then again I guess for each task within the dag), save it in the database, and then pull it out right at the end of the dag run (or at the end of the task execution) and emit a synthetic span that's "backdated" to start when the database says it started. > > I knocked up [a small example of how to do this](https://gist.github.com/nickstenning/2f82c85aa073fb00aa6f12e90f4c4e28) that uses `opentelemetry.context` to force a particular trace ID and span ID to be used when we want that. > > <img alt="image" width="1328" height="904" src="https://private-user-images.githubusercontent.com/3602/553021536-e9140784-327b-450c-96b1-709ddba1eaaf.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE2OTE3NjEsIm5iZiI6MTc3MTY5MTQ2MSwicGF0aCI6Ii8zNjAyLzU1MzAyMTUzNi1lOTE0MDc4NC0zMjdiLTQ1MGMtOTZiMS03MDlkZGJhMWVhYWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDIyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAyMjFUMTYzMTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjAzMzIyNDA0Yjc1Y2E1OWI1Y2Y2NDUxMmJkNWY2YmE5YzYzODBjZjkwNWI0Y2E2YjM2MjA2MTMyYzI4MDRkOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.3L2rUXOz2BcaVJ3c0ud_Pn5MUT0yQvYhFgCyBTfqP_A"> I'm a little confused by your example can you make it more concrete by saying how you would modify how it looks right now? here's what it looks like right now <img width="806" height="271" alt="image" src="https://github.com/user-attachments/assets/894dce87-c358-43f2-9f43-1482c290a3b4" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
