Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opencensus/exporter-zpages

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencensus/exporter-zpages - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

build/src/zpages-frontend/page-handlers/templates-dir.d.ts

2

build/src/zpages-frontend/controllers/rpcz.controller.d.ts

@@ -21,4 +21,4 @@ /**

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/
export declare function createRpczHandler(statsParams: StatsParams): express.Handler;

@@ -22,3 +22,3 @@ "use strict";

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/

@@ -25,0 +25,0 @@ function createRpczHandler(statsParams) {

@@ -21,4 +21,4 @@ /**

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/
export declare function createStatszHandler(statsParams: StatsParams): express.Handler;

@@ -22,3 +22,3 @@ "use strict";

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/

@@ -25,0 +25,0 @@ function createStatszHandler(statsParams) {

"use strict";
/**
* Copyright 2018 OpenCensus Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +18,0 @@ const traceconfigz_page_handler_1 = require("./../page-handlers/traceconfigz.page-handler");

@@ -53,3 +53,3 @@ "use strict";

default:
return null;
throw new Error('unknown bucket boundary');
}

@@ -79,3 +79,3 @@ }

default:
return null;
throw new Error('unknown bucket boundary');
}

@@ -93,3 +93,3 @@ }

}
return null;
throw new Error('unknown bucket boundary');
}

@@ -96,0 +96,0 @@ /**

@@ -19,22 +19,5 @@ "use strict";

const core_1 = require("@opencensus/core");
const ejs = require('ejs');
const pkgDir = require("pkg-dir");
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;
const ejs = require("ejs");
const templates_dir_1 = require("./templates-dir");
const FIXED_SIZE = 3;
var DefaultMeasures;
(function (DefaultMeasures) {
DefaultMeasures["CLIENT_SENT_MESSAGES_PER_RPC"] = "grpc.io/client/sent_messages_per_rpc";
DefaultMeasures["CLIENT_SENT_BYTES_PER_RPC"] = "grpc.io/client/sent_bytes_per_rpc";
DefaultMeasures["CLIENT_RECEIVED_MESSAGES_PER_RPC"] = "grpc.io/client/received_messages_per_rpc";
DefaultMeasures["CLIENT_RECEIVED_BYTES_PER_RPC"] = "grpc.io/client/received_bytes_per_rpc";
DefaultMeasures["CLIENT_ROUDTRIP_LATENCY"] = "grpc.io/client/roundtrip_latency";
DefaultMeasures["CLIENT_SERVER_LATENCY"] = "grpc.io/client/server_latency";
DefaultMeasures["CLIENT_STARTED_RPCS"] = "grpc.io/client/started_rpcs";
DefaultMeasures["SERVER_RECEIVED_MESSAGES_PER_RPC"] = "grpc.io/server/received_messages_per_rpc";
DefaultMeasures["SERVER_RECEIVED_BYTES_PER_RPC"] = "grpc.io/server/received_bytes_per_rpc";
DefaultMeasures["SERVER_SENT_MESSAGES_PER_RPC"] = "grpc.io/server/sent_messages_per_rpc";
DefaultMeasures["SERVER_SENT_BYTES_PER_RPC"] = "grpc.io/server/sent_bytes_per_rpc";
DefaultMeasures["SERVER_SERVER_LATENCY"] = "grpc.io/server/server_latency";
DefaultMeasures["SERVER_STARTED_RPCS"] = "grpc.io/server/started_rpcs";
})(DefaultMeasures || (DefaultMeasures = {}));
var DefaultViews;

@@ -64,5 +47,5 @@ (function (DefaultViews) {

/** template HTML */
const rpczFile = ejs.fileLoader(`${templatesDir}/rpcz.ejs`, 'utf8').toString();
const rpczFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/rpcz.ejs`).toString();
/** CSS styles file */
const stylesFile = ejs.fileLoader(`${templatesDir}/styles.min.css`).toString();
const stylesFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/styles.min.css`).toString();
/** EJS render options */

@@ -97,3 +80,5 @@ const options = { delimiter: '?' };

if (clientMethodIndex !== -1) {
method = snapshot.tagValues[clientMethodIndex].value;
method = snapshot.tagValues[clientMethodIndex] ?
snapshot.tagValues[clientMethodIndex].value :
'';
zMeasures = rpczData.measuresSent;

@@ -103,6 +88,8 @@ }

// Switches to received data if it's a server
method = snapshot.tagValues[serverMethodIndex].value;
method = snapshot.tagValues[serverMethodIndex] ?
snapshot.tagValues[serverMethodIndex].value :
'';
zMeasures = rpczData.measuresReceived;
}
if (method) {
if (zMeasures && method) {
if (!zMeasures[method]) {

@@ -109,0 +96,0 @@ zMeasures[method] = this.newEmptyZMeasure();

@@ -23,3 +23,3 @@ /**

tagKeys: TagKey[];
tagValues?: TagValue[];
tagValues?: Array<TagValue | null>;
snapshot?: AggregationData;

@@ -51,6 +51,5 @@ };

* Loader an file from templates folder
* @param fileName name of the file will be to load with extension
* file
* @param fileName name of the file will be to load with extension file
*/
private loaderFile;
}

@@ -19,4 +19,5 @@ "use strict";

const core_1 = require("@opencensus/core");
const templates_dir_1 = require("./templates-dir");
const ejs = require('ejs');
const pkgDir = require("pkg-dir");
const path = require("path");
/** Handles the data transformation and feeds to the HTML page. */

@@ -164,8 +165,7 @@ class StatszPageHandler {

* Loader an file from templates folder
* @param fileName name of the file will be to load with extension
* file
* @param fileName name of the file will be to load with extension file
*/
loaderFile(fileName) {
const rootDir = `${pkgDir.sync(__dirname)}`;
return ejs.fileLoader(`${rootDir}/templates/${fileName}`, 'utf8');
const fileDir = path.join(templates_dir_1.templatesDir, fileName);
return ejs.fileLoader(fileDir, 'utf8');
}

@@ -172,0 +172,0 @@ }

@@ -28,3 +28,3 @@ /**

/** Configuration defaults. Currently just the default sampling rate. */
private defaultConfig;
private defaultConfig?;
/**

@@ -31,0 +31,0 @@ * Generate Zpages Trace Config HTML Page

@@ -21,5 +21,3 @@ "use strict";

const ejs = require("ejs");
const pkgDir = require("pkg-dir");
// The directory to search for templates.
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;
const templates_dir_1 = require("./templates-dir");
class TraceConfigzPageHandler {

@@ -42,3 +40,3 @@ /**

/** template HTML */
const traceConfigzFile = ejs.fileLoader(`${templatesDir}/traceconfigz.ejs`).toString();
const traceConfigzFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/traceconfigz.ejs`).toString();
/** EJS render options */

@@ -67,3 +65,2 @@ const options = { delimiter: '?' };

if (query.change === 'restore_default') {
const exporter = tracing.exporter;
tracing.tracer.sampler =

@@ -91,3 +88,4 @@ core_1.SamplerBuilder.getSampler(this.defaultConfig.samplingRate);

}
return Number(samplingProbability.match(/\((.*)\)/)[1]);
const probability = samplingProbability.match(/\((.*)\)/);
return probability ? Number(probability[1]) : 1 / 10000;
}

@@ -94,0 +92,0 @@ }

@@ -19,6 +19,4 @@ "use strict";

const ejs = require("ejs");
const pkgDir = require("pkg-dir");
const latency_bucket_boundaries_1 = require("../latency-bucket-boundaries");
// The directory to search for templates.
const templatesDir = `${pkgDir.sync(__dirname)}/templates`;
const templates_dir_1 = require("./templates-dir");
/** Get canononical code from TraceStatusCodes */

@@ -48,3 +46,3 @@ const getCanonicalCode = (status) => {

default:
return null;
return 'UNKNOWN';
}

@@ -128,7 +126,7 @@ };

emitHtml(params, json) {
const tracezFile = ejs.fileLoader(`${templatesDir}/tracez.ejs`).toString();
const stylesFile = ejs.fileLoader(`${templatesDir}/styles.min.css`).toString();
const summaryFile = ejs.fileLoader(`${templatesDir}/summary.ejs`).toString();
const spanCellFile = ejs.fileLoader(`${templatesDir}/span-cell.ejs`).toString();
const spansFile = ejs.fileLoader(`${templatesDir}/spans.ejs`).toString();
const tracezFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/tracez.ejs`).toString();
const stylesFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/styles.min.css`).toString();
const summaryFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/summary.ejs`).toString();
const spanCellFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/span-cell.ejs`).toString();
const spansFile = ejs.fileLoader(`${templates_dir_1.templatesDir}/spans.ejs`).toString();
/** EJS render options */

@@ -135,0 +133,0 @@ const options = { delimiter: '?' };

@@ -24,4 +24,4 @@ /**

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/
export declare function createRoutes(traceMap: Map<string, Span[]>, statsParams: StatsParams): express.Router;

@@ -28,3 +28,3 @@ "use strict";

* @param statsParams An object with all registered views, registered measures
* and recorded data from stats
* and recorded data from stats
*/

@@ -31,0 +31,0 @@ function createRoutes(traceMap, statsParams) {

@@ -41,3 +41,3 @@ /**

private app;
private server;
private server?;
private port;

@@ -71,2 +71,4 @@ private traces;

start(): void;
/** Stops the exporter. */
stop(): void;
/**

@@ -73,0 +75,0 @@ * Send a trace to traces array

@@ -99,2 +99,4 @@ "use strict";

}
/** Stops the exporter. */
stop() { }
/**

@@ -166,3 +168,5 @@ * Send a trace to traces array

stopServer(callback) {
this.server.close(callback);
if (this.server) {
this.server.close(callback);
}
}

@@ -169,0 +173,0 @@ }

{
"name": "@opencensus/exporter-zpages",
"version": "0.0.9",
"version": "0.0.10",
"description": "A collection of HTML pages to display stats and trace data and allow library configuration control",

@@ -9,3 +9,3 @@ "main": "build/src/index.js",

"scripts": {
"test": "nyc mocha build/test/**/*.js",
"test": "nyc ts-mocha -p ./tsconfig.json test/**/*.ts",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json",

@@ -17,3 +17,2 @@ "clean": "rimraf build/*",

"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run check"

@@ -41,2 +40,13 @@ },

],
"nyc": {
"extension": [
".ts",
".tsx"
],
"exclude": [
"**/*.d.ts",
"build/**/**/*.js"
],
"all": true
},
"publishConfig": {

@@ -46,3 +56,3 @@ "access": "public"

"devDependencies": {
"@opencensus/nodejs": "^0.0.9",
"@opencensus/nodejs": "^0.0.10",
"@types/ejs": "^2.6.0",

@@ -53,18 +63,17 @@ "@types/express": "^4.11.1",

"@types/node": "^10.12.12",
"@types/pkg-dir": "^2.0.0",
"axios": "^0.18.0",
"codecov": "^3.1.0",
"gts": "^0.9.0",
"mocha": "^5.0.4",
"nyc": "13.1.0",
"mocha": "^6.0.0",
"nyc": "13.3.0",
"rimraf": "^2.6.2",
"ts-node": "^7.0.1",
"ts-mocha": "^6.0.0",
"ts-node": "^8.0.0",
"typescript": "~3.2.0"
},
"dependencies": {
"@opencensus/core": "^0.0.9",
"@opencensus/core": "^0.0.10",
"ejs": "^2.5.8",
"express": "^4.16.3",
"pkg-dir": "^3.0.0"
"express": "^4.16.3"
}
}

@@ -22,7 +22,7 @@ # OpenCensus Zpages Exporter for Node.js

```javascript
var tracing = require('@opencensus/nodejs');
var zpages = require('@opencensus/exporter-zipkin');
const tracing = require('@opencensus/nodejs');
const zpages = require('@opencensus/exporter-zipkin');
// Add your zipkin url and application name to the Zipkin options
var options = {
const options = {
port: 8080, // default

@@ -33,3 +33,3 @@ startServer: true, // default

var exporter = new zpages.ZpagesExporter(options);
const exporter = new zpages.ZpagesExporter(options);
```

@@ -36,0 +36,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc