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

Create root spans allowing for override of Span identifier #126

Merged
merged 4 commits into from
May 22, 2022

Conversation

istathar
Copy link
Member

Presents an alternative API to that suggested by #125. The idea here is that we would create a trace but without specifying the parent, using a new usingTrace' function. Then we would re-use the existing encloseSpan function augmented by a new override setIdentifierSpan function, resulting in a shape like this:

    usingTrace' trace $ do
        encloseSpan "Eat your vegetables" $ do
            setStartTime start 
            setIdentifierSpan predetermined
            telemetry
                [ metric "sugar" False
                ]

where trace and predetermined are the received and already created Trace and Span identifiers, respectively.

While not quite as compact as the sendSpan idea proposed by @TheWizardTower, I'd like to suggest that by reusing existing encloseSpan machinery we keep the API surface a bit more contained. setStartTime is already an outlier as an override, and so this usage probably makes sense.

@istathar istathar added the core-telemetry Issues involving sending telemetry to an observability service label May 22, 2022
@istathar istathar self-assigned this May 22, 2022
@istathar
Copy link
Member Author

Might be worth noting that @TheWizardTower's sendSpan is

sendSpan label traceId spanId serviceName spanId start meta =
    usingTrace' traceId $ encloseSpan label (setIdentifierSpan spanId >> setServiceName serviceName >> setStartTime start >> telemetry meta) 

@istathar istathar merged commit e2b31c7 into aesiniath:main May 22, 2022
@istathar istathar deleted the root-spans branch May 22, 2022 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-telemetry Issues involving sending telemetry to an observability service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant