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

RCA Metrics - refactored #190

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/checksum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ fi

openssl md5 package.json >> $FILE

find packages/*/package.json | xargs -I{} openssl md5 {} >> $FILE
find plugins/node/*/package.json && find plugins/web/*/package.json && find packages/*/package.json | xargs -I{} openssl md5 {} >> $FILE

sort -o $FILE $FILE
52 changes: 49 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ cache_1: &cache_1
- plugins/node/opentelemetry-plugin-mysql/node_modules
- plugins/node/opentelemetry-plugin-express/node_modules
- propagators/opentelemetry-propagator-jaeger/node_modules
- propagators/opentelemetry-propagator-grpc-census-binary/node_modules
- packages/opentelemetry-rca-metrics/node_modules
- packages/opentelemetry-test-utils/node_modules

node_unit_tests: &node_unit_tests
resource_class: large
Expand All @@ -74,7 +77,7 @@ node_unit_tests: &node_unit_tests
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}
- run:
name: Install Root Dependencies
command: npm install --ignore-scripts
Expand Down Expand Up @@ -109,7 +112,7 @@ browsers_unit_tests: &browsers_unit_tests
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}
- run:
name: Install Root Dependencies
command: npm install --ignore-scripts
Expand All @@ -125,6 +128,40 @@ browsers_unit_tests: &browsers_unit_tests
name: report coverage
command: if [ "$CIRCLE_NODE_VERSION" = "v12" ]; then npm run codecov:browser; fi

build_metrics: &build_metrics
resource_class: large
steps:
- checkout
- run:
name: Create Checksum
command: sh .circleci/checksum.sh /tmp/checksums.txt
- run:
name: Setup environment variables
command: |
echo "export CIRCLE_NODE_VERSION=\$(node --version | grep -oE 'v[0-9]+')" >> $BASH_ENV
source $BASH_ENV
- run:
name: Log out node.js version
command: |
node --version
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}
- run:
name: Install Root Dependencies
command: npm install --ignore-scripts
- run:
name: Boostrap dependencies
command: npx lerna bootstrap --scope @opentelemetry/rca-metrics --include-filtered-dependencies --ignore-scripts
- run:
name: Create prebuilds for native stats
command: npm run build:rca-metrics
- store_artifacts:
path: ./packages/opentelemetry-rca-metrics/artifacts/prebuilds.tgz
- store_artifacts:
path: ./packages/opentelemetry-rca-metrics/artifacts/prebuilds.tgz.sha1

jobs:
node8:
docker:
Expand Down Expand Up @@ -157,6 +194,11 @@ jobs:
docker:
- image: circleci/node:12-browsers
<<: *browsers_unit_tests
build-native-stats:
docker:
- image: node:14
environment: *node_test_env
<<: *build_metrics

workflows:
version: 2
Expand All @@ -166,4 +208,8 @@ workflows:
- node10
- node12
- node12-browsers

- build-native-stats:
filters:
branches:
only:
- master
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,3 @@ package.json.lerna_backup

*.iml
.idea

5 changes: 4 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"karma.conf.js",
"src/platform/browser/*.ts",
"test/index-webpack.ts",
"webpack/*.js"
"webpack/*.js",
"packages/opentelemetry-rca-metrics/scripts/*.js",
".eslintrc.js",
"version.ts"
],
"all": true
}
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ coverage:
default:
target: auto
threshold: 1%
ignore:
- "packages/opentelemetry-rca-metrics/scripts"
19 changes: 19 additions & 0 deletions examples/rca-metrics/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const { RCAMetrics } = require('@opentelemetry/rca-metrics');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');

const exporter = new PrometheusExporter(
{
startServer: true,
},
() => {
console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
},
);

const rcaMetrics = new RCAMetrics({
exporter,
interval: 2000,
});
rcaMetrics.start();
36 changes: 36 additions & 0 deletions examples/rca-metrics/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "rca-metrics-example",
"private": true,
"version": "0.9.0",
"description": "Example of using @opentelemetry/rca-metrics",
"main": "index.js",
"scripts": {
"start": "node node.js"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js-contrib.git"
},
"keywords": [
"opentelemetry",
"http",
"tracing",
"metrics"
],
"engines": {
"node": ">=8"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^0.10.2",
"@opentelemetry/core": "^0.10.2",
"@opentelemetry/exporter-prometheus": "^0.10.2",
"@opentelemetry/metrics": "^0.10.2",
"@opentelemetry/rca-metrics": "^0.9.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"precompile": "tsc --version",
"version:update": "lerna run version:update",
"compile": "lerna run compile",
"build:rca-metrics": "lerna run build:rca-metrics",
"test": "lerna run test",
"test:browser": "lerna run test:browser",
"bootstrap": "lerna bootstrap",
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-rca-metrics/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions packages/opentelemetry-rca-metrics/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../eslint.config.js')
}
Empty file.
4 changes: 4 additions & 0 deletions packages/opentelemetry-rca-metrics/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/bin
/coverage
/doc
/test
Loading