Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

// DO NOT EDIT, this is an Auto-generated file from script/semantic-conventions

declare(strict_types=1);

namespace OpenTelemetry\SemConv\Metrics;

interface {{ ctx.root_namespace | pascal_case }}
{
{# blank line #}
{%- for metric in ctx.metrics %}
{% set const_name = metric.metric_name | screaming_snake_case %}
{%- if metric is deprecated %}
{%- set deprecated_phpdoc = "@deprecated" -%}
{% else %}
{% set deprecated_phpdoc = "" %}
{%- endif -%}
{%- if metric is stable -%}
{%- set stability_phpdoc = "@stable" -%}
{%- else -%}
{%- set stability_phpdoc = "@experimental" -%}
{%- endif -%}
{%- set instrument_phpdoc = "Instrument: " ~ metric.instrument -%}
{%- set unit_phpdoc = "Unit: " ~ metric.unit -%}
{{ [metric.brief, concat_if(metric.note), instrument_phpdoc, unit_phpdoc, deprecated_phpdoc, stability_phpdoc] | comment(indent=4) | replace(' \n', '\n') }}
public const {{ const_name }} = '{{ metric.metric_name }}';

{% endfor %}
}
{# blank line #}
12 changes: 12 additions & 0 deletions script/semantic-conventions/templates/registry/php/weaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ params:
# this behavior is fully controlled by jinja templates
# TODO exclude more namespaces, eg: ios, aspnetcore, signalr, android, dotnet, jvm, kestrel, browser, device, ...
excluded_namespaces: [cloudfoundry, dotnet, hw, nodejs, profile]
excluded_metrics_namespaces: [aspnetcore, azure, cicd, container, cpu, cpython, db, dns, dotnet, faas, gen_ai, go, hw, jvm, k8s, kestrel, messaging, nodejs, process, rpc, signalr, system, v8js, vcs]

# excluded attributes will be commented out in the generated code
# this behavior is fully controlled by jinja templates
Expand Down Expand Up @@ -55,6 +56,17 @@ templates:
| map(.[-1])
application_mode: single
file_name: "ResourceAttributeValues.php"
- template: Metrics.php.j2
filter: >
semconv_grouped_metrics({
"exclude_root_namespace": $excluded_metrics_namespaces,
"exclude_stability": [],
}) | map({
root_namespace: .root_namespace,
metrics: .metrics,
})
application_mode: each
file_name: "Metrics/{{ctx.root_namespace | pascal_case}}.php"
whitespace_control:
trim_blocks: true
lstrip_blocks: true
Expand Down
115 changes: 115 additions & 0 deletions src/SemConv/Metrics/Http.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

// DO NOT EDIT, this is an Auto-generated file from script/semantic-conventions

declare(strict_types=1);

namespace OpenTelemetry\SemConv\Metrics;

interface Http
{
/**
* Number of active HTTP requests.
*
* Instrument: updowncounter
* Unit: {request}
*
* @experimental
*/
public const HTTP_CLIENT_ACTIVE_REQUESTS = 'http.client.active_requests';

/**
* The duration of the successfully established outbound HTTP connections.
*
* Instrument: histogram
* Unit: s
*
* @experimental
*/
public const HTTP_CLIENT_CONNECTION_DURATION = 'http.client.connection.duration';

/**
* Number of outbound HTTP connections that are currently active or idle on the client.
*
* Instrument: updowncounter
* Unit: {connection}
*
* @experimental
*/
public const HTTP_CLIENT_OPEN_CONNECTIONS = 'http.client.open_connections';

/**
* Size of HTTP client request bodies.
* The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
*
* Instrument: histogram
* Unit: By
*
* @experimental
*/
public const HTTP_CLIENT_REQUEST_BODY_SIZE = 'http.client.request.body.size';

/**
* Duration of HTTP client requests.
*
* Instrument: histogram
* Unit: s
*
* @stable
*/
public const HTTP_CLIENT_REQUEST_DURATION = 'http.client.request.duration';

/**
* Size of HTTP client response bodies.
* The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
*
* Instrument: histogram
* Unit: By
*
* @experimental
*/
public const HTTP_CLIENT_RESPONSE_BODY_SIZE = 'http.client.response.body.size';

/**
* Number of active HTTP server requests.
*
* Instrument: updowncounter
* Unit: {request}
*
* @experimental
*/
public const HTTP_SERVER_ACTIVE_REQUESTS = 'http.server.active_requests';

/**
* Size of HTTP server request bodies.
* The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
*
* Instrument: histogram
* Unit: By
*
* @experimental
*/
public const HTTP_SERVER_REQUEST_BODY_SIZE = 'http.server.request.body.size';

/**
* Duration of HTTP server requests.
*
* Instrument: histogram
* Unit: s
*
* @stable
*/
public const HTTP_SERVER_REQUEST_DURATION = 'http.server.request.duration';

/**
* Size of HTTP server response bodies.
* The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
*
* Instrument: histogram
* Unit: By
*
* @experimental
*/
public const HTTP_SERVER_RESPONSE_BODY_SIZE = 'http.server.response.body.size';

}
Loading
Loading