Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CloudFoundry Resource Attributes #624

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7bd0436
Add CloudFoundry resource attributes
KarstenSchnitter Dec 27, 2023
7a9b0b4
Add Changelog Entry for CloudFoundry
KarstenSchnitter Jan 11, 2024
f4efa59
Rename CF generic attributes
KarstenSchnitter Jan 15, 2024
736bee4
Revert "Add Changelog Entry for CloudFoundry"
KarstenSchnitter Feb 11, 2024
402c93e
Merge commit '44c830d3dabad9d59f340d92e774a1d5a2356743' into cf-resource
KarstenSchnitter Feb 11, 2024
d41832c
Provide Changelog Entry
KarstenSchnitter Feb 11, 2024
d722e21
Merge branch 'main' into cf-resource
joaopgrassi Mar 20, 2024
9ce2881
Merge branch 'main' into cf-resource
KarstenSchnitter Apr 17, 2024
d20c70f
Create CloudFoundry System Namespace
KarstenSchnitter May 12, 2024
d77ec4b
Merge commit 'c53f76f661a98836f824d27d33b5f4b24dfa5bc4' into cf-resource
KarstenSchnitter May 24, 2024
99a037d
Update docs/attributes-registry/README.md
KarstenSchnitter May 26, 2024
1183038
Merge branch 'main' into cf-resource
KarstenSchnitter Jun 12, 2024
e7ac8f2
Merge branch 'main' into cf-resource
KarstenSchnitter Aug 7, 2024
b5335d5
Merge branch 'main' into cf-resource
KarstenSchnitter Aug 23, 2024
b2da4c9
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 2, 2024
ad85e02
Update issue templates
KarstenSchnitter Sep 9, 2024
5da2eac
Remove prefix
KarstenSchnitter Sep 9, 2024
887ade0
Register CloudFoundry as acronym
KarstenSchnitter Sep 9, 2024
2313a54
Fix issue templates
KarstenSchnitter Sep 9, 2024
fe5afa0
Fix resource model
KarstenSchnitter Sep 9, 2024
060b67e
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 9, 2024
99b1cb8
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 11, 2024
742e03b
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 12, 2024
d319458
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 16, 2024
4808dfe
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 17, 2024
2f991a8
Fix CloudFoundry Model Configuration
KarstenSchnitter Sep 17, 2024
ed7ff7a
Ajdust Github Issue Templates
KarstenSchnitter Sep 17, 2024
54d7997
Merge branch 'main' into cf-resource
KarstenSchnitter Sep 17, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ release.
([#615](https://github.com/open-telemetry/semantic-conventions/pull/615))
- Add an example for gcp_pubsub asynchronous batch publish
([#545](https://github.com/open-telemetry/semantic-conventions/pull/545)).
- Add a CloudFoundry convention ([#624](https://github.com/open-telemetry/semantic-conventions/pull/624)).

### Fixes

Expand Down
1 change: 1 addition & 0 deletions docs/attributes-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Currently, the following namespaces exist:
* [Browser](browser.md)
* [Client](client.md)
* [Cloud](cloud.md)
* [CloudFoundry](cloudfoundry.md)
* [Code](code.md)
* [Container](container.md)
* [DB](db.md) (database)
Expand Down
93 changes: 93 additions & 0 deletions docs/attributes-registry/cloudfoundry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--- Hugo front matter used to generate the website version of this page:
linkTitle: CloudFoundry
--->

# CloudFoundry

## CloudFoundry Resource Attributes

<!-- semconv registry.cloudfoundry(omit_requirement_level) -->
| Attribute | Type | Description | Examples |
|---|---|---|---|
| `cloudfoundry.app.id` | string | The guid of the application. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` |
| `cloudfoundry.app.name` | string | The name of the application. [2] | `my-app-name` |
| `cloudfoundry.instance.id` | string | An index or guid describing the concrete instance of the event source. [3] | `0`; `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` |
| `cloudfoundry.org.id` | string | The guid of the CloudFoundry org the application is running in. [4] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` |
| `cloudfoundry.org.name` | string | The name of the CloudFoundry organization the app is running in. [5] | `my-org-name` |
| `cloudfoundry.process.id` | string | The UID identifying the process. [6] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` |
| `cloudfoundry.process.type` | string | The type of process. [7] | `web` |
| `cloudfoundry.source.id` | string | A guid or another name describing the event source. [8] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d`; `cf/gorouter` |
| `cloudfoundry.source.type` | string | The type of the event source. [9] | `APP/PROC/WEB/0`; `APP/TASK/jobscheduler-task-70013817-ab92-4f75-82d4-de8ae4dd64b4`; `RTR`; `STG` |
| `cloudfoundry.space.id` | string | The guid of the CloudFoundry space the application is running in. [10] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` |
| `cloudfoundry.space.name` | string | The name of the CloudFoundry space the application is running in. [11] | `my-space-name` |

**[1]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_id`. This is the same value as
reported by `cf app <app-name> --guid`.

**[2]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_name`. This is the same value
as reported by `cf apps`.

**[3]:** CloudFoundry defines the `instance_id` in the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the application instance index for applications
deployed on the runtime or the vm id for CloudFoundry components.

Application instrumentation should use the value from environment
variable `CF_INSTANCE_INDEX`.

When system components are instrumented, values from the [Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `instance.id` should be set to `spec.id`.

**[4]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_id`. This is the same value as
reported by `cf org <org-name> --guid`.

**[5]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_name`. This is the same value as
reported by `cf orgs`.

**[6]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to
`VCAP_APPLICATION.app_id` for applications deployed to the runtime.
For system components, this could be the actual PID.

**[7]:** CloudFoundry applications can consist of multiple jobs. Usually the
main process will be of type `web`. There can be additional background
tasks or side-cars with different process types.

**[8]:** CloudFoundry defines the `source_id` in the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the application id for applications deployed on
the runtime or the component name, e.g. "gorouter", for CloudFoundry
components.

Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_id`. This is the same value as
reported by `cf app <app-name> --guid`.

When system components are instrumented, values from the [Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `source.id` should be set to
`spec.deployment/spec.name`.

**[9]:** CloudFoundry generates log messages with different source types for an
applications. This indicates, whether the log was created from the
actual application, a background task, the central load balancer, or
the CloudFoundry runtime, e.g. during a deployment.

The `source_type` is contained as a tag of the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is also available in the syslog drain structured data as documented
in the [CloudFoundry Dev Guide](https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html).
Application developers can access the value of the `source_type` in
the log stream generated by `cf logs <app-name>`, usually in square
brackets.

**[10]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_id`. This is the same value as
reported by `cf space <space-name> --guid`.

**[11]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_name`. This is the same value as
reported by `cf spaces`.
<!-- endsemconv -->
1 change: 1 addition & 0 deletions docs/resource/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Attributes defining a running environment (e.g. Operating System, Cloud, Data Ce
- Deployment:
- [Deployment Environment](./deployment-environment.md)
- [Kubernetes](./k8s.md)
- [CloudFoundry](./cloudfoundry.md)
- [Browser](./browser.md)

## Version attributes
Expand Down
170 changes: 170 additions & 0 deletions docs/resource/cloudfoundry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# CloudFoundry

**Status**: [Experimental][DocumentStatus]

Useful resources to understand CloudFoundry metadata:

* <https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-APPLICATION>
* <https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html>
* <https://github.com/cloudfoundry/loggregator-api#v2-envelope>
* <https://bosh.io/docs/jobs/#properties-spec>

CloudFoundry organizes application deployments (apps) by spaces contained in
organizations (orgs). Names are unique only in their respective enclosing
entity. Ids are unique in the entire CloudFoundry installation. Different
instances of the same application are separated by an integer index. Apps can
consist of a main job and multiple tasks and side-cars, which can be
distinguished by different process attributes.

CloudFoundry can also emit signals from system components. They use a different
approach as applications, since they are not organized into orgs and spaces.
They align with the Bosh deployment tool of CloudFoundry.

## Organization

**type:** `cloudfoundry.org`

**Description:** A CloudFoundry Organization

<!-- semconv cloudfoundry.org -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.org.id`](../attributes-registry/cloudfoundry.md) | string | The guid of the CloudFoundry org the application is running in. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Recommended |
| [`cloudfoundry.org.name`](../attributes-registry/cloudfoundry.md) | string | The name of the CloudFoundry organization the app is running in. [2] | `my-org-name` | Recommended |

**[1]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_id`. This is the same value as
reported by `cf org <org-name> --guid`.

**[2]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_name`. This is the same value as
reported by `cf orgs`.
<!-- endsemconv -->

## Space

**type:** `cloudfoundry.space`

**Description:** A CloudFoundry Space

<!-- semconv cloudfoundry.space -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.space.id`](../attributes-registry/cloudfoundry.md) | string | The guid of the CloudFoundry space the application is running in. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Recommended |
| [`cloudfoundry.space.name`](../attributes-registry/cloudfoundry.md) | string | The name of the CloudFoundry space the application is running in. [2] | `my-space-name` | Recommended |

**[1]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_id`. This is the same value as
reported by `cf space <space-name> --guid`.

**[2]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_name`. This is the same value as
reported by `cf spaces`.
<!-- endsemconv -->

## Application

***type:** `cloudfoundry.app`

**Description:** A CloudFoundry Application

<!-- semconv cloudfoundry.app -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.app.id`](../attributes-registry/cloudfoundry.md) | string | The guid of the application. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Recommended |
| [`cloudfoundry.app.name`](../attributes-registry/cloudfoundry.md) | string | The name of the application. [2] | `my-app-name` | Recommended |

**[1]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_id`. This is the same value as
reported by `cf app <app-name> --guid`.

**[2]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_name`. This is the same value
as reported by `cf apps`.
<!-- endsemconv -->

## Process

**type:** `cloudfoundry.process`

**Description:** A CloudFoundry Application Process

<!-- semconv cloudfoundry.process -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.process.id`](../attributes-registry/cloudfoundry.md) | string | The UID identifying the process. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Recommended |
| [`cloudfoundry.process.type`](../attributes-registry/cloudfoundry.md) | string | The type of process. [2] | `web` | Recommended |

**[1]:** Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to
`VCAP_APPLICATION.app_id` for applications deployed to the runtime.
For system components, this could be the actual PID.

**[2]:** CloudFoundry applications can consist of multiple jobs. Usually the
main process will be of type `web`. There can be additional background
tasks or side-cars with different process types.
<!-- endsemconv -->

## Generic Source

**type:** `cloudfoundry`

**Description:** The generic source (app or system component)

<!-- semconv cloudfoundry(tag=generic) -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.instance.id`](../attributes-registry/cloudfoundry.md) | string | An index or guid describing the concrete instance of the event source. [1] | `0`; `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Required |
| [`cloudfoundry.source.id`](../attributes-registry/cloudfoundry.md) | string | A guid or another name describing the event source. [2] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d`; `cf/gorouter` | Required |

**[1]:** CloudFoundry defines the `instance_id` in the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the application instance index for applications
deployed on the runtime or the vm id for CloudFoundry components.

Application instrumentation should use the value from environment
variable `CF_INSTANCE_INDEX`.

When system components are instrumented, values from the [Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `instance.id` should be set to `spec.id`.

**[2]:** CloudFoundry defines the `source_id` in the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the application id for applications deployed on
the runtime or the component name, e.g. "gorouter", for CloudFoundry
components.

Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_id`. This is the same value as
reported by `cf app <app-name> --guid`.

When system components are instrumented, values from the [Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `source.id` should be set to
`spec.deployment/spec.name`.
<!-- endsemconv -->

## Source Type

**type:**`cloudfoundry.source.type`

**Description:** The CloudFoundry source type.

<!-- semconv cloudfoundry(tag=source.type) -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`cloudfoundry.source.type`](../attributes-registry/cloudfoundry.md) | string | The type of the event source. [1] | `APP/PROC/WEB/0`; `APP/TASK/jobscheduler-task-70013817-ab92-4f75-82d4-de8ae4dd64b4`; `RTR`; `STG` | Conditionally Required: if the the event is a log message |

**[1]:** CloudFoundry generates log messages with different source types for an
applications. This indicates, whether the log was created from the
actual application, a background task, the central load balancer, or
the CloudFoundry runtime, e.g. during a deployment.

The `source_type` is contained as a tag of the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is also available in the syslog drain structured data as documented
in the [CloudFoundry Dev Guide](https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html).
Application developers can access the value of the `source_type` in
the log stream generated by `cf logs <app-name>`, usually in square
brackets.
<!-- endsemconv -->

[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/document-status.md
Loading