Skip to content

Lightstep-Access-Token Header Addition - #64

Merged
cboppert merged 12 commits into
masterfrom
cody/access-token-headers
Apr 23, 2019
Merged

cboppert merged 12 commits into
masterfrom
cody/access-token-headers

Conversation

@cboppert

Copy link
Copy Markdown
Contributor

This PR adds the Lightstep-Access-Token header to the lightstep tracer python.

It also includes some readme updates I discovered while setting up the local python tracer example.

Comment thread VERSION Outdated
@@ -1 +1 @@
4.0.3 No newline at end of file
4.0.4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not certain if this version is updated manually or done automatically during deploy

@JulianGriggs

Copy link
Copy Markdown
  1. Structurally, I think it would be best to split the README updates and the code updates into separate PRs.

  2. It looks like this tracer supports HTTP and Thrift. Have you investigated adding the header to the Thrift transport?

@cboppert

Copy link
Copy Markdown
Contributor Author

@JulianGriggs I've tested with both use_http=True and use_thrift=True. I looked through the ThriftConnection and didn't see headers to add so it must be through the HTTP one somehowe.

@cboppert

Copy link
Copy Markdown
Contributor Author

I'll split it up

@cboppert cboppert closed this Apr 19, 2019
@cboppert cboppert reopened this Apr 19, 2019
Comment thread CHANGELOG.md Outdated
@@ -1,3 +1,7 @@
<a name="4.0.4"></a>
## [4.0.2](https://github.com/lightstep/lightstep-tracer-python/compare/4.0.2...4.0.3)
* Add LightStep-Access-Token headers to outgoing requests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: header should be singular

Comment thread README.md Outdated
```python
return lightstep.Tracer(
component_name='WhatIDoWhatIDidnt',
access_token='587145376229b4e8cc4d99d948bb967b',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Delete this access token and the collector host. This shouldn't be committed. In fact, I think to demonstrate this point you should do

return lightstep.Tracer(
    ....,
    use_http=False,
    use_thrift=True,
    ....,
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Woops, sorry about that

@JulianGriggs

Copy link
Copy Markdown

@cboppert Based upon the previous commit in this repo 98b87bc, I think that version bumps are typically done separately from code updates. As such, I think we should continue doing it that way

@cboppert

Copy link
Copy Markdown
Contributor Author

Alright

@cboppert cboppert closed this Apr 22, 2019
@cboppert cboppert reopened this Apr 22, 2019
Comment thread VERSION
@@ -1 +1 @@
4.0.3 No newline at end of file
4.0.3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: can you add back the newline so that there is no diff here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aliright.

Comment thread README.md
as enabling use_thrift.

```python
return lightstep.Tracer(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I still think that detailing the other options to this call makes it more difficult to consume the textual information. As a reader, I start wondering if the other parameters are relevant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, can delete.

Comment thread README.md
```

### Thrift
When using apache thrift rpc, make sure to both disable use_http by setting it to False as well

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we wrap use_http, use_thrift, False, and True with ticks (`) so that they are more obviously read as code parameters

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@JulianGriggs

Copy link
Copy Markdown

@cboppert One last comment, if you could squash these commits together that would be great -- to clean it up a little bit.

@cboppert

Copy link
Copy Markdown
Contributor Author

@JulianGriggs Wouldn't we just squash on merge?

@austinlparker austinlparker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall it's fine other than the readme.

Comment thread README.md
```

### Thrift
When using apache thrift rpc, make sure to both disable use_http by setting it to False as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need to explicitly disable the transport you don't want (see

)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hey @austinlparker use_http is set to True by default as you can see in

So if you don't set use_http to False and only set use_thrift to True, then it always runs the first if block and never hits the second.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That strikes me as a bug then, we should fix that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree, but it's out of scope for this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll just fix this in a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll just fix this in a separate PR.

Comment thread README.md
When using apache thrift rpc, make sure to both disable use_http by setting it to False as well
as enabling use_thrift.

```python

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For consistency, we generally prefer the options block in README code samples to be minimal. If you want to improve the README by adding a table that explains the options, that would be good. See https://github.com/lightstep/lightstep-tracer-csharp/blob/master/README.md#advanced-usage for an example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll address this in a separate PR

@cboppert
cboppert merged commit 6f9007d into master Apr 23, 2019
@carlosalberto
carlosalberto deleted the cody/access-token-headers branch May 31, 2019 16:32
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