Skip to content

Commit

Permalink
monitoring: add to google-cloud (googleapis#1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored Oct 24, 2016
1 parent 4672126 commit 28247c6
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This client supports the following Google Cloud Platform services:
* [Google Cloud Speech](#google-cloud-speech-beta) (Beta)
* [Google Cloud Vision](#google-cloud-vision-beta) (Beta)
* [Stackdriver Logging](#stackdriver-logging-beta) (Beta)
* [Stackdriver Monitoring](#stackdriver-monitoring-beta) (Beta)

If you need support for other Google APIs, check out the [Google Node.js API Client library][googleapis].

Expand Down Expand Up @@ -1139,6 +1140,49 @@ loggingClient.getEntries(function(err, entries) {
```


## Stackdriver Monitoring (Beta)

> **This is a Beta release of Stackdriver Monitoring.** This API is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes.
### :warning: This is an auto-generated API

It does not follow the conventions you're familiar with from other parts of our library. A handwritten layer is not yet available.

The example below shows you how to instantiate the generated client. For further documentation, please browse the [Monitoring .proto files][cloud-monitoring-protos] on GitHub.

- [Official Documentation][cloud-monitoring-docs]

#### Using the all-in-one module

```
$ npm install --save google-cloud
```

```js
var gcloud = require('google-cloud');
var monitoring = gcloud.monitoring;
```

#### Using the Stackdriver Monitoring API module

```
$ npm install --save @google-cloud/monitoring
```

```js
var monitoring = require('@google-cloud/monitoring');
```

#### Preview

```js
var monitoringClient = monitoring.v3({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
```


## Contributing

Contributions to this library are always welcome and highly encouraged.
Expand Down Expand Up @@ -1196,6 +1240,9 @@ Apache 2.0 - See [COPYING](COPYING) for more information.

[cloud-language-docs]: https://cloud.google.com/natural-language/docs

[cloud-monitoring-docs]: https://cloud.google.com/monitoring/docs
[cloud-monitoring-protos]: https://github.com/googleapis/googleapis/tree/master/google/monitoring/v3

[cloud-logging-docs]: https://cloud.google.com/logging/docs

[cloud-prediction-docs]: https://cloud.google.com/prediction/docs
Expand Down
1 change: 1 addition & 0 deletions packages/google-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"@google-cloud/dns": "^0.3.0",
"@google-cloud/language": "^0.5.0",
"@google-cloud/logging": "^0.5.0",
"@google-cloud/monitoring": "^0.1.1",
"@google-cloud/prediction": "^0.3.0",
"@google-cloud/pubsub": "^0.5.0",
"@google-cloud/resource": "^0.3.0",
Expand Down
37 changes: 37 additions & 0 deletions packages/google-cloud/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,43 @@ var apis = {
*/
logging: require('@google-cloud/logging'),

/**
* [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects
* metrics, events, and metadata from Google Cloud Platform, Amazon Web
* Services (AWS), hosted uptime probes, application instrumentation, and a
* variety of common application components including Cassandra, Nginx, Apache
* Web Server, Elasticsearch and many others. Stackdriver ingests that data
* and generates insights via dashboards, charts, and alerts.
*
* <p class="notice">
* **This is a Beta release of Stackdriver Monitoring.** This API is not
* covered by any SLA or deprecation policy and may be subject to
* backward-incompatible changes.
* </p>
*
* <h2>This is an auto-generated API</h2>
*
* It does not follow the conventions you're familiar with from other parts of
* our library. A handwritten layer is not yet available.
*
* The example below shows you how to instantiate the generated client. For
* further documentation, please browse the
* [Monitoring .proto files](https://github.com/googleapis/googleapis/tree/master/google/monitoring/v3)
* on GitHub.
*
* @type {module:monitoring}
*
* @return {module:monitoring}
*
* @example
* var gcloud = require('google-cloud');
* var monitoring = gcloud.monitoring.v3({
* projectId: 'grape-spaceship-123',
* keyFilename: '/path/to/keyfile.json'
* });
*/
monitoring: require('@google-cloud/monitoring'),

/**
* The [Google Prediction API](https://cloud.google.com/prediction/docs/getting-started)
* provides pattern-matching and machine learning capabilities. Given a set of
Expand Down
15 changes: 15 additions & 0 deletions packages/google-cloud/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var FakeDatastore = createFakeApi();
var FakeDNS = createFakeApi();
var FakeLanguage = createFakeApi();
var FakeLogging = createFakeApi();
var FakeMonitoring = createFakeApi();
var FakePrediction = createFakeApi();
var FakePubSub = createFakeApi();
var FakeResource = createFakeApi();
Expand All @@ -59,6 +60,7 @@ describe('gcloud', function() {
'@google-cloud/dns': FakeDNS,
'@google-cloud/language': FakeLanguage,
'@google-cloud/logging': FakeLogging,
'@google-cloud/monitoring': FakeMonitoring,
'@google-cloud/prediction': FakePrediction,
'@google-cloud/pubsub': FakePubSub,
'@google-cloud/resource': FakeResource,
Expand Down Expand Up @@ -101,6 +103,10 @@ describe('gcloud', function() {
assert.strictEqual(gcloud.logging, FakeLogging);
});

it('should export static monitoring', function() {
assert.strictEqual(gcloud.monitoring, FakeMonitoring);
});

it('should export static prediction', function() {
assert.strictEqual(gcloud.prediction, FakePrediction);
});
Expand Down Expand Up @@ -223,6 +229,15 @@ describe('gcloud', function() {
});
});

describe('monitoring', function() {
it('should create a new Monitoring', function() {
var monitoring = localGcloud.monitoring(options);

assert(monitoring instanceof FakeMonitoring);
assert.strictEqual(monitoring.calledWith_[0], options);
});
});

describe('prediction', function() {
it('should create a new Prediction', function() {
var prediction = localGcloud.prediction(options);
Expand Down

0 comments on commit 28247c6

Please sign in to comment.