@mastra/deployer-cloud 0.0.0-fix-backport-setserver-20251201151948 → 0.0.0-fix-request-context-as-query-key-20251209093005

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,69 +0,0 @@
1
- import { MastraCloudExporter } from '@mastra/cloud';
2
- import {
3
- NodeSDK,
4
- getNodeAutoInstrumentations,
5
- ATTR_SERVICE_NAME,
6
- resourceFromAttributes,
7
- ParentBasedSampler,
8
- TraceIdRatioBasedSampler,
9
- AlwaysOnSampler,
10
- AlwaysOffSampler,
11
- OTLPHttpExporter,
12
- } from '@mastra/core/telemetry/otel-vendor';
13
-
14
- import { telemetry } from './telemetry-config.mjs';
15
-
16
- function getSampler(config) {
17
- if (!config.sampling) {
18
- return new AlwaysOnSampler();
19
- }
20
-
21
- if (!config.enabled) {
22
- return new AlwaysOffSampler();
23
- }
24
-
25
- switch (config.sampling.type) {
26
- case 'ratio':
27
- return new TraceIdRatioBasedSampler(config.sampling.probability);
28
- case 'always_on':
29
- return new AlwaysOnSampler();
30
- case 'always_off':
31
- return new AlwaysOffSampler();
32
- case 'parent_based':
33
- const rootSampler = new TraceIdRatioBasedSampler(config.sampling.root?.probability || 1.0);
34
- return new ParentBasedSampler({ root: rootSampler });
35
- default:
36
- return new AlwaysOnSampler();
37
- }
38
- }
39
-
40
- async function getExporter(config) {
41
- if (config.export?.type === 'otlp') {
42
- return new OTLPHttpExporter({
43
- url: config.export.endpoint,
44
- headers: config.export.headers,
45
- });
46
- } else if (config.export?.type === 'custom') {
47
- return config.export.exporter;
48
- } else {
49
- console.info('Using default Mastra Cloud Exporter');
50
- return new MastraCloudExporter({
51
- endpoint: process.env.BUSINESS_API_TRACE_ENDPOINT,
52
- accessToken: process.env.BUSINESS_JWT_TOKEN,
53
- });
54
- }
55
- }
56
-
57
- const sampler = getSampler(telemetry);
58
- const exporter = await getExporter(telemetry);
59
-
60
- const sdk = new NodeSDK({
61
- resource: resourceFromAttributes({
62
- [ATTR_SERVICE_NAME]: telemetry.serviceName || 'default-service',
63
- }),
64
- sampler,
65
- traceExporter: exporter,
66
- instrumentations: [getNodeAutoInstrumentations()],
67
- });
68
-
69
- sdk.start();