Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit f32d3f7

Browse files
silva-fabiokjin
authored andcommitted
test: add new test cases for pluginloader and tracing classes
1 parent c098984 commit f32d3f7

File tree

22 files changed

+1340
-525
lines changed

22 files changed

+1340
-525
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ TAGS
2626

2727
# nodejs
2828
node_modules/
29+
!packages/opencensus-nodejs/test/instrumentation/node_modules
2930
npm-debug.log
3031
.nyc_output/
3132
build/

packages/opencensus-nodejs/AUTHORS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
Google Inc.
1+
# This is the list of OpenCensus authors for copyright purposes.
2+
#
3+
# This does not necessarily list everyone who has contributed code, since in
4+
# some cases, their employer may be the copyright holder. To see the full list
5+
# of contributors, see the revision history in source control.
6+
7+
Google LLC
8+
CESAR Team (www.cesar.org.br)

packages/opencensus-nodejs/README.md

Lines changed: 6 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,16 @@
1-
# OpenCensus Libraries for Node.js
1+
# OpenCensus Core Node.js
22
[![Gitter chat][gitter-image]][gitter-url]
33

4-
OpenCensus Node.js is an implementation of OpenCensus, a toolkit for collecting application performance and behavior monitoring data. Right now OpenCensus for Node.js supports custom tracing and automatic tracing for http and mongodb.
4+
OpenCensus for Node.js is an implementation of OpenCensus, a toolkit for collecting application performance and behavior monitoring data.
55

66
The library is in alpha stage and the API is subject to change.
77

88
Please join [gitter](https://gitter.im/census-instrumentation/Lobby) for help or feedback on this project.
99

10-
Note: This code was tested on the following Node versions:
11-
- v6.10.0 (for console exporter only)
12-
- v9.8.0 (for Stackdriver and Zipkin exporters)
13-
14-
___
15-
16-
## OpenCensus Setup
17-
18-
1. Clone the OpenCensus Node repository < https://github.com/census-instrumentation/opencensus-node.git>
19-
```bash
20-
git clone https://github.com/census-instrumentation/opencensus-node.git
21-
```
22-
23-
**TODO Ver com Fábio se o usuário terá que compilar**
24-
25-
2. Switch to branch `dev` with:
26-
```bash
27-
git checkout dev
28-
```
29-
30-
3. Navigate to the OpenCensus Node project folder and install the dependencies with:
31-
```bash
32-
cd opencensus-node
33-
npm install
34-
```
35-
36-
4. Compile the TypeScript code into JavaScript with:
37-
```
38-
node_modules/.bin/tsc
39-
```
40-
41-
___
42-
43-
## Instrumenting an Application
44-
45-
Navigate to your application folder. Inside it's `node_modules` folder, create a directory named `@opencensus`:
46-
```
47-
cd node_modules
48-
mkdir @opencensus
49-
```
50-
51-
Navigate to your new `@opencensus` folder and create a symlink to OpenCensus Node package with:
52-
```bash
53-
cd @opencensus
54-
ln -s <path-to-opencensus-dir>/packages/opencensus-nodejs/ opencensus-nodejs
55-
```
56-
57-
### Using Stackdriver Exporter
58-
59-
To use Stackdriver as your exporter, make sure you have enabled [Stackdriver Tracing](https://cloud.google.com/trace/docs/quickstart) on Google Cloud Platform. Enable your [Application Default Credentials](https://cloud.google.com/docs/authentication/getting-started) for authentication with:
60-
```bash
61-
export GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credential.json
62-
```
63-
64-
Add the OpenCensus Stackdriver Exporter package to your project's `node_modules/@opencensus` folder with:
65-
```
66-
cd node_modules/@opencensus
67-
ln -s <path-to-opencensus-dir>/packages/opencensus-exporter-stackdriver/ opencensus-exporter-stackdriver
68-
```
69-
70-
Finally, on top of your application, add the following lines of code:
71-
```javascript
72-
var tracing = require('@opencensus/opencensus-nodejs');
73-
var stackdriver = require('@opencensus/opencensus-exporter-stackdriver');
74-
75-
// Add your project id to the Stackdriver options
76-
var options = new stackdriver.StackdriverOptions('your-project-id');
77-
var exporter = new stackdriver.Stackdriver(options);
78-
79-
tracing.registerExporter(exporter).start();
80-
```
81-
82-
### Using Zipkin Exporter
83-
84-
To use Zipkin as your exporter, first, download from any of the three available options on [Quickstart](https://zipkin.io/pages/quickstart.html): through Docker, on Java or manually compiling the source code. Tests were executed running Zipkin with Java, through the following commands on terminal:
85-
```bash
86-
wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec'
87-
java -jar zipkin.jar
88-
```
89-
90-
Add the OpenCensus Zipkin Exporter package to your project's `node_modules/@opencensus` folder with:
91-
```
92-
cd node_modules/@opencensus
93-
ln -s <path-to-opencensus-dir>/packages/opencensus-exporter-zipkin/ opencensus-exporter-zipkin
94-
```
95-
96-
Finally, on top of your application, add the following lines of code:
97-
```javascript
98-
var tracing = require('@opencensus/opencensus-nodejs');
99-
var zipkin = require('@opencensus/opencensus-exporter-zipkin');
100-
101-
// Add your zipkin url and application name to the Zipkin options
102-
var options = new zipkin.ZipkinOptions("your-zipkin-url", "your-application-name")
103-
var exporter = new zipkin.Zipkin(options);
104-
105-
tracing.registerExporter(exporter).start();
106-
```
10+
## Useful links
11+
- For more information on OpenCensus, visit: <https://opencensus.io/>
12+
- To checkout the OpenCensus for Node.js, visit: <https://github.com/census-instrumentation/opencensus-node>
13+
- For help or feedback on this project, join us on [gitter](https://gitter.im/census-instrumentation/Lobby)
10714

10815
[gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg
10916
[gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

0 commit comments

Comments
 (0)