groups:
  - id: metric_attributes.http.server
    type: attribute_group
    brief: 'HTTP server attributes'
    extends: attributes.http.server
    attributes:
      - ref: server.address
        requirement_level: opt_in
        note: |
          See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).
          > **Warning**
          > Since this attribute is based on HTTP headers, opting in to it may allow an attacker
          > to trigger cardinality limits, degrading the usefulness of the metric.
      - ref: server.port
        requirement_level: opt_in
        note: |
          See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).
          > **Warning**
          > Since this attribute is based on HTTP headers, opting in to it may allow an attacker
          > to trigger cardinality limits, degrading the usefulness of the metric.
  - id: metric_attributes.http.client
    type: attribute_group
    brief: 'HTTP client attributes'
    extends: attributes.http.client

  - id: metric.http.server.request.duration
    type: metric
    metric_name: http.server.request.duration
    brief: "Duration of HTTP server requests."
    instrument: histogram
    unit: "s"
    extends: metric_attributes.http.server

  - id: metric.http.server.active_requests
    type: metric
    metric_name: http.server.active_requests
    brief: "Number of active HTTP server requests."
    instrument: updowncounter
    unit: "{request}"
    attributes:
      - ref: http.request.method
        requirement_level: required
      - ref: url.scheme
        requirement_level: required
        examples: ["http", "https"]
      - ref: server.address
        requirement_level: opt_in
        brief: >
          Name of the local HTTP server that received the request.
        note: |
          See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).
          > **Warning**
          > Since this attribute is based on HTTP headers, opting in to it may allow an attacker
          > to trigger cardinality limits, degrading the usefulness of the metric.
      - ref: server.port
        requirement_level: opt_in
        brief: >
          Port of the local HTTP server that received the request.
        note: |
          See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).
          > **Warning**
          > Since this attribute is based on HTTP headers, opting in to it may allow an attacker
          > to trigger cardinality limits, degrading the usefulness of the metric.

  - id: metric.http.server.request.body.size
    type: metric
    metric_name: http.server.request.body.size
    brief: "Size of HTTP server request bodies."
    instrument: histogram
    unit: "By"
    note: >
      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.
    extends: metric_attributes.http.server

  - id: metric.http.server.response.body.size
    type: metric
    metric_name: http.server.response.body.size
    brief: "Size of HTTP server response bodies."
    instrument: histogram
    unit: "By"
    note: >
      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.
    extends: metric_attributes.http.server

  - id: metric.http.client.request.duration
    type: metric
    metric_name: http.client.request.duration
    brief: "Duration of HTTP client requests."
    instrument: histogram
    unit: "s"
    extends: metric_attributes.http.client

  - id: metric.http.client.request.body.size
    type: metric
    metric_name: http.client.request.body.size
    brief: "Size of HTTP client request bodies."
    instrument: histogram
    unit: "By"
    note: >
      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.
    extends: metric_attributes.http.client

  - id: metric.http.client.response.body.size
    type: metric
    metric_name: http.client.response.body.size
    brief: "Size of HTTP client response bodies."
    instrument: histogram
    unit: "By"
    note: >
      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.
    extends: metric_attributes.http.client
