@aztec/telemetry-client 0.0.1-commit.3469e52 → 0.0.1-commit.35158ae7e

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/src/start.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createLogger } from '@aztec/foundation/log';
1
+ import { type LoggerBindings, createLogger } from '@aztec/foundation/log';
2
2
 
3
3
  import type { TelemetryClientConfig } from './config.js';
4
4
  import { NoopTelemetryClient } from './noop.js';
@@ -9,8 +9,11 @@ export * from './config.js';
9
9
  let initialized = false;
10
10
  let telemetry: TelemetryClient = new NoopTelemetryClient();
11
11
 
12
- export async function initTelemetryClient(config: TelemetryClientConfig): Promise<TelemetryClient> {
13
- const log = createLogger('telemetry:client');
12
+ export async function initTelemetryClient(
13
+ config: TelemetryClientConfig,
14
+ bindings?: LoggerBindings,
15
+ ): Promise<TelemetryClient> {
16
+ const log = createLogger('telemetry:client', bindings);
14
17
  if (initialized) {
15
18
  log.warn('Telemetry client has already been initialized once');
16
19
  return telemetry;
package/src/telemetry.ts CHANGED
@@ -20,7 +20,7 @@ import type * as Attributes from './attributes.js';
20
20
  import type { MetricDefinition } from './metrics.js';
21
21
  import { getTelemetryClient } from './start.js';
22
22
 
23
- export { toMetricOptions } from './metric-utils.js';
23
+ export { toMetricOptions, createUpDownCounterWithDefault } from './metric-utils.js';
24
24
 
25
25
  export { type Span, SpanStatusCode, ValueType, type Context } from '@opentelemetry/api';
26
26
 
@@ -56,8 +56,10 @@ type BannedMetricAttributeNames = (typeof Attributes)[
56
56
  /** Global registry of attributes */
57
57
  export type AttributesType = Partial<Record<AttributeNames, AttributeValue>>;
58
58
 
59
+ export type AllowedAttributeNames = Exclude<AttributeNames, BannedMetricAttributeNames>;
60
+
59
61
  /** Subset of attributes allowed to be added to metrics */
60
- export type MetricAttributesType = Partial<Record<Exclude<AttributeNames, BannedMetricAttributeNames>, AttributeValue>>;
62
+ export type MetricAttributesType = Partial<Record<AllowedAttributeNames, AttributeValue>>;
61
63
 
62
64
  /** Re-export MetricDefinition for convenience */
63
65
  export type { MetricDefinition } from './metrics.js';
@@ -13,7 +13,7 @@ export class TraceableL2BlockStream extends L2BlockStream implements Traceable {
13
13
  constructor(
14
14
  l2BlockSource: Pick<
15
15
  L2BlockSource,
16
- 'getL2BlocksNew' | 'getBlockHeader' | 'getL2Tips' | 'getPublishedCheckpoints' | 'getCheckpointedBlocks'
16
+ 'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
17
17
  >,
18
18
  localData: L2BlockStreamLocalDataProvider,
19
19
  handler: L2BlockStreamEventHandler,