-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker image containing nodejs auto instrumentation (#508)
- Loading branch information
Showing
8 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: "Publish NodeJS Auto-Instrumentation" | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'autoinstrumentation/nodejs/**' | ||
- '.github/workflows/publish-autoinstrumentation-nodejs.yaml' | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2.3.5 | ||
|
||
- name: Read version | ||
run: echo VERSION=$(cat autoinstrumentation/nodejs/package.json | jq -r '.dependencies."@opentelemetry/sdk-node"') >> $GITHUB_ENV | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3.6.0 | ||
with: | ||
images: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs | ||
tags: | | ||
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }} | ||
- name: Login to GitHub Package Registry | ||
uses: docker/login-action@v1.10.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2.7.0 | ||
with: | ||
context: autoinstrumentation/nodejs | ||
push: true | ||
build-args: version=${{ env.VERSION }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:16 AS build | ||
|
||
WORKDIR /operator-build | ||
COPY . . | ||
|
||
RUN npm install | ||
|
||
FROM busybox | ||
|
||
COPY --from=build /operator-build/build/workspace /autoinstrumentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@opentelemetry/k8s-autoinstrumentation", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"clean": "rimraf build/*", | ||
"prepare": "npm run compile", | ||
"compile": "tsc -p .", | ||
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' build/workspace/" | ||
}, | ||
"devDependencies": { | ||
"copyfiles": "^2.4.1", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.4" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "1.0.3", | ||
"@opentelemetry/auto-instrumentations-node": "0.26.0", | ||
"@opentelemetry/exporter-otlp-grpc": "0.26.0", | ||
"@opentelemetry/sdk-node": "0.26.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'; | ||
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-grpc'; | ||
|
||
import { NodeSDK } from '@opentelemetry/sdk-node'; | ||
|
||
const sdk = new NodeSDK({ | ||
autoDetectResources: true, | ||
instrumentations: [getNodeAutoInstrumentations()], | ||
traceExporter: new OTLPTraceExporter(), | ||
}); | ||
|
||
sdk.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "build", | ||
|
||
"allowUnreachableCode": false, | ||
"allowUnusedLabels": false, | ||
"composite": true, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"incremental": true, | ||
"inlineSources": true, | ||
"module": "commonjs", | ||
"newLine": "LF", | ||
"noEmitOnError": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"pretty": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"target": "es2017" | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters