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

Feature/reduce modules #2

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
now compiles
  • Loading branch information
mike dupont committed Jan 2, 2025
commit 6f182a9ca427efcd204149e0be9c1cfcd7843a38
3 changes: 3 additions & 0 deletions agent/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# --trace-event-categories node,node.bootstrap,node.console,node.vm.script,v8,node.http,node.net.native,node.environment
node --enable-source-maps --heap-prof --expose-gc --prof --cpu-prof --loader ts-node/esm src/index.ts "--isRoot" "--characters=characters/eliza.character.json"
97 changes: 78 additions & 19 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
console.log("Hello agent")
//
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
import { NodeSDK } from '@opentelemetry/sdk-node';
//import { NodeSDK } from '@opentelemetry/sdk-node';
import { SpanExporter, Span } from '@opentelemetry/sdk-trace-base';
// , ExportResult
import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { PeriodicExportingMetricReader, ConsoleMetricExporter,} from '@opentelemetry/sdk-metrics';
@@ -35,25 +39,80 @@ const options = {
}
}
const traceExporter_zipkin = new ZipkinExporter(options);
// parts from https://stackoverflow.com/questions/71654897/opentelemetry-typescript-project-zipkin-exporter

const sdk = new NodeSDK({
resource: new Resource({
[ATTR_SERVICE_NAME]: 'eliza-agent',
[ATTR_SERVICE_VERSION]: '1.0',
}),
//traceExporter: new ConsoleSpanExporter(),
traceExporter: traceExporter_zipkin,
instrumentations: [getNodeAutoInstrumentations(),
new HttpInstrumentation()

],
});
const traceExporter = new ConsoleSpanExporter();


export class CustomConsoleSpanExporter implements SpanExporter {
export(spans: Span[], resultCallback: (result: ExportResult) => void): void {
console.log("hello1")
traceExporter.export(spans,resultCallback);
traceExporter.export(traceExporter_zipkin,resultCallback);
for (const span of spans) {
const spanData = {
name: span.name,
traceId: span.spanContext().traceId,
spanId: span.spanContext().spanId,
startTime: span.startTime,
endTime: span.endTime,
attributes: span.attributes,
events: span.events,
status: span.status,
kind: span.kind,
};
console.log(JSON.stringify(spanData, null, 2));
}
resultCallback(ExportResult.SUCCESS);
}
shutdown(): Promise<void> {
return Promise.resolve();
}
}
//const myExporter = new CustomConsoleSpanExporter()

// For troubleshooting, set the log level to DiagLogLevel.DEBUG
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);
// parts from https://stackoverflow.com/questions/71654897/opentelemetry-typescript-project-zipkin-exporter
//const { SimpleSpanProcessor } = import('@opentelemetry/sdk-trace-base');
import { NodeTracerProvider, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node";
const txz=new SimpleSpanProcessor(traceExporter_zipkin);
const tx=new SimpleSpanProcessor(traceExporter);

try {
const serviceName = 'eliza-agent';
const provider = new NodeTracerProvider({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: serviceName,
[ATTR_SERVICE_NAME]: serviceName,
[ATTR_SERVICE_VERSION]: '1.0', }),
spanProcessors: [
txz,
tx
]
});

console.log(sdk.start());
// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
provider.register();

registerInstrumentations({
instrumentations: [
getNodeAutoInstrumentations(),
new HttpInstrumentation(),
],
});

opentelemetry.trace.getTracer('http-example');
console.log("setup!")
} catch(error){
console.log("ERROR",error)
}
// const sdk = new NodeSDK({ resource: new Resource({

// //traceExporter: new ConsoleSpanExporter(),
// traceExporter: myExporter,
// //traceExporter_zipkin
// instrumentations: [, new HttpInstrumentation() ],
// });
// // For troubleshooting, set the log level to DiagLogLevel.DEBUG
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);
// console.log(sdk.start());


import { PostgresDatabaseAdapter } from "@elizaos/adapter-postgres";
58 changes: 58 additions & 0 deletions packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
./docs/package.json
./packages/plugin-ton/package.json
./packages/plugin-video-generation/package.json
./packages/plugin-coinbase/package.json
./packages/plugin-coinbase/advanced-sdk-ts/package.json
./packages/plugin-twitter/package.json
./packages/plugin-echochambers/package.json
./packages/plugin-tee/package.json
./packages/client-telegram/package.json
./packages/plugin-solana/package.json
./packages/plugin-image-generation/package.json
./packages/plugin-fuel/package.json
./packages/plugin-bootstrap/package.json
./packages/plugin-conflux/package.json
./packages/plugin-near/package.json
./packages/adapter-sqljs/package.json
./packages/plugin-trustdb/package.json
./packages/plugin-aptos/package.json
./packages/client-twitter/package.json
./packages/client-slack/package.json
./packages/plugin-node/package.json
./packages/plugin-flow/package.json
./packages/client-direct/package.json
./packages/plugin-0g/package.json
./packages/adapter-supabase/package.json
./packages/plugin-intiface/package.json
./packages/client-github/package.json
./packages/plugin-zksync-era/package.json
./packages/plugin-abstract/package.json
./packages/client-auto/package.json
./packages/plugin-goat/package.json
./packages/client-discord/package.json
./packages/plugin-ferePro/package.json
./packages/plugin-cronoszkevm/package.json
./packages/plugin-web-search/package.json
./packages/plugin-gitbook/package.json
./packages/plugin-whatsapp/package.json
./packages/plugin-icp/package.json
./packages/core/package.json
./packages/plugin-sui/package.json
./packages/adapter-sqlite/package.json
./packages/plugin-avalanche/package.json
./packages/_examples/plugin/package.json
./packages/plugin-multiversx/package.json
./packages/adapter-redis/package.json
./packages/client-farcaster/package.json
./packages/plugin-nft-generation/package.json
./packages/create-eliza-app/package.json
./packages/adapter-postgres/package.json
./packages/plugin-story/package.json
./packages/plugin-starknet/package.json
./packages/plugin-evm/package.json
./packages/client-lens/package.json
./packages/plugin-3d-generation/package.json
./package.json
./scripts/jsdoc-automation/package.json
./client/package.json
./agent/package.json
Loading