Skip to content

[WIP] Tracing Demo #98

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

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions tracing/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
16 changes: 16 additions & 0 deletions tracing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Tracing Demo
## How To Run
1. Install the Polywrap CLI
`nvm install && nvm use && yarn`

2. Start the tracing service:
`npx polywrap infra up --modules tracer`

3. Open the tracing UI:
Open - http://localhost:3301

4. Run the demo application:
`cd app && yarn && yarn build && yarn test`

5. View the trace logs from the Polywrap client:
View - http://localhost:3301
23 changes: 23 additions & 0 deletions tracing/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions tracing/app/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.13.0
19 changes: 19 additions & 0 deletions tracing/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "templates-app-typescript-node",
"description": "Polywrap App TypeScript Node Template",
"private": true,
"version": "0.6.0",
"scripts": {
"build": "npx polywrap app codegen",
"test": "ts-node ./src/index.ts"
},
"dependencies": {
"@polywrap/client-js": "0.6.0"
},
"devDependencies": {
"@types/node": "12.12.26",
"polywrap": "0.6.0",
"ts-node": "10.7.0",
"typescript": "4.0.7"
}
}
6 changes: 6 additions & 0 deletions tracing/app/polywrap.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
format: 0.2.0
project:
name: Sample
type: app/typescript
source:
schema: ./schema.graphql
2 changes: 2 additions & 0 deletions tracing/app/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#import * into HelloWorld from "ens/helloworld.polytest.eth"
#import * into Ethereum from "ens/ethereum.polywrap.eth"
43 changes: 43 additions & 0 deletions tracing/app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { HelloWorld_Module, Ethereum_Module } from "./wrap";

import { PolywrapClient } from "@polywrap/client-js";
import { TracingLevel } from "@polywrap/tracing-js";

const client = new PolywrapClient({
tracerConfig: {
tracingLevel: TracingLevel.Low,
httpEnabled: true,
consoleEnabled: true,
consoleDetailed: true
}
});

async function main() {
console.log("Invoking: logMessage");

await HelloWorld_Module.logMessage({
message: "Hello there"
}, client);

await HelloWorld_Module.logMessage({
message: "Hello again"
}, client);

await HelloWorld_Module.logMessage({
message: "One last time..."
}, client);

const result = await Ethereum_Module.encodeParams({
types: ["address", "uint256"],
values: ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"]
}, client);

console.log(`Ethereum_Module.encodeParams:\n${result.data}`);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
30 changes: 30 additions & 0 deletions tracing/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"esModuleInterop": true,
"lib": [
"es2015",
"es5",
"dom"
],
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": true,
"preserveSymlinks": true,
"preserveWatchOutput": true,
"pretty": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"module": "commonjs",
"sourceMap": true,
"target": "es5",
"resolveJsonModule": true,
"strictNullChecks": true
},
"include": [
"./src/**/*"
],
}
Loading