@backstage/backend-plugin-api 1.9.1-next.1 → 1.9.1

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @backstage/backend-plugin-api
2
2
 
3
+ ## 1.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 90b572e: Adds an alpha `TracingService` to provide a unified interface for emitting trace spans across Backstage plugins.
8
+ - 6209065: Added `context` and `propagation` to the alpha `TracingService`. Plugins can bridge OpenTelemetry context across async boundaries via `tracing.propagation.extract(tracing.context.active(), carrier)` followed by `tracing.context.with(ctx, fn)`, and read propagated baggage via `tracing.propagation.getActiveBaggage()` or `tracing.propagation.getBaggage(ctx)`.
9
+ - Updated dependencies
10
+ - @backstage/errors@1.3.1
11
+ - @backstage/plugin-permission-node@0.11.0
12
+ - @backstage/plugin-auth-node@0.7.1
13
+ - @backstage/plugin-permission-common@0.9.9
14
+ - @backstage/cli-common@0.2.2
15
+ - @backstage/config@1.3.8
16
+
3
17
  ## 1.9.1-next.1
4
18
 
5
19
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"refs.cjs.js","sources":["../../src/alpha/refs.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createServiceRef } from '@backstage/backend-plugin-api';\n\n/**\n * Service for calling distributed actions\n *\n * See {@link ActionsService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsServiceRef = createServiceRef<\n import('./ActionsService').ActionsService\n>({\n id: 'alpha.core.actions',\n});\n\n/**\n * Service for registering and managing distributed actions.\n *\n * See {@link ActionsRegistryService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions-registry | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsRegistryServiceRef = createServiceRef<\n import('./ActionsRegistryService').ActionsRegistryService\n>({\n id: 'alpha.core.actionsRegistry',\n});\n\n/**\n * Read information about your current Backstage deployment.\n * @alpha\n */\nexport const rootSystemMetadataServiceRef = createServiceRef<\n import('./RootSystemMetadataService').RootSystemMetadataService\n>({\n id: 'alpha.core.rootSystemMetadata',\n scope: 'root',\n});\n\n/**\n * Service for managing metrics.\n *\n * @alpha\n */\nexport const metricsServiceRef = createServiceRef<\n import('./MetricsService').MetricsService\n>({\n id: 'alpha.core.metrics',\n});\n\n/**\n * Service for managing trace spans.\n *\n * See {@link TracingService} for the API surface.\n *\n * @alpha\n */\nexport const tracingServiceRef = createServiceRef<\n import('./TracingService').TracingService\n>({\n id: 'alpha.core.tracing',\n});\n"],"names":["createServiceRef"],"mappings":";;;;AA2BO,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAA4BA,iCAAA,CAEvC;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAMM,MAAM,+BAA+BA,iCAAA,CAE1C;AAAA,EACA,EAAA,EAAI,+BAAA;AAAA,EACJ,KAAA,EAAO;AACT,CAAC;AAOM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AASM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;;;;;;;;"}
1
+ {"version":3,"file":"refs.cjs.js","sources":["../../src/alpha/refs.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createServiceRef } from '@backstage/backend-plugin-api';\n\n/**\n * Service for calling distributed actions\n *\n * See {@link ActionsService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsServiceRef = createServiceRef<\n import('./ActionsService').ActionsService\n>({\n id: 'alpha.core.actions',\n});\n\n/**\n * Service for registering and managing distributed actions.\n *\n * See {@link ActionsRegistryService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions-registry | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsRegistryServiceRef = createServiceRef<\n import('./ActionsRegistryService').ActionsRegistryService\n>({\n id: 'alpha.core.actionsRegistry',\n});\n\n/**\n * Read information about your current Backstage deployment.\n * @alpha\n */\nexport const rootSystemMetadataServiceRef = createServiceRef<\n import('./RootSystemMetadataService').RootSystemMetadataService\n>({\n id: 'alpha.core.rootSystemMetadata',\n scope: 'root',\n});\n\n/**\n * Service for managing metrics.\n *\n * @alpha\n */\nexport const metricsServiceRef = createServiceRef<\n import('./MetricsService').MetricsService\n>({\n id: 'alpha.core.metrics',\n});\n\n/**\n * Service for managing trace spans.\n *\n * See `TracingService` for the API surface.\n *\n * @alpha\n */\nexport const tracingServiceRef = createServiceRef<\n import('./TracingService').TracingService\n>({\n id: 'alpha.core.tracing',\n});\n"],"names":["createServiceRef"],"mappings":";;;;AA2BO,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAA4BA,iCAAA,CAEvC;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAMM,MAAM,+BAA+BA,iCAAA,CAE1C;AAAA,EACA,EAAA,EAAI,+BAAA;AAAA,EACJ,KAAA,EAAO;AACT,CAAC;AAOM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AASM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;;;;;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -356,7 +356,92 @@ interface TracingService {
356
356
  * Runs `fn` inside a new active span. The span is finished when `fn`
357
357
  * resolves or throws.
358
358
  */
359
- startActiveSpan<T>(name: string, fn: (span: TracingServiceSpan) => T | Promise<T>, options?: TracingServiceSpanOptions): Promise<T>;
359
+ startActiveSpan<T>(name: string, fn: (span: TracingServiceSpan) => T | Promise<T>): Promise<T>;
360
+ /**
361
+ * Runs `fn` inside a new active span configured by `options`. The
362
+ * span is finished when `fn` resolves or throws.
363
+ */
364
+ startActiveSpan<T>(name: string, options: TracingServiceSpanOptions, fn: (span: TracingServiceSpan) => T | Promise<T>): Promise<T>;
365
+ /**
366
+ * Read the active tracing context, or run work within a specific
367
+ * one.
368
+ */
369
+ readonly context: TracingServiceContextAPI;
370
+ /**
371
+ * Extract a caller's tracing context from an inbound carrier, and
372
+ * read baggage from a context. Use these to bridge context across
373
+ * boundaries where automatic propagation is lost — for example,
374
+ * when a request arrives over a transport that does not
375
+ * automatically attach the caller's context.
376
+ */
377
+ readonly propagation: TracingServicePropagationAPI;
378
+ }
379
+ /**
380
+ * Read the active tracing context, or run work within a specific one.
381
+ * The context carries the active span and propagation fields (trace
382
+ * parent, baggage) for the current unit of work, and is automatically
383
+ * inherited by spans created via `startActiveSpan`.
384
+ *
385
+ * @alpha
386
+ */
387
+ interface TracingServiceContextAPI {
388
+ /** Returns the currently active context. */
389
+ active(): TracingServiceContext;
390
+ /** Runs `fn` with the supplied context set as the active context. */
391
+ with<T>(context: TracingServiceContext, fn: () => T | Promise<T>): Promise<T>;
392
+ }
393
+ /**
394
+ * Extract a caller's trace parent and baggage from an inbound carrier
395
+ * (typically HTTP headers), or read baggage from a context. Use these
396
+ * to bridge context across boundaries where automatic propagation is
397
+ * lost.
398
+ *
399
+ * @alpha
400
+ */
401
+ interface TracingServicePropagationAPI {
402
+ /**
403
+ * Returns a new context with propagation fields (trace parent,
404
+ * baggage, ...) read from the supplied carrier merged into it.
405
+ */
406
+ extract(context: TracingServiceContext, carrier: Record<string, string | string[] | undefined>): TracingServiceContext;
407
+ /**
408
+ * Returns the baggage attached to the supplied context, or
409
+ * `undefined` when none is present.
410
+ */
411
+ getBaggage(context: TracingServiceContext): TracingServiceBaggage | undefined;
412
+ /**
413
+ * Returns the baggage attached to the currently active context, or
414
+ * `undefined` when none is present. Equivalent to
415
+ * `getBaggage(context.active())`.
416
+ */
417
+ getActiveBaggage(): TracingServiceBaggage | undefined;
418
+ }
419
+ /**
420
+ * Opaque handle representing a tracing context. Consumers receive
421
+ * these from {@link TracingServiceContextAPI.active} or
422
+ * {@link TracingServicePropagationAPI.extract} and pass them back into
423
+ * the API; the type carries no inspectable fields.
424
+ *
425
+ * @alpha
426
+ */
427
+ interface TracingServiceContext {
428
+ readonly $$type: '@backstage/TracingServiceContext';
429
+ }
430
+ /**
431
+ * A read-only view of propagated baggage entries.
432
+ *
433
+ * @alpha
434
+ */
435
+ interface TracingServiceBaggage {
436
+ getAllEntries(): Array<[string, TracingServiceBaggageEntry]>;
437
+ }
438
+ /**
439
+ * A single baggage entry.
440
+ *
441
+ * @alpha
442
+ */
443
+ interface TracingServiceBaggageEntry {
444
+ value: string;
360
445
  }
361
446
 
362
447
  /**
@@ -393,11 +478,11 @@ declare const metricsServiceRef: _backstage_backend_plugin_api.ServiceRef<Metric
393
478
  /**
394
479
  * Service for managing trace spans.
395
480
  *
396
- * See {@link TracingService} for the API surface.
481
+ * See `TracingService` for the API surface.
397
482
  *
398
483
  * @alpha
399
484
  */
400
485
  declare const tracingServiceRef: _backstage_backend_plugin_api.ServiceRef<TracingService, "plugin", "singleton">;
401
486
 
402
487
  export { actionsRegistryServiceRef, actionsServiceRef, metricsServiceRef, rootSystemMetadataServiceRef, tracingServiceRef };
403
- export type { ActionsRegistryActionContext, ActionsRegistryActionExample, ActionsRegistryActionOptions, ActionsRegistryService, ActionsService, ActionsServiceAction, MetricAdvice, MetricAttributeValue, MetricAttributes, MetricOptions, MetricsService, MetricsServiceCounter, MetricsServiceGauge, MetricsServiceHistogram, MetricsServiceObservable, MetricsServiceObservableCallback, MetricsServiceObservableCounter, MetricsServiceObservableGauge, MetricsServiceObservableResult, MetricsServiceObservableUpDownCounter, MetricsServiceUpDownCounter, RootSystemMetadataService, RootSystemMetadataServicePluginInfo, TracingService, TracingServiceAttributeValue, TracingServiceAttributes, TracingServiceSpan, TracingServiceSpanKind, TracingServiceSpanOptions, TracingServiceSpanStatus };
488
+ export type { ActionsRegistryActionContext, ActionsRegistryActionExample, ActionsRegistryActionOptions, ActionsRegistryService, ActionsService, ActionsServiceAction, MetricAdvice, MetricAttributeValue, MetricAttributes, MetricOptions, MetricsService, MetricsServiceCounter, MetricsServiceGauge, MetricsServiceHistogram, MetricsServiceObservable, MetricsServiceObservableCallback, MetricsServiceObservableCounter, MetricsServiceObservableGauge, MetricsServiceObservableResult, MetricsServiceObservableUpDownCounter, MetricsServiceUpDownCounter, RootSystemMetadataService, RootSystemMetadataServicePluginInfo, TracingService, TracingServiceAttributeValue, TracingServiceAttributes, TracingServiceBaggage, TracingServiceBaggageEntry, TracingServiceContext, TracingServiceContextAPI, TracingServicePropagationAPI, TracingServiceSpan, TracingServiceSpanKind, TracingServiceSpanOptions, TracingServiceSpanStatus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api",
3
- "version": "1.9.1-next.1",
3
+ "version": "1.9.1",
4
4
  "description": "Core API used by Backstage backend plugins",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -65,13 +65,13 @@
65
65
  "test": "backstage-cli package test"
66
66
  },
67
67
  "dependencies": {
68
- "@backstage/cli-common": "0.2.2-next.0",
69
- "@backstage/config": "1.3.8-next.0",
70
- "@backstage/errors": "1.3.1-next.0",
71
- "@backstage/plugin-auth-node": "0.7.1-next.1",
72
- "@backstage/plugin-permission-common": "0.9.9-next.1",
73
- "@backstage/plugin-permission-node": "0.10.13-next.0",
74
- "@backstage/types": "1.2.2",
68
+ "@backstage/cli-common": "^0.2.2",
69
+ "@backstage/config": "^1.3.8",
70
+ "@backstage/errors": "^1.3.1",
71
+ "@backstage/plugin-auth-node": "^0.7.1",
72
+ "@backstage/plugin-permission-common": "^0.9.9",
73
+ "@backstage/plugin-permission-node": "^0.11.0",
74
+ "@backstage/types": "^1.2.2",
75
75
  "@types/express": "^4.17.6",
76
76
  "@types/json-schema": "^7.0.6",
77
77
  "@types/luxon": "^3.0.0",
@@ -81,8 +81,8 @@
81
81
  "zod": "^3.25.76 || ^4.0.0"
82
82
  },
83
83
  "devDependencies": {
84
- "@backstage/backend-test-utils": "1.11.3-next.2",
85
- "@backstage/cli": "0.36.2-next.1"
84
+ "@backstage/backend-test-utils": "^1.11.3",
85
+ "@backstage/cli": "^0.36.2"
86
86
  },
87
87
  "configSchema": "config.d.ts"
88
88
  }