Flow PHP

InstrumentationScope

Read onlyYes
FinalYes

Represents the instrumentation scope (library) producing telemetry.

InstrumentationScope identifies the library or application component that is generating telemetry data. This information is attached to all telemetry (spans, logs, metrics) for attribution and filtering.

Example usage:

$scope = new InstrumentationScope(
    name: 'my-service',
    version: '1.2.3',
    schemaUrl: 'https://opentelemetry.io/schemas/1.21.0',
);
Tags
see
https://opentelemetry.io/docs/specs/otel/glossary/#instrumentation-scope

Properties

$attributes  : Attributes
$name  : string
$schemaUrl  : string|null
$version  : string

Methods

__construct()  : mixed
fromArray()  : self
Create an InstrumentationScope from a normalized array representation.
normalize()  : array{name: string, version: string, schemaUrl: null|string, attributes: array}
Normalize the scope to an array representation for serialization.
withAttributes()  : self
Create a new scope with additional attributes merged with existing ones.
withSchemaUrl()  : self
Create a new scope with a specific schema URL.

Properties

Methods

__construct()

public __construct(string $name[, string $version = 'unknown' ][, null|string $schemaUrl = null ][, Attributes $attributes = new Attributes() ]) : mixed
Parameters
$name : string

The name of the instrumentation scope (typically library or service name)

$version : string = 'unknown'

The version of the instrumentation scope

$schemaUrl : null|string = null

The schema URL for semantic conventions used by this scope

$attributes : Attributes = new Attributes()

Additional scope attributes

fromArray()

Create an InstrumentationScope from a normalized array representation.

public static fromArray(array{name: string, version?: string, schemaUrl?: null|string, attributes?: array$data) : self
Parameters
$data : array{name: string, version?: string, schemaUrl?: null|string, attributes?: array}
Return values
self

normalize()

Normalize the scope to an array representation for serialization.

public normalize() : array{name: string, version: string, schemaUrl: null|string, attributes: array}
Return values
array{name: string, version: string, schemaUrl: null|string, attributes: array}

withAttributes()

Create a new scope with additional attributes merged with existing ones.

public withAttributes(array<string, array<string|int, bool|float|int|string>|bool|float|int|string> $attributes) : self
Parameters
$attributes : array<string, array<string|int, bool|float|int|string>|bool|float|int|string>
Return values
self

withSchemaUrl()

Create a new scope with a specific schema URL.

public withSchemaUrl(string $schemaUrl) : self
Parameters
$schemaUrl : string
Return values
self

        
On this page

Search results