Skip to content

Commit ca18a5d

Browse files
abhiaiyer91tylerslaton
authored andcommitted
Adding streamVNext to agui
1 parent 429b8a2 commit ca18a5d

File tree

293 files changed

+12861
-1939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+12861
-1939
lines changed

typescript-sdk/apps/dojo/.mastra/output/index.mjs

Lines changed: 8102 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import { createLogger } from '@mastra/core/logger';
2+
import { LibSQLStore } from '@mastra/core/storage/libsql';
3+
import { OTLPStorageExporter } from '@mastra/core/telemetry';
4+
import {
5+
NodeSDK,
6+
getNodeAutoInstrumentations,
7+
ATTR_SERVICE_NAME,
8+
Resource,
9+
ParentBasedSampler,
10+
TraceIdRatioBasedSampler,
11+
AlwaysOnSampler,
12+
AlwaysOffSampler,
13+
OTLPHttpExporter,
14+
OTLPGrpcExporter,
15+
} from '@mastra/core/telemetry/otel-vendor';
16+
import { telemetry } from './telemetry-config.mjs';
17+
18+
function getSampler(config) {
19+
if (!config.sampling) {
20+
return new AlwaysOnSampler();
21+
}
22+
23+
if (!config.enabled) {
24+
return new AlwaysOffSampler();
25+
}
26+
27+
switch (config.sampling.type) {
28+
case 'ratio':
29+
return new TraceIdRatioBasedSampler(config.sampling.probability);
30+
case 'always_on':
31+
return new AlwaysOnSampler();
32+
case 'always_off':
33+
return new AlwaysOffSampler();
34+
case 'parent_based':
35+
const rootSampler = new TraceIdRatioBasedSampler(config.sampling.root?.probability || 1.0);
36+
return new ParentBasedSampler({ root: rootSampler });
37+
default:
38+
return new AlwaysOnSampler();
39+
}
40+
}
41+
42+
async function getExporter(config) {
43+
if (config.export?.type === 'otlp') {
44+
if(config.export?.protocol === "grpc") {
45+
return new OTLPGrpcExporter({
46+
url: config.export.endpoint,
47+
headers: config.export.headers,
48+
})
49+
}
50+
return new OTLPHttpExporter({
51+
url: config.export.endpoint,
52+
headers: config.export.headers,
53+
});
54+
} else if (config.export?.type === 'custom') {
55+
return config.export.exporter;
56+
} else {
57+
const storage = new LibSQLStore({
58+
config: {
59+
url: 'file:.mastra/mastra.db',
60+
},
61+
});
62+
await storage.init();
63+
64+
return new OTLPStorageExporter({
65+
logger: createLogger({
66+
name: 'telemetry',
67+
level: 'silent',
68+
}),
69+
storage,
70+
});
71+
}
72+
}
73+
74+
const sampler = getSampler(telemetry);
75+
const exporter = await getExporter(telemetry);
76+
77+
const sdk = new NodeSDK({
78+
resource: new Resource({
79+
[ATTR_SERVICE_NAME]: telemetry.serviceName || 'default-service',
80+
}),
81+
sampler,
82+
traceExporter: exporter,
83+
instrumentations: [getNodeAutoInstrumentations()],
84+
});
85+
86+
sdk.start();
87+
88+
// gracefully shut down the SDK on process exit
89+
process.on('SIGTERM', () => {
90+
sdk.shutdown().catch(() => {
91+
// do nothing
92+
});
93+
});
94+
843 KB
Binary file not shown.
19.4 KB
Binary file not shown.

typescript-sdk/apps/dojo/.mastra/output/playground/assets/abap-DsBKuouk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript-sdk/apps/dojo/.mastra/output/playground/assets/actionscript-3-D_z4Izcz.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript-sdk/apps/dojo/.mastra/output/playground/assets/ada-727ZlQH0.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)