Skip to content

Commit

Permalink
[SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.28.0 (#3139)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Nov 13, 2024
1 parent f7a9aea commit c81a3d4
Show file tree
Hide file tree
Showing 25 changed files with 1,398 additions and 69 deletions.
7 changes: 7 additions & 0 deletions api/include/opentelemetry/semconv/incubating/az_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ namespace semconv
namespace az
{

/**
* <a
* href="https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers">Azure
* Resource Provider Namespace</a> as recognized by the client.
*/
static constexpr const char *kAzNamespace = "az.namespace";

/**
* The unique identifier of the service request. It's generated by the Azure service and returned
* with the response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static constexpr const char *kCloudRegion = "cloud.region";
* href="https://docs.microsoft.com/rest/api/resources/resources/get-by-id">Fully Qualified Resource
* ID</a> of the invoked function, <em>not</em> the function app, having the form
* @code
* /subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>
* /subscriptions/<SUBSCRIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>
* @endcode. This means that a span attribute MUST be used, as an Azure function app can host
* multiple functions that would usually share a TracerProvider.</li>
* </ul>
Expand Down
138 changes: 138 additions & 0 deletions api/include/opentelemetry/semconv/incubating/cloudfoundry_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace cloudfoundry
{

/**
* The guid of the application.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.application_id @endcode. This is the same value as
* reported by @code cf app <app-name> --guid @endcode.
*/
static constexpr const char *kCloudfoundryAppId = "cloudfoundry.app.id";

/**
* The index of the application instance. 0 when just one instance is active.
* <p>
* CloudFoundry defines the @code instance_id @endcode in the <a
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggegator v2 envelope</a>. 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. <p> Application instrumentation should
* use the value from environment variable @code CF_INSTANCE_INDEX @endcode.
*/
static constexpr const char *kCloudfoundryAppInstanceId = "cloudfoundry.app.instance.id";

/**
* The name of the application.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.application_name @endcode. This is the same value
* as reported by @code cf apps @endcode.
*/
static constexpr const char *kCloudfoundryAppName = "cloudfoundry.app.name";

/**
* The guid of the CloudFoundry org the application is running in.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.org_id @endcode. This is the same value as
* reported by @code cf org <org-name> --guid @endcode.
*/
static constexpr const char *kCloudfoundryOrgId = "cloudfoundry.org.id";

/**
* The name of the CloudFoundry organization the app is running in.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.org_name @endcode. This is the same value as
* reported by @code cf orgs @endcode.
*/
static constexpr const char *kCloudfoundryOrgName = "cloudfoundry.org.name";

/**
* The UID identifying the process.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.process_id @endcode. It is supposed to be equal to
* @code VCAP_APPLICATION.app_id @endcode for applications deployed to the runtime.
* For system components, this could be the actual PID.
*/
static constexpr const char *kCloudfoundryProcessId = "cloudfoundry.process.id";

/**
* The type of process.
* <p>
* CloudFoundry applications can consist of multiple jobs. Usually the
* main process will be of type @code web @endcode. There can be additional background
* tasks or side-cars with different process types.
*/
static constexpr const char *kCloudfoundryProcessType = "cloudfoundry.process.type";

/**
* The guid of the CloudFoundry space the application is running in.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.space_id @endcode. This is the same value as
* reported by @code cf space <space-name> --guid @endcode.
*/
static constexpr const char *kCloudfoundrySpaceId = "cloudfoundry.space.id";

/**
* The name of the CloudFoundry space the application is running in.
* <p>
* Application instrumentation should use the value from environment
* variable @code VCAP_APPLICATION.space_name @endcode. This is the same value as
* reported by @code cf spaces @endcode.
*/
static constexpr const char *kCloudfoundrySpaceName = "cloudfoundry.space.name";

/**
* A guid or another name describing the event source.
* <p>
* CloudFoundry defines the @code source_id @endcode in the <a
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggregator v2 envelope</a>.
* It is used for logs and metrics emitted by CloudFoundry. It is
* supposed to contain the component name, e.g. "gorouter", for
* CloudFoundry components.
* <p>
* When system components are instrumented, values from the
* <a href="https://bosh.io/docs/jobs/#properties-spec">Bosh spec</a>
* should be used. The @code system.id @endcode should be set to
* @code spec.deployment/spec.name @endcode.
*/
static constexpr const char *kCloudfoundrySystemId = "cloudfoundry.system.id";

/**
* A guid describing the concrete instance of the event source.
* <p>
* CloudFoundry defines the @code instance_id @endcode in the <a
* href="https://github.com/cloudfoundry/loggregator-api#v2-envelope">Loggregator v2 envelope</a>.
* It is used for logs and metrics emitted by CloudFoundry. It is
* supposed to contain the vm id for CloudFoundry components.
* <p>
* When system components are instrumented, values from the
* <a href="https://bosh.io/docs/jobs/#properties-spec">Bosh spec</a>
* should be used. The @code system.instance.id @endcode should be set to @code spec.id @endcode.
*/
static constexpr const char *kCloudfoundrySystemInstanceId = "cloudfoundry.system.instance.id";

} // namespace cloudfoundry
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace container
static constexpr const char *kContainerCommand = "container.command";

/**
* All the command arguments (including the command/executable itself) run by the container. [2]
* All the command arguments (including the command/executable itself) run by the container.
*/
static constexpr const char *kContainerCommandArgs = "container.command_args";

/**
* The full command run by the container as a single string representing the full command. [2]
* The full command run by the container as a single string representing the full command.
*/
static constexpr const char *kContainerCommandLine = "container.command_line";

Expand All @@ -46,9 +46,25 @@ static constexpr const char *kContainerCommandLine = "container.command_line";
OPENTELEMETRY_DEPRECATED
static constexpr const char *kContainerCpuState = "container.cpu.state";

/**
* The name of the CSI (<a href="https://github.com/container-storage-interface/spec">Container
* Storage Interface</a>) plugin used by the volume. <p> This can sometimes be referred to as a
* "driver" in CSI implementations. This should represent the @code name @endcode field of the
* GetPluginInfo RPC.
*/
static constexpr const char *kContainerCsiPluginName = "container.csi.plugin.name";

/**
* The unique volume ID returned by the CSI (<a
* href="https://github.com/container-storage-interface/spec">Container Storage Interface</a>)
* plugin. <p> This can sometimes be referred to as a "volume handle" in CSI implementations. This
* should represent the @code Volume.volume_id @endcode field in CSI spec.
*/
static constexpr const char *kContainerCsiVolumeId = "container.csi.volume.id";

/**
* Container ID. Usually a UUID, as for example used to <a
* href="https://docs.docker.com/engine/reference/run/#container-identification">identify Docker
* href="https://docs.docker.com/engine/containers/run/#container-identification">identify Docker
* containers</a>. The UUID might be abbreviated.
*/
static constexpr const char *kContainerId = "container.id";
Expand Down
43 changes: 43 additions & 0 deletions api/include/opentelemetry/semconv/incubating/container_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,49 @@ CreateAsyncDoubleMetricContainerCpuTime(metrics::Meter *meter)
unitMetricContainerCpuTime);
}

/**
* Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs
* <p>
* CPU usage of the specific container on all available CPU cores, averaged over the sample window
* <p>
* gauge
*/
static constexpr const char *kMetricContainerCpuUsage = "metric.container.cpu.usage";
static constexpr const char *descrMetricContainerCpuUsage =
"Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs";
static constexpr const char *unitMetricContainerCpuUsage = "{cpu}";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricContainerCpuUsage(
metrics::Meter *meter)
{
return meter->CreateInt64Gauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage,
unitMetricContainerCpuUsage);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricContainerCpuUsage(
metrics::Meter *meter)
{
return meter->CreateDoubleGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage,
unitMetricContainerCpuUsage);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricContainerCpuUsage(metrics::Meter *meter)
{
return meter->CreateInt64ObservableGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage,
unitMetricContainerCpuUsage);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricContainerCpuUsage(metrics::Meter *meter)
{
return meter->CreateDoubleObservableGauge(kMetricContainerCpuUsage, descrMetricContainerCpuUsage,
unitMetricContainerCpuUsage);
}

/**
* Disk bytes for the container.
* <p>
Expand Down
Loading

0 comments on commit c81a3d4

Please sign in to comment.