Download the PHP package thesis/opentelemetry-grpc-transport without Composer

On this page you can find all versions of the php package thesis/opentelemetry-grpc-transport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package opentelemetry-grpc-transport

thesis/opentelemetry-grpc-transport

A gRPC transport for opentelemetry-php built on thesis/grpc-client: a drop-in replacement for open-telemetry/transport-grpc that needs no ext-grpc, because the whole gRPC stack — HTTP/2 framing, compression, TLS, load balancing — is plain PHP running on amphp.

Contents

Installation

The package only provides the transport. The OTLP exporters that serialize spans, metrics and logs live in open-telemetry/exporter-otlp.

Replacing open-telemetry/transport-grpc

The package registers its TransportFactory in the SDK registry under the grpc protocol, the same name open-telemetry/transport-grpc uses, so SDK autoconfiguration picks it up without any code changes:

Do not install both packages at once: the registry keeps the factory registered first, so which transport wins depends on the autoload order. Remove open-telemetry/transport-grpc (and ext-grpc along with it, if nothing else needs it):

Usage

TransportFactory implements TransportFactoryInterface, so it plugs into any OTLP exporter in place of the one shipped by the contrib package. The endpoint is a URL whose path is the fully qualified gRPC method of the signal:

Configuration

TransportFactory::create() takes the standard TransportFactoryInterface arguments:

Argument Default Description
$endpoint — http://host[:port]/<method> for plaintext, https://host[:port]/<method> for TLS. The port defaults to 80 / 443, so set :4317 explicitly.
$contentType application/x-protobuf The only supported value, anything else throws InvalidArgumentException.
$headers [] Sent as gRPC metadata with every export.
$compression null gzip or deflate, or a list of algorithms where the first supported one is used. Anything else, br included, disables compression.
$timeout 10 Seconds. A deadline for the whole export, retries and backoff included, also sent to the collector as grpc-timeout.
$retryDelay 100 Milliseconds before the first retry; the delay then grows exponentially up to $retryDelay * 2 ** ($maxRetries - 1).
$maxRetries 3 Retries on top of the first attempt, only for the retryable codes such as UNAVAILABLE.
$cacert null Path to the CA certificate that verifies the collector. Without it the system trust store is used.
$cert, $key null Path to the client certificate and its private key for mTLS.

When the transport is built by SDK autoconfiguration, the exporter factory fills these from the usual environment variables: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TIMEOUT and their per-signal OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_* variants. It does not pass retries or certificates, so those keep their defaults. To set them, create the transport yourself and hand it to the exporter as shown in Usage.

Bringing your own client

The factory only applies what OTLP knows about. Load balancing, endpoint resolvers, connection limits and your own interceptors belong on a Client\Builder, which the factory takes as a constructor argument, leaves untouched and reuses for every transport it creates:

The host, the encoder, the retry interceptor, compression and TLS are set by the factory on top of it and override whatever the builder had for those.

Example

examples/otlp_grpc.php exports a handful of spans to a collector. A Jaeger all-in-one is defined in compose.yaml behind the example profile, so one target brings it up and runs the example against it:

The spans then show up at http://localhost:16686 under the unknown_service:php service.

Against a collector you are running yourself:


All versions of opentelemetry-grpc-transport with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
amphp/amp Version ^3.1
amphp/socket Version ^2.3
open-telemetry/api Version ^1.10
open-telemetry/sdk Version ^1.15
thesis/googleapis-rpc-types Version ^0.3
thesis/grpc-client Version ^0.3
thesis/grpc-deadline Version ^0.1.1
thesis/grpc-protocol Version ^0.3
thesis/grpc-retry Version ^0.1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thesis/opentelemetry-grpc-transport contains the following files

Loading the files please wait ...