Skip to content

feat(tracing): Initial tracing experiments #342

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

Merged
merged 10 commits into from
Apr 29, 2019
Merged

Conversation

mitsuhiko
Copy link
Contributor

This is the most basic hack I could come up with that gets us into the direction
of correlating errors. It currently uses a made up trace context but i think
realistically speaking we probably want to use attributes for this.

@mitsuhiko
Copy link
Contributor Author

(This is not intended for merging, just for experimenting)

@untitaker
Copy link
Member

untitaker commented Apr 16, 2019

I think we could infer span context from request headers so each server integration doesn't need to change. Possibly even backfill during event processing although if that is necessary tracing is already broken

@mitsuhiko
Copy link
Contributor Author

mitsuhiko commented Apr 16, 2019

from flask import Flask
import requests
import sentry_sdk
import sentry_sdk.integrations.flask


sentry_sdk.init(
    dsn='...',
    propagate_traces=['http://localhost:5000'],
    integrations=[sentry_sdk.integrations.flask.FlaskIntegration()]
)


app = Flask(__name__)


@app.route('/')
def call_out():
    return requests.get('http://localhost:5000/broken').json()['foo']


@app.route('/broken')
def broken():
    1 / 0

@@ -47,9 +48,15 @@ def dummy_task(x, y):
foo = 42 # noqa
return x / y

span_context = SpanContext.start_trace()
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we just can do "new SpanContext"?
The ctor can set the values, since we are not measuring time, this can simplify the API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For prosperity from a conversation in person: Mostly just so that the ctor will not attempt to auto generate. We can change this, that was just an early draft.

@untitaker untitaker merged commit a843018 into master Apr 29, 2019
@untitaker untitaker deleted the feature/trace-experiments branch April 29, 2019 12:30
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.

3 participants