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

@amplication/plugin-observability-opentelemetry

Package Overview
Dependencies
Maintainers
8
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplication/plugin-observability-opentelemetry - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1-beta.pr-289.0d3954c

.eslintrc.json

2

amplicationrc.json

@@ -7,2 +7,2 @@ {

}
}
}

@@ -222,25 +222,12 @@ /******/ (() => { // webpackBootstrap

/***/ 183:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__(94), exports);
__exportStar(__webpack_require__(54), exports);
__exportStar(__webpack_require__(169), exports);
__exportStar(__webpack_require__(869), exports);
__exportStar(__webpack_require__(391), exports);
const tslib_1 = __webpack_require__(752);
tslib_1.__exportStar(__webpack_require__(94), exports);
tslib_1.__exportStar(__webpack_require__(54), exports);
tslib_1.__exportStar(__webpack_require__(169), exports);
tslib_1.__exportStar(__webpack_require__(869), exports);
tslib_1.__exportStar(__webpack_require__(391), exports);

@@ -261,3 +248,3 @@

const staticFiles = await context.utils.importStaticModules(constants_1.staticPath, context.serverDirectories.baseDirectory);
staticFiles.replaceModulesCode((code) => code
staticFiles.replaceModulesCode((_path, code) => code
.replaceAll(constants_1.placeholders.otelAgentGrpcEndpoint, OTEL_COLLECTOR_PORT_GRPC)

@@ -407,12 +394,10 @@ .replaceAll(constants_1.placeholders.otelAgentHttpEndpoint, OTEL_COLLECTOR_PORT_HTTP));

/***/ 442:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getPluginSettings = void 0;
const tslib_1 = __webpack_require__(752);
const package_json_1 = __webpack_require__(147);
const amplicationrc_json_1 = __importDefault(__webpack_require__(736));
const amplicationrc_json_1 = tslib_1.__importDefault(__webpack_require__(736));
const getPluginSettings = (pluginInstallations) => {

@@ -439,22 +424,9 @@ const plugin = pluginInstallations.find((plugin) => plugin.npm === package_json_1.name);

/***/ 928:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__(442), exports);
__exportStar(__webpack_require__(589), exports);
const tslib_1 = __webpack_require__(752);
tslib_1.__exportStar(__webpack_require__(442), exports);
tslib_1.__exportStar(__webpack_require__(589), exports);

@@ -492,2 +464,9 @@

/***/ 752:
/***/ ((module) => {
module.exports = require("tslib");
/***/ }),
/***/ 822:

@@ -510,3 +489,3 @@ /***/ ((module) => {

module.exports = JSON.parse('{"name":"@amplication/plugin-observability-opentelemetry","version":"2.0.0","description":"This plugin is created to add integrate opentelemetry to the amplication app","main":"dist/index.js","scripts":{"prepublishOnly":"npm run build","dev":"webpack --watch","build":"webpack","prebuild":"rimraf dist","format:write":"prettier --write \\"**/*.{js,ts}\\"","lint:fix":"eslint \'./src/**/*.{ts, tsx}\' --fix --c .eslintrc","lint":"eslint \'./src/**/*.{ts, tsx}\' --c .eslintrc","test":"jest"},"author":"Ashish Padhy","license":"Apache-2.0","devDependencies":{"@amplication/code-gen-types":"^2.0.8","@amplication/code-gen-utils":"^0.0.5","@babel/parser":"^7.20.7","@babel/types":"^7.20.7","@types/jest":"^29.5.3","@types/lodash":"^4.14.197","@typescript-eslint/eslint-plugin":"^6.2.1","@typescript-eslint/parser":"^6.2.1","copy-webpack-plugin":"^11.0.0","eslint":"^8.46.0","jest-mock-extended":"^3.0.1","lodash":"^4.17.21","prettier":"^2.8.7","rimraf":"^4.4.1","ts-jest":"^29.1.1","ts-loader":"^9.4.2","ts-node":"^10.9.1","tsconfig-paths-webpack-plugin":"^4.1.0","typescript":"^4.9.3","webpack":"^5.76.0","webpack-cli":"^5.0.1","webpack-node-externals":"^3.0.0"}}');
module.exports = JSON.parse('{"name":"@amplication/plugin-observability-opentelemetry","version":"2.0.1-beta.pr-289.0d3954c","description":"This plugin is created to add integrate opentelemetry to the amplication app","main":"dist/index.js","nx":{},"scripts":{"prepublishOnly":"npm run build","dev":"webpack --watch","build":"webpack","prebuild":"rimraf dist","format:write":"prettier --write \\"**/*.{js,ts}\\"","lint:fix":"eslint \'./src/**/*.{ts, tsx}\' --fix --c .eslintrc","lint":"eslint \'./src/**/*.{ts, tsx}\' --c .eslintrc","test":"jest"},"author":"Ashish Padhy","license":"Apache-2.0","devDependencies":{"@amplication/code-gen-types":"^2.0.17","@amplication/code-gen-utils":"^0.0.7","@babel/parser":"^7.20.7","@babel/types":"^7.20.7","@types/jest":"^29.5.3","@types/lodash":"^4.14.197","@typescript-eslint/eslint-plugin":"^6.2.1","@typescript-eslint/parser":"^6.2.1","copy-webpack-plugin":"^11.0.0","eslint":"^8.46.0","jest-mock-extended":"^3.0.1","lodash":"^4.17.21","prettier":"^2.8.7","rimraf":"^4.4.1","ts-jest":"^29.1.1","ts-loader":"^9.4.2","ts-node":"^10.9.1","tsconfig-paths-webpack-plugin":"^4.1.0","typescript":"^4.9.3","webpack":"^5.76.0","webpack-cli":"^5.0.1","webpack-node-externals":"^3.0.0"}}');

@@ -535,3 +514,3 @@ /***/ })

/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/

@@ -538,0 +517,0 @@ /******/ // Return the exports of the module

import { JestConfigWithTsJest } from "ts-jest";
const jestConfig : JestConfigWithTsJest = {
const jestConfig: JestConfigWithTsJest = {
preset: "ts-jest",

@@ -15,3 +15,3 @@ testEnvironment: "node",

transform: {
"^.+\\.(t|j)s$": "ts-jest"
"^.+\\.(t|j)s$": "ts-jest",
},

@@ -22,2 +22,2 @@ collectCoverage: true,

export default jestConfig;
export default jestConfig;
{
"name": "@amplication/plugin-observability-opentelemetry",
"version": "2.0.0",
"version": "2.0.1-beta.pr-289.0d3954c",
"description": "This plugin is created to add integrate opentelemetry to the amplication app",
"main": "dist/index.js",
"nx": {},
"scripts": {

@@ -19,4 +20,4 @@ "prepublishOnly": "npm run build",

"devDependencies": {
"@amplication/code-gen-types": "^2.0.8",
"@amplication/code-gen-utils": "^0.0.5",
"@amplication/code-gen-types": "^2.0.17",
"@amplication/code-gen-utils": "^0.0.7",
"@babel/parser": "^7.20.7",

@@ -23,0 +24,0 @@ "@babel/types": "^7.20.7",

# @amplication/plugin-observability-opentelemetry
<!-- [![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-auth-basic)](https://www.npmjs.com/package/@amplication/plugin-auth-basic) -->
[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-observability-opentelemetry)](https://www.npmjs.com/package/@amplication/plugin-observability-opentelemetry)

@@ -98,1 +98,5 @@ This plugin helps in integrating Opentelemetry into your app generated by Amplication and sends the telemetry data to the [**Jaeger**](https://www.jaegertracing.io/docs/1.21/opentelemetry/) agent.

Running `npm run lint` will lint your plugin's source code. If run with `npm run lint:fix` it will also fix the linting errors.
### `prettier`
Running `npm run format:write` will format your plugin's source code.

@@ -85,3 +85,5 @@ import {

...templateMapping["MODULES"].elements,
opentelemetryModule(serviceName || context.resourceInfo?.name || "sample-service"),
opentelemetryModule(
serviceName || context.resourceInfo?.name || "sample-service"
),
]);

@@ -88,0 +90,0 @@

@@ -22,3 +22,3 @@ import {

staticFiles.replaceModulesCode((code) =>
staticFiles.replaceModulesCode((_path, code) =>
code

@@ -25,0 +25,0 @@ .replaceAll(placeholders.otelAgentGrpcEndpoint, OTEL_COLLECTOR_PORT_GRPC)

@@ -1,2 +0,5 @@

import { CreateServerAppModuleParams, DsgContext } from "@amplication/code-gen-types";
import {
CreateServerAppModuleParams,
DsgContext,
} from "@amplication/code-gen-types";
import { beforeCreateServerAppModule } from "@events/createAppModule";

@@ -13,3 +16,5 @@ import { mock } from "jest-mock-extended";

context = mock<DsgContext>({
pluginInstallations: [{ npm: "@amplication/plugin-observability-opentelemetry" }],
pluginInstallations: [
{ npm: "@amplication/plugin-observability-opentelemetry" },
],
resourceInfo: {

@@ -20,8 +25,6 @@ name: "sample-service",

eventParams = mock<CreateServerAppModuleParams>({
template: builders.file(
builders.program([]),
),
template: builders.file(builders.program([])),
templateMapping: {
MODULES: builders.arrayExpression([]),
}
},
});

@@ -38,3 +41,6 @@ });

it("should add the opentelemetry module to the modules list", () => {
const { templateMapping } = beforeCreateServerAppModule(context, eventParams);
const { templateMapping } = beforeCreateServerAppModule(
context,
eventParams
);

@@ -50,3 +56,6 @@ const moduleCode = recast.prettyPrint(templateMapping["MODULES"]).code;

const { templateMapping } = beforeCreateServerAppModule(context, eventParams);
const { templateMapping } = beforeCreateServerAppModule(
context,
eventParams
);

@@ -53,0 +62,0 @@ const moduleCode = recast.prettyPrint(templateMapping["MODULES"]).code;

@@ -1,2 +0,5 @@

import { CreateServerDockerComposeParams, DsgContext } from "@amplication/code-gen-types";
import {
CreateServerDockerComposeParams,
DsgContext,
} from "@amplication/code-gen-types";
import { beforeCreateServerDockerCompose } from "@events/createDockerCompose";

@@ -11,6 +14,8 @@ import { mock } from "jest-mock-extended";

context = mock<DsgContext>({
pluginInstallations: [{ npm: "@amplication/plugin-observability-opentelemetry" }],
pluginInstallations: [
{ npm: "@amplication/plugin-observability-opentelemetry" },
],
});
eventParams = mock<CreateServerDockerComposeParams>({
updateProperties: []
updateProperties: [],
});

@@ -20,42 +25,43 @@ });

it("should add required values to docker-compose.yml", () => {
const { updateProperties } = beforeCreateServerDockerCompose(context, eventParams);
const { updateProperties } = beforeCreateServerDockerCompose(
context,
eventParams
);
expect(updateProperties[0]).toEqual(
{
services: {
server: {
environment: {
JAEGER_AGENT_HOST: "${JAEGER_AGENT_HOST}",
JAEGER_AGENT_PORT: "${JAEGER_AGENT_PORT}",
OTEL_COLLECTOR_HOST: "${OTEL_COLLECTOR_HOST}",
OTEL_COLLECTOR_PORT_GRPC: "${OTEL_COLLECTOR_PORT_GRPC}",
OTEL_COLLECTOR_PORT_HTTP: "${OTEL_COLLECTOR_PORT_HTTP}",
OTEL_EXPORTER_OTLP_ENDPOINT: "${OTEL_EXPORTER_OTLP_ENDPOINT}",
},
expect(updateProperties[0]).toEqual({
services: {
server: {
environment: {
JAEGER_AGENT_HOST: "${JAEGER_AGENT_HOST}",
JAEGER_AGENT_PORT: "${JAEGER_AGENT_PORT}",
OTEL_COLLECTOR_HOST: "${OTEL_COLLECTOR_HOST}",
OTEL_COLLECTOR_PORT_GRPC: "${OTEL_COLLECTOR_PORT_GRPC}",
OTEL_COLLECTOR_PORT_HTTP: "${OTEL_COLLECTOR_PORT_HTTP}",
OTEL_EXPORTER_OTLP_ENDPOINT: "${OTEL_EXPORTER_OTLP_ENDPOINT}",
},
jaeger: {
image: "jaegertracing/all-in-one:latest",
ports: [
"${JAEGER_AGENT_PORT}:${JAEGER_AGENT_PORT}", // Jaeger agent UI
"14268:14268",
"14250:14250",
],
},
opentelemetry: {
image: "otel/opentelemetry-collector:latest",
ports: [
"${OTEL_COLLECTOR_PORT_GRPC}:${OTEL_COLLECTOR_PORT_GRPC}", // gRPC
"${OTEL_COLLECTOR_PORT_HTTP}:${OTEL_COLLECTOR_PORT_HTTP}", // HTTP
"1888:1888", // pprof extension
"13133:13133", // health check extension
"55670:55679", // zpages debugging extension
],
volumes: ["./otel-config.yml:/etc/otel-config.yml"],
command: ["--config=/etc/otel-config.yml"],
depends_on: ["jaeger"],
},
},
jaeger: {
image: "jaegertracing/all-in-one:latest",
ports: [
"${JAEGER_AGENT_PORT}:${JAEGER_AGENT_PORT}", // Jaeger agent UI
"14268:14268",
"14250:14250",
],
},
opentelemetry: {
image: "otel/opentelemetry-collector:latest",
ports: [
"${OTEL_COLLECTOR_PORT_GRPC}:${OTEL_COLLECTOR_PORT_GRPC}", // gRPC
"${OTEL_COLLECTOR_PORT_HTTP}:${OTEL_COLLECTOR_PORT_HTTP}", // HTTP
"1888:1888", // pprof extension
"13133:13133", // health check extension
"55670:55679", // zpages debugging extension
],
volumes: ["./otel-config.yml:/etc/otel-config.yml"],
command: ["--config=/etc/otel-config.yml"],
depends_on: ["jaeger"],
},
},
);
});
});
});
});

@@ -1,2 +0,5 @@

import { CreateServerDockerComposeDBParams, DsgContext } from "@amplication/code-gen-types";
import {
CreateServerDockerComposeDBParams,
DsgContext,
} from "@amplication/code-gen-types";
import { beforeCreateServerDockerComposeDev } from "@events/createDockerCompose";

@@ -11,6 +14,8 @@ import { mock } from "jest-mock-extended";

context = mock<DsgContext>({
pluginInstallations: [{ npm: "@amplication/plugin-observability-opentelemetry" }],
pluginInstallations: [
{ npm: "@amplication/plugin-observability-opentelemetry" },
],
});
eventParams = mock<CreateServerDockerComposeDBParams>({
updateProperties: []
updateProperties: [],
});

@@ -20,32 +25,33 @@ });

it("should add required values to docker-compose.yml", () => {
const { updateProperties } = beforeCreateServerDockerComposeDev(context, eventParams);
const { updateProperties } = beforeCreateServerDockerComposeDev(
context,
eventParams
);
expect(updateProperties[0]).toEqual(
{
services: {
jaeger: {
image: "jaegertracing/all-in-one:latest",
ports: [
"${JAEGER_AGENT_PORT}:${JAEGER_AGENT_PORT}", // Jaeger agent UI
"14268:14268",
"14250:14250",
],
},
opentelemetry: {
image: "otel/opentelemetry-collector:latest",
ports: [
"${OTEL_COLLECTOR_PORT_GRPC}:${OTEL_COLLECTOR_PORT_GRPC}", // gRPC
"${OTEL_COLLECTOR_PORT_HTTP}:${OTEL_COLLECTOR_PORT_HTTP}", // HTTP
"1888:1888", // pprof extension
"13133:13133", // health check extension
"55670:55679", // zpages debugging extension
],
volumes: ["./otel-config.yml:/etc/otel-config.yml"],
command: ["--config=/etc/otel-config.yml"],
depends_on: ["jaeger"],
},
expect(updateProperties[0]).toEqual({
services: {
jaeger: {
image: "jaegertracing/all-in-one:latest",
ports: [
"${JAEGER_AGENT_PORT}:${JAEGER_AGENT_PORT}", // Jaeger agent UI
"14268:14268",
"14250:14250",
],
},
opentelemetry: {
image: "otel/opentelemetry-collector:latest",
ports: [
"${OTEL_COLLECTOR_PORT_GRPC}:${OTEL_COLLECTOR_PORT_GRPC}", // gRPC
"${OTEL_COLLECTOR_PORT_HTTP}:${OTEL_COLLECTOR_PORT_HTTP}", // HTTP
"1888:1888", // pprof extension
"13133:13133", // health check extension
"55670:55679", // zpages debugging extension
],
volumes: ["./otel-config.yml:/etc/otel-config.yml"],
command: ["--config=/etc/otel-config.yml"],
depends_on: ["jaeger"],
},
},
);
});
});
});
});

@@ -1,2 +0,5 @@

import { CreateServerDotEnvParams, DsgContext } from "@amplication/code-gen-types";
import {
CreateServerDotEnvParams,
DsgContext,
} from "@amplication/code-gen-types";
import { beforeCreateServerDotEnv } from "@events/createDotEnv";

@@ -11,5 +14,7 @@ import { mock } from "jest-mock-extended";

context = mock<DsgContext>({
pluginInstallations: [{
npm: "@amplication/plugin-observability-opentelemetry",
}],
pluginInstallations: [
{
npm: "@amplication/plugin-observability-opentelemetry",
},
],
});

@@ -29,6 +34,7 @@ eventParams = mock<CreateServerDotEnvParams>({

{
OTEL_EXPORTER_OTLP_ENDPOINT: "http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}"
OTEL_EXPORTER_OTLP_ENDPOINT:
"http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}",
},
{ JAEGER_AGENT_HOST: "jaeger" },
{ JAEGER_AGENT_PORT: "16686" }
{ JAEGER_AGENT_PORT: "16686" },
];

@@ -53,6 +59,7 @@

{
OTEL_EXPORTER_OTLP_ENDPOINT: "http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}"
OTEL_EXPORTER_OTLP_ENDPOINT:
"http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}",
},
{ JAEGER_AGENT_HOST: "jaeger" },
{ JAEGER_AGENT_PORT: "1234" }
{ JAEGER_AGENT_PORT: "1234" },
];

@@ -62,2 +69,2 @@

});
});
});

@@ -1,2 +0,7 @@

import { BuildLogger, DsgContext, LoadStaticFilesParams, ModuleMap } from "@amplication/code-gen-types";
import {
BuildLogger,
DsgContext,
LoadStaticFilesParams,
ModuleMap,
} from "@amplication/code-gen-types";
import fg from "fast-glob";

@@ -16,6 +21,8 @@ import * as fs from "fs";

context = mock<DsgContext>({
pluginInstallations: [{ npm: "@amplication/plugin-observability-opentelemetry" }],
pluginInstallations: [
{ npm: "@amplication/plugin-observability-opentelemetry" },
],
utils: {
importStaticModules: async (source, basePath) => {
const directory = `${(source)}/`;
const directory = `${source}/`;
const staticModules = await fg(`${directory}**/*`, {

@@ -28,14 +35,12 @@ absolute: false,

const modules = await Promise.all(
staticModules
.sort()
.map(async (module) => {
return {
path: module.replace(directory, basePath ? basePath + "/" : ""),
code: await fs.promises.readFile(module, "utf-8"),
};
})
staticModules.sort().map(async (module) => {
return {
path: module.replace(directory, basePath ? basePath + "/" : ""),
code: await fs.promises.readFile(module, "utf-8"),
};
})
);
const moduleMap: ModuleMap = new ModuleMap(logger);
for await (const module of modules) {

@@ -46,4 +51,4 @@ await moduleMap.set(module);

return moduleMap;
}
}
},
},
});

@@ -55,3 +60,7 @@ modules = new ModuleMap(logger);

it("should use default settings if no settings are provided", async () => {
const StaticModules = await afterLoadStaticFiles(context, eventParams, modules);
const StaticModules = await afterLoadStaticFiles(
context,
eventParams,
modules
);
// snapshot the module maps

@@ -68,6 +77,10 @@ expect(StaticModules.modules()).toMatchSnapshot();

const StaticModules = await afterLoadStaticFiles(context, eventParams, modules);
const StaticModules = await afterLoadStaticFiles(
context,
eventParams,
modules
);
// snapshot the module maps
expect(StaticModules.modules()).toMatchSnapshot();
});
});
});
{
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*.ts"
],
"include": ["src/**/*.ts"],
"compilerOptions": {

@@ -17,5 +15,3 @@ "baseUrl": ".",

},
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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