Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **`*Create` classes are now `@internal` and hidden from the public library.**
They were internal by doc-comment convention only; the barrel exported them,
so `AttributesCreate.create()` etc. were callable by any consumer — an open
factory-bypass door, contradicting the beta.8/9 removal of factory cheat
paths. The analyzer now rejects outside-package use
(`invalid_use_of_internal_member`). Factories and same-package code are
unaffected. Consumers constructing objects must go through `OTelAPI` or the
installed `OTelFactory`. Covers all 29 `*Create` classes, including the
new `CompositePropagatorCreate`.

- **Breaking: the semantic-convention enums are now generated from the
OpenTelemetry registry with OTel Weaver, one file per registry
namespace** (#50, #51). The hand-written `semantics.dart`,
Expand Down
61 changes: 32 additions & 29 deletions lib/dartastic_opentelemetry_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
library;

// Baggage
export 'src/api/baggage/baggage.dart';
export 'src/api/baggage/baggage.dart' hide BaggageCreate;
export 'src/api/baggage/baggage_entry.dart';
// Common
export 'src/api/common/attribute.dart';
export 'src/api/common/attributes.dart';
export 'src/api/common/instrumentation_scope.dart';
export 'src/api/common/attribute.dart' hide AttributeCreate;
export 'src/api/common/attributes.dart' hide AttributesCreate;
export 'src/api/common/instrumentation_scope.dart'
hide InstrumentationScopeCreate;
export 'src/api/common/timestamp.dart';
// Context
export 'src/api/context/context.dart';
export 'src/api/context/context_key.dart';
export 'src/api/context/propagation/composite_propagator.dart';
export 'src/api/context/context.dart' hide ContextCreate;
export 'src/api/context/context_key.dart' hide ContextKeyCreate;
export 'src/api/context/propagation/composite_propagator.dart'
hide CompositePropagatorCreate;
export 'src/api/context/propagation/context_propagator.dart';
export 'src/api/context/propagation/noop_text_map_propagator.dart';
export 'src/api/context/propagation/text_map_propagator.dart';
Expand All @@ -31,23 +33,24 @@ export 'src/api/factory/otel_api_factory.dart';
export 'src/api/id/id_generator.dart';
// Log
export 'src/api/logs/log_record.dart';
export 'src/api/logs/logger.dart';
export 'src/api/logs/logger_provider.dart';
export 'src/api/logs/logger.dart' hide LoggerCreate;
export 'src/api/logs/logger_provider.dart' hide LogProviderCreate;
export 'src/api/logs/severity.dart';
//Metrics
export 'src/api/metrics/counter.dart';
export 'src/api/metrics/gauge.dart';
export 'src/api/metrics/histogram.dart';
export 'src/api/metrics/counter.dart' hide CounterCreate;
export 'src/api/metrics/gauge.dart' hide GaugeCreate;
export 'src/api/metrics/histogram.dart' hide HistogramCreate;
export 'src/api/metrics/instrument.dart';
export 'src/api/metrics/measurement.dart';
export 'src/api/metrics/meter.dart';
export 'src/api/metrics/meter_provider.dart';
export 'src/api/metrics/measurement.dart' hide MeasurementCreate;
export 'src/api/metrics/meter.dart' hide APIMeterCreate;
export 'src/api/metrics/meter_provider.dart' hide MeterProviderCreate;
export 'src/api/metrics/observable_callback.dart';
export 'src/api/metrics/observable_counter.dart';
export 'src/api/metrics/observable_gauge.dart';
export 'src/api/metrics/observable_counter.dart' hide ObservableCounterCreate;
export 'src/api/metrics/observable_gauge.dart' hide ObservableGaugeCreate;
export 'src/api/metrics/observable_result.dart';
export 'src/api/metrics/observable_up_down_counter.dart';
export 'src/api/metrics/up_down_counter.dart';
export 'src/api/metrics/observable_up_down_counter.dart'
hide ObservableUpDownCounterCreate;
export 'src/api/metrics/up_down_counter.dart' hide UpDownCounterCreate;
// API
export 'src/api/otel_api.dart';
// Semantics
Expand All @@ -56,17 +59,17 @@ export 'src/api/semantics/rum.dart';
export 'src/api/semantics/semantics_base.dart';
export 'src/api/semantics/semconv/semconv.dart';
// Trace
export 'src/api/trace/span.dart';
export 'src/api/trace/span_context.dart';
export 'src/api/trace/span_event.dart';
export 'src/api/trace/span_id.dart';
export 'src/api/trace/span.dart' hide APISpanCreate;
export 'src/api/trace/span_context.dart' hide SpanContextCreate;
export 'src/api/trace/span_event.dart' hide SpanEventCreate;
export 'src/api/trace/span_id.dart' hide SpanIdCreate;
export 'src/api/trace/span_kind.dart';
export 'src/api/trace/span_link.dart';
export 'src/api/trace/trace_flags.dart';
export 'src/api/trace/trace_id.dart';
export 'src/api/trace/trace_state.dart';
export 'src/api/trace/tracer.dart';
export 'src/api/trace/tracer_provider.dart';
export 'src/api/trace/span_link.dart' hide SpanLinkCreate;
export 'src/api/trace/trace_flags.dart' hide TraceFlagsCreate;
export 'src/api/trace/trace_id.dart' hide TraceIdCreate;
export 'src/api/trace/trace_state.dart' hide TraceStateCreate;
export 'src/api/trace/tracer.dart' hide TracerCreate;
export 'src/api/trace/tracer_provider.dart' hide TracerProviderCreate;
export 'src/factory/otel_factory.dart';
// Util
export 'src/util/default_time_provider.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/src/api/baggage/baggage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';

import '../../factory/otel_factory.dart';
import '../../util/otel_log.dart';
import 'baggage_entry.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/baggage/baggage_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'baggage.dart';

/// Factory for creating Baggage instances.
/// This is used internally by the OpenTelemetry API implementation.
@internal
class BaggageCreate {
/// Creates a new Baggage instance with the specified entries.
///
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/common/attribute_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ part of 'attribute.dart';
/// Factory class for creating Attribute instances.
/// This class is not intended to be used directly by users.
/// Instead, use the methods provided by the OpenTelemetry API.
@internal
class AttributeCreate {
/// Creates a new Attribute with the specified name and value.
///
Expand Down
1 change: 0 additions & 1 deletion lib/src/api/common/attributes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:convert';

import 'package:collection/collection.dart';
import 'package:meta/meta.dart';

import '../../factory/otel_factory.dart';
import '../../util/otel_log.dart';
import 'attribute.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/common/attributes_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ part of 'attributes.dart';
/// Used internally and not exported to respect factories.
/// This class is not intended to be used directly by users.
/// Instead, use the methods provided by the OpenTelemetry API.
@internal
class AttributesCreate {
/// Creates a new Attributes instance containing the specified attributes.
///
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/common/instrumentation_scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

library;

import 'package:meta/meta.dart';
import '../otel_api.dart';
import 'attributes.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/src/api/common/instrumentation_scope_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ part of 'instrumentation_scope.dart';
/// Used internally and not exported to respect factories.
/// This class is not intended to be used directly by users.
/// Instead, use the methods provided by the [OTelAPI].
@internal
class InstrumentationScopeCreate {
/// Creates a new InstrumentationScope instance containing the specified attributes.
/// [name] is required and represents the instrumentation scope name (e.g. 'io.opentelemetry.contrib.mongodb')
Expand Down
1 change: 0 additions & 1 deletion lib/src/api/common/timestamp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import 'package:fixnum/fixnum.dart';
import 'package:meta/meta.dart';

import '../../util/time.dart';

/// Utility class for working with OpenTelemetry timestamps.
Expand Down
1 change: 0 additions & 1 deletion lib/src/api/context/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'dart:convert';
import 'dart:typed_data';

import 'package:meta/meta.dart';

import '../../factory/otel_factory.dart';
import '../baggage/baggage.dart';
import '../trace/span.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/context/context_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ part of 'context.dart';
/// Factory class for creating Context instances.
///
/// This is a part of the Context library and not meant to be used directly.
@internal
class ContextCreate {
/// Creates a new Context with the given context map and optional baggage.
///
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/context/context_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import 'dart:typed_data';
import 'package:meta/meta.dart';
import '../id/id_generator.dart';

part 'context_key_create.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/context/context_key_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ part of 'context_key.dart';
/// Factory class for creating ContextKey instances.
///
/// This is a part of the Context library and not meant to be used directly.
@internal
class ContextKeyCreate<T> {
/// Creates a new ContextKey with the specified name and unique identifier.
///
Expand Down
3 changes: 3 additions & 0 deletions lib/src/api/context/propagation/composite_propagator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';

import '../context.dart';
import 'text_map_propagator.dart';

Expand Down Expand Up @@ -45,6 +47,7 @@ class CompositePropagator<C, V> implements TextMapPropagator<C, V> {
/// Internal constructor access for [CompositePropagator].
/// Used by `OTelFactory` implementations; users should create composite
/// propagators with `OTelAPI.compositePropagator`.
@internal
class CompositePropagatorCreate {
/// Creates a [CompositePropagator] delegating to [propagators].
static CompositePropagator<C, V> create<C, V>(
Expand Down
1 change: 0 additions & 1 deletion lib/src/api/context/propagation/context_propagator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';

import '../context.dart';

/// A propagator for binary values that can inject into and extract from a carrier.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/logs/logger.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';
import '../context/context.dart';
import 'severity.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/logs/logger_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

part of 'logger.dart';

@internal
class LoggerCreate {
/// Creates a Logger, only accessible within library
static APILogger create({
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/logs/logger_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// ignore_for_file: unnecessary_getters_setters

import 'package:meta/meta.dart';
import '../../util/otel_log.dart';
import '../common/attributes.dart';
import '../common/signal_instance_key.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/logs/logger_provider_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

part of 'logger_provider.dart';

@internal
class LogProviderCreate {
/// Creates a new [APIMeterProvider] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/counter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';
import 'meter.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/counter_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'counter.dart';

/// Factory methods for creating [APICounter] instances.
/// This is part of the counter.dart file to keep related code together.
@internal
class CounterCreate {
/// Creates a new [APICounter] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/gauge.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';
import 'meter.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/gauge_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'gauge.dart';

/// Factory methods for creating [APIGauge] instances.
/// This is part of the gauge.dart file to keep related code together.
@internal
class GaugeCreate {
/// Creates a new [APIGauge] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/histogram.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';
import 'meter.dart';

Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/histogram_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'histogram.dart';

/// Factory methods for creating [APIHistogram] instances.
/// This is part of the histogram.dart file to keep related code together.
@internal
class HistogramCreate {
/// Creates a new [APIHistogram] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/measurement.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';

part 'measurement_create.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/measurement_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
part of 'measurement.dart';

/// Factory methods for creating [Measurement] instances.
@internal
class MeasurementCreate<T extends num> {
/// Creates a new [Measurement] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/meter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import '../common/attributes.dart';
import '../otel_api.dart';
import 'counter.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/meter_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ part of 'meter.dart';
/// This is part of the meter.dart file to keep related code together.
/// Factory class for creating APIMeter instances.
/// This class is internal and should not be used directly by application code.
@internal
class APIMeterCreate {
/// Creates a new [APIMeter] instance with the specified parameters.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/meter_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// ignore_for_file: unnecessary_getters_setters

import 'package:meta/meta.dart';
import '../../util/otel_log.dart';
import '../common/attributes.dart';
import '../common/signal_instance_key.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/meter_provider_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
part of 'meter_provider.dart';

/// Factory methods for creating [APIMeterProvider] instances.
@internal
class MeterProviderCreate {
/// Creates a new [APIMeterProvider] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/observable_counter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import 'measurement.dart';
import 'meter.dart';
import 'observable_callback.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/observable_counter_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'observable_counter.dart';

/// Factory methods for creating [APIObservableCounter] instances.
/// This is part of the observable_counter.dart file to keep related code together.
@internal
class ObservableCounterCreate {
/// Creates a new [APIObservableCounter] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/observable_gauge.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import 'measurement.dart';
import 'meter.dart';
import 'observable_callback.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/observable_gauge_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ part of 'observable_gauge.dart';

/// Factory methods for creating [APIObservableGauge] instances.
/// This is part of the observable_gauge.dart file to keep related code together.
@internal
class ObservableGaugeCreate {
/// Creates a new [APIObservableGauge] instance.
/// This is an implementation detail and should not be used directly.
Expand Down
1 change: 1 addition & 0 deletions lib/src/api/metrics/observable_up_down_counter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

import 'package:meta/meta.dart';
import 'measurement.dart';
import 'meter.dart';
import 'observable_callback.dart';
Expand Down
Loading
Loading