Skip to content

Commit

Permalink
feat: upgrade semantic conventions to v1.2.0 of spec (open-telemetry#…
Browse files Browse the repository at this point in the history
…2115)

* feat: upgrade semantic conventions to v1.2.0 of spec

Updated the generated semantic convention attributes to the one defined
in v1.2.0 of the Opentelemetry specification.

Changed `generate.sh` to ensure it uses v1.2.0 of the spec

* fix: improve the semconv template to better handled referenced attributes

Co-authored-by: Weyert de Boer <weyert.deboer@tapico.io>
  • Loading branch information
weyert and tapico-weyert authored Apr 19, 2021
1 parent c0b021b commit 09c2aa7
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const ResourceAttributes = {
CLOUD_AVAILABILITY_ZONE: 'cloud.availability_zone',

/**
* The cloud infrastructure resource in use.
* The cloud platform in use.
*
* Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.
*/
CLOUD_INFRASTRUCTURE_SERVICE: 'cloud.infrastructure_service',
CLOUD_PLATFORM: 'cloud.platform',

/**
* The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html).
Expand All @@ -70,6 +70,11 @@ export const ResourceAttributes = {
*/
AWS_ECS_TASK_FAMILY: 'aws.ecs.task.family',

/**
* The revision for this task definition.
*/
AWS_ECS_TASK_REVISION: 'aws.ecs.task.revision',

/**
* The ARN of an EKS cluster.
*/
Expand Down Expand Up @@ -395,6 +400,21 @@ export const ResourceAttributes = {
* The version string of the auto instrumentation agent, if used.
*/
TELEMETRY_AUTO_VERSION: 'telemetry.auto.version',

/**
* The name of the web engine.
*/
WEBENGINE_NAME: 'webengine.name',

/**
* The version of the web engine.
*/
WEBENGINE_VERSION: 'webengine.version',

/**
* Additional description of the web engine (e.g. detailed version and edition information).
*/
WEBENGINE_DESCRIPTION: 'webengine.description',
};

// Enum definitions
Expand All @@ -408,7 +428,7 @@ export enum CloudProviderValues {
GCP = 'gcp',
}

export enum CloudInfrastructureServiceValues {
export enum CloudPlatformValues {
/** AWS Elastic Compute Cloud. */
AWS_EC2 = 'aws_ec2',
/** AWS Elastic Container Service. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,120 @@ clear whether the exception will escape.
*/
HTTP_CLIENT_IP: 'http.client_ip',

/**
* The keys in the `RequestItems` object field.
*/
AWS_DYNAMODB_TABLE_NAMES: 'aws.dynamodb.table_names',

/**
* The JSON-serialized value of each item in the `ConsumedCapacity` response field.
*/
AWS_DYNAMODB_CONSUMED_CAPACITY: 'aws.dynamodb.consumed_capacity',

/**
* The JSON-serialized value of the `ItemCollectionMetrics` response field.
*/
AWS_DYNAMODB_ITEM_COLLECTION_METRICS: 'aws.dynamodb.item_collection_metrics',

/**
* The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.
*/
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:
'aws.dynamodb.provisioned_read_capacity',

/**
* The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.
*/
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:
'aws.dynamodb.provisioned_write_capacity',

/**
* The value of the `ConsistentRead` request parameter.
*/
AWS_DYNAMODB_CONSISTENT_READ: 'aws.dynamodb.consistent_read',

/**
* The value of the `ProjectionExpression` request parameter.
*/
AWS_DYNAMODB_PROJECTION: 'aws.dynamodb.projection',

/**
* The value of the `Limit` request parameter.
*/
AWS_DYNAMODB_LIMIT: 'aws.dynamodb.limit',

/**
* The value of the `AttributesToGet` request parameter.
*/
AWS_DYNAMODB_ATTRIBUTES_TO_GET: 'aws.dynamodb.attributes_to_get',

/**
* The value of the `IndexName` request parameter.
*/
AWS_DYNAMODB_INDEX_NAME: 'aws.dynamodb.index_name',

/**
* The value of the `Select` request parameter.
*/
AWS_DYNAMODB_SELECT: 'aws.dynamodb.select',

/**
* The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field.
*/
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:
'aws.dynamodb.global_secondary_indexes',

/**
* The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.
*/
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: 'aws.dynamodb.local_secondary_indexes',

/**
* The value of the `ExclusiveStartTableName` request parameter.
*/
AWS_DYNAMODB_EXCLUSIVE_START_TABLE: 'aws.dynamodb.exclusive_start_table',

/**
* The the number of items in the `TableNames` response parameter.
*/
AWS_DYNAMODB_TABLE_COUNT: 'aws.dynamodb.table_count',

/**
* The value of the `ScanIndexForward` request parameter.
*/
AWS_DYNAMODB_SCAN_FORWARD: 'aws.dynamodb.scan_forward',

/**
* The value of the `Segment` request parameter.
*/
AWS_DYNAMODB_SEGMENT: 'aws.dynamodb.segment',

/**
* The value of the `TotalSegments` request parameter.
*/
AWS_DYNAMODB_TOTAL_SEGMENTS: 'aws.dynamodb.total_segments',

/**
* The value of the `Count` response parameter.
*/
AWS_DYNAMODB_COUNT: 'aws.dynamodb.count',

/**
* The value of the `ScannedCount` response parameter.
*/
AWS_DYNAMODB_SCANNED_COUNT: 'aws.dynamodb.scanned_count',

/**
* The JSON-serialized value of each item in the `AttributeDefinitions` request field.
*/
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: 'aws.dynamodb.attribute_definitions',

/**
* The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field.
*/
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:
'aws.dynamodb.global_secondary_index_updates',

/**
* A string identifying the messaging system.
*/
Expand Down Expand Up @@ -606,8 +720,6 @@ export enum DbSystemValues {
ELASTICSEARCH = 'elasticsearch',
}

export enum NetTransportValues {}

export enum DbCassandraConsistencyLevelValues {
/** ALL. */
ALL = 'ALL',
Expand Down Expand Up @@ -658,7 +770,7 @@ export enum FaasDocumentOperationValues {
export enum FaasInvokedProviderValues {
/** Amazon Web Services. */
AWS = 'aws',
/** Amazon Web Services. */
/** Microsoft Azure. */
AZURE = 'azure',
/** Google Cloud Platform. */
GCP = 'gcp',
Expand Down Expand Up @@ -708,8 +820,6 @@ export enum MessagingOperationValues {
PROCESS = 'process',
}

export enum NetTransportValues {}

export enum RpcGrpcStatusCodeValues {
/** OK. */
OK = 0,
Expand Down
4 changes: 2 additions & 2 deletions scripts/semconv/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="${SCRIPT_DIR}/../../"

# freeze the spec version to make SpanAttributess generation reproducible
SPEC_VERSION=v1.1.0
GENERATOR_VERSION=0.2.1
SPEC_VERSION=v1.2.0
GENERATOR_VERSION=0.3.1

cd ${SCRIPT_DIR}

Expand Down
5 changes: 4 additions & 1 deletion scripts/semconv/templates/SemanticAttributes.ts.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ export const {{class}} = {
}

// Enum definitions
{%- for attribute in attributes if attribute.is_local %}
{%- for attribute in attributes if attribute.is_local and not attribute.ref %}
{%- if attribute.is_enum %}
{%- set class_name = attribute.fqn | to_camelcase(True) ~ "Values" %}
{%- set type = attribute.attr_type.enum_type %}

{% if attribute.attr_type.members is defined and attribute.attr_type.members|length > 0 %}
export enum {{class_name}} {
{%- for member in attribute.attr_type.members if attribute.is_local and not attribute.ref %}
/** {% filter escape %}{{member.brief | to_doc_brief}}.{% endfilter %} */
{{ member.member_id | to_const_name }} = {{ print_value(type, member.value) }},
{%- endfor %}
}
{% endif %}
{% endif %}

{%- endfor %}

0 comments on commit 09c2aa7

Please sign in to comment.