Skip to content

Commit

Permalink
Update License Copyright - Add custom propagation info to ReadMe (#6)
Browse files Browse the repository at this point in the history
* add tracer init to readme

* added build and release features

* fix makefile typo

* can enable shared spans if desired

* add ability to provide custom propagation headers if needed. default to Span-ID, Trace-Id, Parent-ID

* fix lint issue

* fix copywrite in license and add re-org readme

* fix typo
  • Loading branch information
rhilfers authored and ashishagg committed Mar 8, 2019
1 parent a53000b commit e400a43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2019 Expedia, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This is Haystack's client library for Python that implements [OpenTracing](https
Further information can be found on [opentracing.io](https://opentracing.io/)

## Using this library
See examples in /examples directory.
See examples in /examples directory. See opentracing [usage](https://github.com/opentracing/opentracing-python/#usage) for additional information.


First initialize the tracer at the application level by supplying a service name and recorder
```python
Expand All @@ -18,10 +19,6 @@ from haystack import HaystackTracer
opentracing.tracer = HaystackTracer("a_service", HaystackAgentRecorder())
```

**If there is a Scope, it will act as the parent to any newly started Span** unless the programmer passes
`ignore_active_span=True` at `start_span()/start_active_span()` time or specified parent context explicitly using
`childOf=parent_context`

Starting a span can be done as a managed resource using `start_active_span()`
```python
with opentracing.tracer.start_active_span("span-name") as scope:
Expand All @@ -35,7 +32,16 @@ do_stuff()
span.finish()
```

See opentracing [usage](https://github.com/opentracing/opentracing-python/#usage) for additional information.
Note: **If there is a Scope, it will act as the parent to any newly started Span** unless the programmer passes
`ignore_active_span=True` at `start_span()/start_active_span()` time or specified parent context explicitly using
`childOf=parent_context`

#### Custom propagation headers
If necessary, default propagation headers can be replaced with custom ones by specifying custom propagator options. Register the new propagator with the tracer once configured.
```python
prop_opts = PropagatorOpts("X-Trace-ID", "X-Span-ID", "X-Parent-Span", "X-baggage-")
opentracing.tracer.register_propagator(opentracing.Format.HTTP_HEADERS, TextPropagator(prop_opts))
```

#### Logging
All modules define their logger via `logging.getLogger(__name__)`
Expand Down

0 comments on commit e400a43

Please sign in to comment.