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

Enhance compatibility with Google App Engine #106

Merged
merged 6 commits into from
May 26, 2016
Merged

Conversation

yannmh
Copy link
Member

@yannmh yannmh commented Dec 8, 2015

get_version to resolve package version

Create a get_version util method to resolve datadog package version.

For compatibility purpose with Google App Engine, handle the case where pkg_resources is undefined.

simplejson fall back to stdlib json

Enhance compatibility with Google App Engine: fall back simplejson to stdlib json.

Split API and HTTP clients

Redesign the api module to dissociate the API from the HTTP client.
Make HTTP clients pluggable.

Changes
Two new modules:

  • api_client.
    • APIClient. Defines
  • http_client.
    • HTTPClient. Defines a pluggable HTTP client skeleton.
      • RequestClient. HTTP client based on requests 3p module.

One module renamed:

  • api.base module is now api.resources

urlfetch based HTTP client

Create a new HTTP client, URLFetchClient, based on urlfetch Google App Engine 3p module.

Don't raise on hostname resolution failures

hostname is an optional API parameter. Thus, initialize method should not raise when unable to resolve it.

@yannmh yannmh self-assigned this Dec 8, 2015
@yannmh yannmh changed the title [WIP] Enhance compatibility with Google App Engine Enhance compatibility with Google App Engine Dec 9, 2015
@yannmh yannmh added this to the 0.11.0 milestone Jan 8, 2016
@yannmh yannmh modified the milestones: Future, 0.11.0 Mar 10, 2016
yannmh added 3 commits April 26, 2016 14:09
Create a `get_version` util method to resolve `datadog` package version.

For compatibility purpose with Google App Engine, handle the case where
`pkg_resources` is undefined.
Enhance compatibility with Google App Engine: fall back `simplejson` to
stdlib `json`.
Redesign the `api` module to dissociate the API from the HTTP client.
Make HTTP clients pluggable.

**Changes**
Two new modules:
* `api_client`.
  * `APIClient`. Defines
* `http_client`.
  * `HTTPClient`. Defines a pluggable HTTP client skeleton.
    * `RequestClient`. HTTP client based on `requests` 3p module.

One module renamed:
* `api.base` module is now `api.resources`
@yannmh yannmh force-pushed the yann/gae-compatibility branch from ca22208 to 3d73a77 Compare April 26, 2016 18:16
yannmh added 2 commits April 26, 2016 14:20
Create a new HTTP client, `URLFetchClient`, based on `urlfetch` Google
App Engine 3p module.
`hostname` is an optional API parameter. Thus, `initialize` method
should not raise when unable to resolve it.
@yannmh yannmh force-pushed the yann/gae-compatibility branch from 3d73a77 to 49cf300 Compare April 26, 2016 18:24
@yannmh yannmh modified the milestones: 0.12.0, Future May 25, 2016
from datadog.util.compat import iteritems
from datadog.util.config import get_version
from datadog.util.hostname import get_hostname
Copy link
Member

Choose a reason for hiding this comment

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

🍰

Following @degemer's feedback:
* Make `APIClient` class 100% static
* Rewrite the `resolve_http_client` logic in the `HTTPClient` class
@degemer
Copy link
Member

degemer commented May 26, 2016

👍

@yannmh yannmh merged commit 0a89d9e into master May 26, 2016
@yannmh yannmh deleted the yann/gae-compatibility branch May 26, 2016 22:35
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.

2 participants