drone-path 0.9.0 → 0.11.0
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.
- package/CHANGELOG.md +64 -0
- package/README.md +16 -14
- package/THIRD-PARTY-NOTICES.md +7 -7
- package/app/ipc.d.mts +43 -0
- package/app/ipc.mjs +216 -0
- package/app/main.mjs +10 -204
- package/dist/appsession.js +34 -75
- package/dist/appstate.js +24 -21
- package/dist/buildinfo.js +9 -16
- package/dist/cammeta-decode.js +237 -0
- package/dist/cammeta.js +8 -247
- package/dist/cli.js +40 -32
- package/dist/config.js +333 -173
- package/dist/configfile.js +20 -7
- package/dist/errors.js +30 -0
- package/dist/exec-tool.js +13 -0
- package/dist/exportjob.js +7 -7
- package/dist/{fftools.js → ffmpeg-tools.js} +5 -4
- package/dist/{ff.js → ffmpeg.js} +14 -29
- package/dist/frametime.js +32 -0
- package/dist/geo.js +1 -1
- package/dist/manual/build.js +5 -10
- package/dist/manual/cliref.js +4 -1
- package/dist/manual/reference.js +6 -11
- package/dist/{run.js → pipeline.js} +100 -143
- package/dist/png.js +1 -18
- package/dist/{proto.js → protobuf-wire.js} +5 -5
- package/dist/range.js +3 -3
- package/dist/{page.js → render-page.js} +2 -2
- package/dist/render.js +25 -115
- package/dist/renderer/boot.js +2 -2
- package/dist/renderer/dom.js +32 -10
- package/dist/renderer/scene.js +14 -6
- package/dist/restyle.js +1 -1
- package/dist/serve.js +1 -31
- package/dist/srt.js +2 -2
- package/dist/telemetry-json-schema.js +6 -11
- package/dist/telemetry-json.js +46 -27
- package/dist/telemetry-math.js +3 -2
- package/dist/{summary.js → telemetry-summary.js} +4 -4
- package/dist/telemetry.js +32 -18
- package/dist/tiles.js +30 -86
- package/dist/track-format.js +13 -0
- package/dist/track-geojson.js +44 -0
- package/dist/track-gpx.js +34 -0
- package/dist/track-kml.js +47 -0
- package/dist/track-kmz.js +68 -0
- package/dist/track-write.js +41 -0
- package/dist/track.js +79 -0
- package/package.json +13 -14
- package/dist/tracing.js +0 -184
- /package/dist/{renderer/leaflet.js → logging.js} +0 -0
- /package/dist/{inputs.js → recordings.js} +0 -0
package/dist/tracing.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { errorMessage } from './errors.js';
|
|
2
|
-
import { VERSION } from './version.js';
|
|
3
|
-
const SERVICE_NAME = 'drone-path';
|
|
4
|
-
const OTLP_PROTOCOL = 'http/protobuf';
|
|
5
|
-
const noopSpan = {
|
|
6
|
-
setAttribute: () => { },
|
|
7
|
-
setAttributes: () => { },
|
|
8
|
-
fail: () => { },
|
|
9
|
-
end: () => { },
|
|
10
|
-
};
|
|
11
|
-
export const NOOP_TRACER = {
|
|
12
|
-
startSpan: () => noopSpan,
|
|
13
|
-
};
|
|
14
|
-
function envFlag(value) {
|
|
15
|
-
return value?.trim().toLowerCase() === 'true';
|
|
16
|
-
}
|
|
17
|
-
function envText(value) {
|
|
18
|
-
const trimmed = value?.trim();
|
|
19
|
-
return trimmed === '' ? undefined : trimmed;
|
|
20
|
-
}
|
|
21
|
-
export function isTracingEnabled(env = process.env) {
|
|
22
|
-
const endpoint = envText(env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT']) ??
|
|
23
|
-
envText(env['OTEL_EXPORTER_OTLP_ENDPOINT']);
|
|
24
|
-
return endpoint !== undefined && !envFlag(env['OTEL_SDK_DISABLED']);
|
|
25
|
-
}
|
|
26
|
-
// Per OTLP spec the specific endpoint is used as-is; the generic one is a base URL that gets /v1/traces.
|
|
27
|
-
export function otlpTracesUrl(env) {
|
|
28
|
-
const specific = envText(env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT']);
|
|
29
|
-
if (specific)
|
|
30
|
-
return specific;
|
|
31
|
-
const base = envText(env['OTEL_EXPORTER_OTLP_ENDPOINT']);
|
|
32
|
-
return base ? `${base.replace(/\/+$/, '')}/v1/traces` : undefined;
|
|
33
|
-
}
|
|
34
|
-
function parseKeyValueList(value) {
|
|
35
|
-
const out = {};
|
|
36
|
-
for (const pair of (value ?? '').split(',')) {
|
|
37
|
-
const eq = pair.indexOf('=');
|
|
38
|
-
if (eq <= 0)
|
|
39
|
-
continue;
|
|
40
|
-
const key = pair.slice(0, eq).trim();
|
|
41
|
-
const rawValue = pair.slice(eq + 1).trim();
|
|
42
|
-
if (!key)
|
|
43
|
-
continue;
|
|
44
|
-
try {
|
|
45
|
-
out[key] = decodeURIComponent(rawValue);
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
out[key] = rawValue;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return out;
|
|
52
|
-
}
|
|
53
|
-
export function otlpHeaders(env) {
|
|
54
|
-
return {
|
|
55
|
-
...parseKeyValueList(envText(env['OTEL_EXPORTER_OTLP_HEADERS'])),
|
|
56
|
-
...parseKeyValueList(envText(env['OTEL_EXPORTER_OTLP_TRACES_HEADERS'])),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export function resourceAttributesFromEnv(env) {
|
|
60
|
-
const attrs = parseKeyValueList(envText(env['OTEL_RESOURCE_ATTRIBUTES']));
|
|
61
|
-
const serviceName = envText(env['OTEL_SERVICE_NAME']);
|
|
62
|
-
if (serviceName !== undefined)
|
|
63
|
-
attrs['service.name'] = serviceName;
|
|
64
|
-
return attrs;
|
|
65
|
-
}
|
|
66
|
-
function assertSupportedProtocol(env) {
|
|
67
|
-
const specific = envText(env['OTEL_EXPORTER_OTLP_TRACES_PROTOCOL']);
|
|
68
|
-
const generic = envText(env['OTEL_EXPORTER_OTLP_PROTOCOL']);
|
|
69
|
-
const name = specific !== undefined
|
|
70
|
-
? 'OTEL_EXPORTER_OTLP_TRACES_PROTOCOL'
|
|
71
|
-
: 'OTEL_EXPORTER_OTLP_PROTOCOL';
|
|
72
|
-
const value = specific ?? generic;
|
|
73
|
-
if (value !== undefined && value.toLowerCase() !== OTLP_PROTOCOL) {
|
|
74
|
-
throw new Error(`unsupported ${name}: ${value} (only ${OTLP_PROTOCOL} is supported)`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export async function withSpan(tracer, name, options, body) {
|
|
78
|
-
const span = tracer.startSpan(name, options);
|
|
79
|
-
try {
|
|
80
|
-
const result = await body(span);
|
|
81
|
-
span.end();
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
span.fail(e);
|
|
86
|
-
span.end();
|
|
87
|
-
throw e;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
export function stage(tracer, name, parent, attributes, body) {
|
|
91
|
-
return withSpan(tracer, name, { parent, attributes }, body);
|
|
92
|
-
}
|
|
93
|
-
class OtelSpan {
|
|
94
|
-
api;
|
|
95
|
-
raw;
|
|
96
|
-
ended = false;
|
|
97
|
-
constructor(api, raw) {
|
|
98
|
-
this.api = api;
|
|
99
|
-
this.raw = raw;
|
|
100
|
-
}
|
|
101
|
-
setAttribute(name, value) {
|
|
102
|
-
this.raw.setAttribute(name, value);
|
|
103
|
-
}
|
|
104
|
-
setAttributes(values) {
|
|
105
|
-
this.raw.setAttributes(values);
|
|
106
|
-
}
|
|
107
|
-
fail(error) {
|
|
108
|
-
if (this.ended)
|
|
109
|
-
return;
|
|
110
|
-
const exception = error instanceof Error ? error : new Error(errorMessage(error));
|
|
111
|
-
this.raw.recordException(exception);
|
|
112
|
-
this.raw.setStatus({
|
|
113
|
-
code: this.api.SpanStatusCode.ERROR,
|
|
114
|
-
message: exception.message,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
end() {
|
|
118
|
-
if (this.ended)
|
|
119
|
-
return;
|
|
120
|
-
this.ended = true;
|
|
121
|
-
this.raw.end();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
class OtelTracer {
|
|
125
|
-
api;
|
|
126
|
-
raw;
|
|
127
|
-
constructor(api, raw) {
|
|
128
|
-
this.api = api;
|
|
129
|
-
this.raw = raw;
|
|
130
|
-
}
|
|
131
|
-
startSpan(name, options) {
|
|
132
|
-
const parent = options?.parent;
|
|
133
|
-
// Unwrap through Span.raw, not instanceof: a parent without an OpenTelemetry handle would silently detach the new span.
|
|
134
|
-
const parentRaw = parent?.raw;
|
|
135
|
-
if (parent && !parentRaw) {
|
|
136
|
-
throw new Error('parent span carries no OpenTelemetry handle');
|
|
137
|
-
}
|
|
138
|
-
const context = parentRaw
|
|
139
|
-
? this.api.trace.setSpan(this.api.context.active(), parentRaw)
|
|
140
|
-
: undefined;
|
|
141
|
-
return new OtelSpan(this.api, this.raw.startSpan(name, { attributes: options?.attributes }, context));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
export async function createTracing(options = {}) {
|
|
145
|
-
const env = options.env ?? process.env;
|
|
146
|
-
if (!isTracingEnabled(env)) {
|
|
147
|
-
return {
|
|
148
|
-
enabled: false,
|
|
149
|
-
tracer: NOOP_TRACER,
|
|
150
|
-
flush: async () => { },
|
|
151
|
-
shutdown: async () => { },
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
assertSupportedProtocol(env);
|
|
155
|
-
const api = await import('@opentelemetry/api');
|
|
156
|
-
const { TracerProvider, BatchSpanProcessor } = await import('@opentelemetry/sdk-trace');
|
|
157
|
-
const { resourceFromAttributes } = await import('@opentelemetry/resources');
|
|
158
|
-
const { OTLPTraceExporter } = await import('@opentelemetry/exporter-trace-otlp-proto');
|
|
159
|
-
const exporter = options.spanExporter ??
|
|
160
|
-
new OTLPTraceExporter({
|
|
161
|
-
url: otlpTracesUrl(env),
|
|
162
|
-
headers: otlpHeaders(env),
|
|
163
|
-
});
|
|
164
|
-
const resource = resourceFromAttributes({
|
|
165
|
-
'service.name': SERVICE_NAME,
|
|
166
|
-
'service.version': VERSION,
|
|
167
|
-
}).merge(resourceFromAttributes(resourceAttributesFromEnv(env)));
|
|
168
|
-
const provider = new TracerProvider({
|
|
169
|
-
resource,
|
|
170
|
-
spanProcessors: [
|
|
171
|
-
new BatchSpanProcessor({
|
|
172
|
-
exporter,
|
|
173
|
-
// The default queue (2048) drops spans silently; long batches need thousands to survive.
|
|
174
|
-
maxQueueSize: 8192,
|
|
175
|
-
}),
|
|
176
|
-
],
|
|
177
|
-
});
|
|
178
|
-
return {
|
|
179
|
-
enabled: true,
|
|
180
|
-
tracer: new OtelTracer(api, provider.getTracer(SERVICE_NAME, VERSION)),
|
|
181
|
-
flush: () => provider.forceFlush(),
|
|
182
|
-
shutdown: () => provider.shutdown(),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
File without changes
|
|
File without changes
|