drone-path 0.0.0-stage → 0.8.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 +179 -0
- package/LICENSE +21 -0
- package/README.md +84 -2
- package/THIRD-PARTY-NOTICES.md +77 -0
- package/app/main.mjs +496 -0
- package/app/preload.cjs +31 -0
- package/app/update-policy.d.mts +6 -0
- package/app/update-policy.mjs +6 -0
- package/app/update.d.mts +10 -0
- package/app/update.mjs +54 -0
- package/bin/drone-path.mjs +5 -0
- package/dist/appassets.js +44 -0
- package/dist/apppaths.js +28 -0
- package/dist/appsession.js +128 -0
- package/dist/appstate.js +109 -0
- package/dist/assets.js +67 -0
- package/dist/cammeta.js +292 -0
- package/dist/changeset-gate.js +46 -0
- package/dist/cli.js +156 -0
- package/dist/config.js +469 -0
- package/dist/configfile.js +81 -0
- package/dist/decimate.js +94 -0
- package/dist/errors.js +4 -0
- package/dist/exportjob.js +106 -0
- package/dist/ff.js +121 -0
- package/dist/fftools.js +65 -0
- package/dist/geo.js +70 -0
- package/dist/inputs.js +59 -0
- package/dist/manual/anchors.js +23 -0
- package/dist/manual/build.js +78 -0
- package/dist/manual/cliref.js +36 -0
- package/dist/manual/links.js +76 -0
- package/dist/manual/markdown.js +101 -0
- package/dist/manual/model.js +4 -0
- package/dist/manual/module.js +8 -0
- package/dist/manual/nav.js +13 -0
- package/dist/manual/reference.js +26 -0
- package/dist/page.js +108 -0
- package/dist/paths.js +28 -0
- package/dist/plan.js +119 -0
- package/dist/png.js +52 -0
- package/dist/proto.js +102 -0
- package/dist/range.js +58 -0
- package/dist/render.js +408 -0
- package/dist/renderer/boot.js +7 -0
- package/dist/renderer/dom.js +132 -0
- package/dist/renderer/framemath.js +34 -0
- package/dist/renderer/leaflet.js +5 -0
- package/dist/renderer/scene.js +358 -0
- package/dist/renderer/theme.js +34 -0
- package/dist/renderer/tilesources.js +34 -0
- package/dist/renderer/trail.js +53 -0
- package/dist/restyle.js +24 -0
- package/dist/run.js +446 -0
- package/dist/serve.js +70 -0
- package/dist/srt.js +76 -0
- package/dist/summary.js +22 -0
- package/dist/telemetry-math.js +302 -0
- package/dist/telemetry.js +38 -0
- package/dist/tilecache.js +26 -0
- package/dist/tiles.js +241 -0
- package/dist/tracing.js +208 -0
- package/dist/version.js +3 -0
- package/package.json +100 -4
package/dist/tracing.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Without an endpoint no OpenTelemetry package is ever imported, so untraced
|
|
2
|
+
// runs keep their exact output and pay no overhead.
|
|
3
|
+
import { errorMessage } from './errors.js';
|
|
4
|
+
import { VERSION } from './version.js';
|
|
5
|
+
const SERVICE_NAME = 'drone-path';
|
|
6
|
+
const OTLP_PROTOCOL = 'http/protobuf';
|
|
7
|
+
const noopSpan = {
|
|
8
|
+
setAttribute: () => { },
|
|
9
|
+
setAttributes: () => { },
|
|
10
|
+
fail: () => { },
|
|
11
|
+
end: () => { },
|
|
12
|
+
};
|
|
13
|
+
export const NOOP_TRACER = {
|
|
14
|
+
startSpan: () => noopSpan,
|
|
15
|
+
};
|
|
16
|
+
function envFlag(value) {
|
|
17
|
+
return value?.trim().toLowerCase() === 'true';
|
|
18
|
+
}
|
|
19
|
+
function envText(value) {
|
|
20
|
+
// A blank value means "unset": the OTLP lookups fall through on undefined,
|
|
21
|
+
// so an empty string must not count as configured (which ?? would allow).
|
|
22
|
+
const trimmed = value?.trim();
|
|
23
|
+
return trimmed === '' ? undefined : trimmed;
|
|
24
|
+
}
|
|
25
|
+
export function isTracingEnabled(env = process.env) {
|
|
26
|
+
const endpoint = envText(env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT']) ??
|
|
27
|
+
envText(env['OTEL_EXPORTER_OTLP_ENDPOINT']);
|
|
28
|
+
return endpoint !== undefined && !envFlag(env['OTEL_SDK_DISABLED']);
|
|
29
|
+
}
|
|
30
|
+
// The signal-specific endpoint is used as-is; the generic one is a base URL
|
|
31
|
+
// the signal path is appended to (OTLP spec).
|
|
32
|
+
export function otlpTracesUrl(env) {
|
|
33
|
+
const specific = envText(env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT']);
|
|
34
|
+
if (specific)
|
|
35
|
+
return specific;
|
|
36
|
+
const base = envText(env['OTEL_EXPORTER_OTLP_ENDPOINT']);
|
|
37
|
+
return base ? `${base.replace(/\/+$/, '')}/v1/traces` : undefined;
|
|
38
|
+
}
|
|
39
|
+
// `k1=v1,k2=v2` lists with URL-encoded values, as the OTEL header and
|
|
40
|
+
// resource-attribute variables use.
|
|
41
|
+
function parseKeyValueList(value) {
|
|
42
|
+
const out = {};
|
|
43
|
+
for (const pair of (value ?? '').split(',')) {
|
|
44
|
+
const eq = pair.indexOf('=');
|
|
45
|
+
if (eq <= 0)
|
|
46
|
+
continue;
|
|
47
|
+
const key = pair.slice(0, eq).trim();
|
|
48
|
+
const rawValue = pair.slice(eq + 1).trim();
|
|
49
|
+
if (!key)
|
|
50
|
+
continue;
|
|
51
|
+
try {
|
|
52
|
+
out[key] = decodeURIComponent(rawValue);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
out[key] = rawValue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
// Signal-specific headers win per key over the generic ones (OTLP spec).
|
|
61
|
+
export function otlpHeaders(env) {
|
|
62
|
+
return {
|
|
63
|
+
...parseKeyValueList(envText(env['OTEL_EXPORTER_OTLP_HEADERS'])),
|
|
64
|
+
...parseKeyValueList(envText(env['OTEL_EXPORTER_OTLP_TRACES_HEADERS'])),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Parsed here instead of via envDetector because that reads process.env
|
|
68
|
+
// directly, which would leave the env seam half-applied.
|
|
69
|
+
export function resourceAttributesFromEnv(env) {
|
|
70
|
+
const attrs = parseKeyValueList(envText(env['OTEL_RESOURCE_ATTRIBUTES']));
|
|
71
|
+
const serviceName = envText(env['OTEL_SERVICE_NAME']);
|
|
72
|
+
if (serviceName !== undefined)
|
|
73
|
+
attrs['service.name'] = serviceName;
|
|
74
|
+
return attrs;
|
|
75
|
+
}
|
|
76
|
+
// Exporting is fixed to OTLP/HTTP protobuf; a protocol variable promising
|
|
77
|
+
// anything else would silently push into the wrong port of the collector.
|
|
78
|
+
// Per the OTel spec the signal-specific variable wins over the generic one,
|
|
79
|
+
// so only the effective value is judged.
|
|
80
|
+
function assertSupportedProtocol(env) {
|
|
81
|
+
const specific = envText(env['OTEL_EXPORTER_OTLP_TRACES_PROTOCOL']);
|
|
82
|
+
const generic = envText(env['OTEL_EXPORTER_OTLP_PROTOCOL']);
|
|
83
|
+
const name = specific !== undefined
|
|
84
|
+
? 'OTEL_EXPORTER_OTLP_TRACES_PROTOCOL'
|
|
85
|
+
: 'OTEL_EXPORTER_OTLP_PROTOCOL';
|
|
86
|
+
const value = specific ?? generic;
|
|
87
|
+
if (value !== undefined && value.toLowerCase() !== OTLP_PROTOCOL) {
|
|
88
|
+
throw new Error(`unsupported ${name}: ${value} (only ${OTLP_PROTOCOL} is supported)`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// The span ends with the body (or earlier, if the body ends it), and a thrown
|
|
92
|
+
// error is recorded on it before it propagates.
|
|
93
|
+
export async function withSpan(tracer, name, options, body) {
|
|
94
|
+
const span = tracer.startSpan(name, options);
|
|
95
|
+
try {
|
|
96
|
+
const result = await body(span);
|
|
97
|
+
span.end();
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
span.fail(e);
|
|
102
|
+
span.end();
|
|
103
|
+
throw e;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Parent and initial attributes are exactly what every stage site would
|
|
107
|
+
// otherwise spell out again.
|
|
108
|
+
export function stage(tracer, name, parent, attributes, body) {
|
|
109
|
+
return withSpan(tracer, name, { parent, attributes }, body);
|
|
110
|
+
}
|
|
111
|
+
class OtelSpan {
|
|
112
|
+
api;
|
|
113
|
+
raw;
|
|
114
|
+
ended = false;
|
|
115
|
+
constructor(api, raw) {
|
|
116
|
+
this.api = api;
|
|
117
|
+
this.raw = raw;
|
|
118
|
+
}
|
|
119
|
+
setAttribute(name, value) {
|
|
120
|
+
this.raw.setAttribute(name, value);
|
|
121
|
+
}
|
|
122
|
+
setAttributes(values) {
|
|
123
|
+
this.raw.setAttributes(values);
|
|
124
|
+
}
|
|
125
|
+
fail(error) {
|
|
126
|
+
if (this.ended)
|
|
127
|
+
return;
|
|
128
|
+
const exception = error instanceof Error ? error : new Error(errorMessage(error));
|
|
129
|
+
this.raw.recordException(exception);
|
|
130
|
+
this.raw.setStatus({
|
|
131
|
+
code: this.api.SpanStatusCode.ERROR,
|
|
132
|
+
message: exception.message,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
end() {
|
|
136
|
+
if (this.ended)
|
|
137
|
+
return;
|
|
138
|
+
this.ended = true;
|
|
139
|
+
this.raw.end();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
class OtelTracer {
|
|
143
|
+
api;
|
|
144
|
+
raw;
|
|
145
|
+
constructor(api, raw) {
|
|
146
|
+
this.api = api;
|
|
147
|
+
this.raw = raw;
|
|
148
|
+
}
|
|
149
|
+
startSpan(name, options) {
|
|
150
|
+
const parent = options?.parent;
|
|
151
|
+
// Unwrap through the Span interface, not instanceof. A parent without an
|
|
152
|
+
// OpenTelemetry handle (a no-op or foreign span) would silently detach the
|
|
153
|
+
// new span and quietly break the trace topology - refuse it instead.
|
|
154
|
+
const parentRaw = parent?.raw;
|
|
155
|
+
if (parent && !parentRaw) {
|
|
156
|
+
throw new Error('parent span carries no OpenTelemetry handle');
|
|
157
|
+
}
|
|
158
|
+
const context = parentRaw
|
|
159
|
+
? this.api.trace.setSpan(this.api.context.active(), parentRaw)
|
|
160
|
+
: undefined;
|
|
161
|
+
return new OtelSpan(this.api, this.raw.startSpan(name, { attributes: options?.attributes }, context));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// The OpenTelemetry packages are imported here and nowhere else, so a disabled
|
|
165
|
+
// run never loads them.
|
|
166
|
+
export async function createTracing(options = {}) {
|
|
167
|
+
const env = options.env ?? process.env;
|
|
168
|
+
if (!isTracingEnabled(env)) {
|
|
169
|
+
return {
|
|
170
|
+
enabled: false,
|
|
171
|
+
tracer: NOOP_TRACER,
|
|
172
|
+
flush: async () => { },
|
|
173
|
+
shutdown: async () => { },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
assertSupportedProtocol(env);
|
|
177
|
+
const api = await import('@opentelemetry/api');
|
|
178
|
+
const { TracerProvider, BatchSpanProcessor } = await import('@opentelemetry/sdk-trace');
|
|
179
|
+
const { resourceFromAttributes } = await import('@opentelemetry/resources');
|
|
180
|
+
const { OTLPTraceExporter } = await import('@opentelemetry/exporter-trace-otlp-proto');
|
|
181
|
+
const exporter = options.spanExporter ??
|
|
182
|
+
new OTLPTraceExporter({
|
|
183
|
+
url: otlpTracesUrl(env),
|
|
184
|
+
headers: otlpHeaders(env),
|
|
185
|
+
});
|
|
186
|
+
const resource = resourceFromAttributes({
|
|
187
|
+
'service.name': SERVICE_NAME,
|
|
188
|
+
'service.version': VERSION,
|
|
189
|
+
}).merge(resourceFromAttributes(resourceAttributesFromEnv(env)));
|
|
190
|
+
const provider = new TracerProvider({
|
|
191
|
+
resource,
|
|
192
|
+
spanProcessors: [
|
|
193
|
+
new BatchSpanProcessor({
|
|
194
|
+
exporter,
|
|
195
|
+
// The default queue (2048) drops spans silently when the collector is
|
|
196
|
+
// slow or unreachable; long batches make thousands of batch spans that
|
|
197
|
+
// must survive to keep the trace complete.
|
|
198
|
+
maxQueueSize: 8192,
|
|
199
|
+
}),
|
|
200
|
+
],
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
enabled: true,
|
|
204
|
+
tracer: new OtelTracer(api, provider.getTracer(SERVICE_NAME, VERSION)),
|
|
205
|
+
flush: () => provider.forceFlush(),
|
|
206
|
+
shutdown: () => provider.shutdown(),
|
|
207
|
+
};
|
|
208
|
+
}
|
package/dist/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drone-path",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Render flight-path map overlay videos (exactly the source frame rate and frame count) from DJI drone recordings - telemetry from the .SRT sidecar or the embedded CAM-meta (DVTM) stream.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "app/main.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"drone-path": "bin/drone-path.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"app",
|
|
12
|
+
"bin",
|
|
13
|
+
"dist",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"THIRD-PARTY-NOTICES.md"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=24"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"app": "electron app/main.mjs",
|
|
24
|
+
"app:dev": "npm run build:manual && concurrently -k \"next dev ui --webpack -p 3210\" \"wait-on http://127.0.0.1:3210 && electron app/main.mjs --dev-url http://localhost:3210\"",
|
|
25
|
+
"app:pack": "electron-builder --publish never",
|
|
26
|
+
"build": "npm run build:manual && npm run build:ui",
|
|
27
|
+
"build:cli": "tsc -p tsconfig.json",
|
|
28
|
+
"build:manual": "npm run build:cli && node dist/manual/build.js",
|
|
29
|
+
"build:ui": "next build ui --webpack",
|
|
30
|
+
"docs:reference": "npm run build:cli && node dist/manual/reference.js",
|
|
31
|
+
"changeset": "changeset",
|
|
32
|
+
"changeset:version": "changeset version && npm install --package-lock-only",
|
|
33
|
+
"test": "npm run build:manual && npm run typecheck:test && vitest run",
|
|
34
|
+
"typecheck:test": "tsc --noEmit -p test/tsconfig.json",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"prepare": "npm run build"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"dji",
|
|
40
|
+
"drone",
|
|
41
|
+
"telemetry",
|
|
42
|
+
"srt",
|
|
43
|
+
"cam-meta",
|
|
44
|
+
"dvtm",
|
|
45
|
+
"flight-path",
|
|
46
|
+
"map",
|
|
47
|
+
"video",
|
|
48
|
+
"ffmpeg",
|
|
49
|
+
"leaflet"
|
|
50
|
+
],
|
|
51
|
+
"author": "Manuel Warum",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/MrManny/neo2-flightpath.git"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/MrManny/neo2-flightpath/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/MrManny/neo2-flightpath#readme",
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@opentelemetry/api": "~1.10.0",
|
|
63
|
+
"@opentelemetry/exporter-trace-otlp-proto": "~0.300.0",
|
|
64
|
+
"@opentelemetry/resources": "~3.0.0",
|
|
65
|
+
"@opentelemetry/sdk-trace": "~3.0.0",
|
|
66
|
+
"commander": "~15.0.0",
|
|
67
|
+
"electron-updater": "~6.8.11",
|
|
68
|
+
"leaflet": "~1.9.4",
|
|
69
|
+
"playwright-core": "~1.64.1"
|
|
70
|
+
},
|
|
71
|
+
"optionalDependencies": {
|
|
72
|
+
"ffmpeg-ffprobe-static": "~7.1.0-rc.1"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@changesets/cli": "~3.0.3",
|
|
76
|
+
"@eslint/js": "~10.0.1",
|
|
77
|
+
"@next/eslint-plugin-next": "~16.4.3",
|
|
78
|
+
"@testing-library/react": "~16.3.3",
|
|
79
|
+
"@testing-library/user-event": "~14.6.8",
|
|
80
|
+
"@types/node": "~24.19.2",
|
|
81
|
+
"@types/react": "~19.3.0",
|
|
82
|
+
"@types/react-dom": "~19.3.0",
|
|
83
|
+
"concurrently": "~10.0.6",
|
|
84
|
+
"electron": "~45.2.1",
|
|
85
|
+
"electron-builder": "~26.18.0",
|
|
86
|
+
"eslint": "~10.14.0",
|
|
87
|
+
"eslint-plugin-react-hooks": "~7.1.1",
|
|
88
|
+
"jsdom": "~30.1.3",
|
|
89
|
+
"marked": "~18.1.3",
|
|
90
|
+
"next": "~16.4.3",
|
|
91
|
+
"react": "~19.3.1",
|
|
92
|
+
"react-dom": "~19.3.1",
|
|
93
|
+
"typescript": "~6.0.3",
|
|
94
|
+
"typescript-eslint": "~8.72.1",
|
|
95
|
+
"vitest": "~5.1.0",
|
|
96
|
+
"wait-on": "~9.5.1"
|
|
97
|
+
},
|
|
98
|
+
"allowScripts": {
|
|
99
|
+
"electron-winstaller@5.4.0": true,
|
|
100
|
+
"ffmpeg-ffprobe-static@7.1.0-rc.1": true
|
|
101
|
+
}
|
|
102
|
+
}
|