Skip to content

Commit 09c2aa7

Browse files
feat: upgrade semantic conventions to v1.2.0 of spec (#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 <[email protected]>
1 parent c0b021b commit 09c2aa7

File tree

4 files changed

+144
-11
lines changed

4 files changed

+144
-11
lines changed

packages/opentelemetry-semantic-conventions/src/resource/ResourceAttributes.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export const ResourceAttributes = {
3939
CLOUD_AVAILABILITY_ZONE: 'cloud.availability_zone',
4040

4141
/**
42-
* The cloud infrastructure resource in use.
42+
* The cloud platform in use.
4343
*
4444
* Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.
4545
*/
46-
CLOUD_INFRASTRUCTURE_SERVICE: 'cloud.infrastructure_service',
46+
CLOUD_PLATFORM: 'cloud.platform',
4747

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

73+
/**
74+
* The revision for this task definition.
75+
*/
76+
AWS_ECS_TASK_REVISION: 'aws.ecs.task.revision',
77+
7378
/**
7479
* The ARN of an EKS cluster.
7580
*/
@@ -395,6 +400,21 @@ export const ResourceAttributes = {
395400
* The version string of the auto instrumentation agent, if used.
396401
*/
397402
TELEMETRY_AUTO_VERSION: 'telemetry.auto.version',
403+
404+
/**
405+
* The name of the web engine.
406+
*/
407+
WEBENGINE_NAME: 'webengine.name',
408+
409+
/**
410+
* The version of the web engine.
411+
*/
412+
WEBENGINE_VERSION: 'webengine.version',
413+
414+
/**
415+
* Additional description of the web engine (e.g. detailed version and edition information).
416+
*/
417+
WEBENGINE_DESCRIPTION: 'webengine.description',
398418
};
399419

400420
// Enum definitions
@@ -408,7 +428,7 @@ export enum CloudProviderValues {
408428
GCP = 'gcp',
409429
}
410430

411-
export enum CloudInfrastructureServiceValues {
431+
export enum CloudPlatformValues {
412432
/** AWS Elastic Compute Cloud. */
413433
AWS_EC2 = 'aws_ec2',
414434
/** AWS Elastic Container Service. */

packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts

Lines changed: 115 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,120 @@ clear whether the exception will escape.
402402
*/
403403
HTTP_CLIENT_IP: 'http.client_ip',
404404

405+
/**
406+
* The keys in the `RequestItems` object field.
407+
*/
408+
AWS_DYNAMODB_TABLE_NAMES: 'aws.dynamodb.table_names',
409+
410+
/**
411+
* The JSON-serialized value of each item in the `ConsumedCapacity` response field.
412+
*/
413+
AWS_DYNAMODB_CONSUMED_CAPACITY: 'aws.dynamodb.consumed_capacity',
414+
415+
/**
416+
* The JSON-serialized value of the `ItemCollectionMetrics` response field.
417+
*/
418+
AWS_DYNAMODB_ITEM_COLLECTION_METRICS: 'aws.dynamodb.item_collection_metrics',
419+
420+
/**
421+
* The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.
422+
*/
423+
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:
424+
'aws.dynamodb.provisioned_read_capacity',
425+
426+
/**
427+
* The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.
428+
*/
429+
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:
430+
'aws.dynamodb.provisioned_write_capacity',
431+
432+
/**
433+
* The value of the `ConsistentRead` request parameter.
434+
*/
435+
AWS_DYNAMODB_CONSISTENT_READ: 'aws.dynamodb.consistent_read',
436+
437+
/**
438+
* The value of the `ProjectionExpression` request parameter.
439+
*/
440+
AWS_DYNAMODB_PROJECTION: 'aws.dynamodb.projection',
441+
442+
/**
443+
* The value of the `Limit` request parameter.
444+
*/
445+
AWS_DYNAMODB_LIMIT: 'aws.dynamodb.limit',
446+
447+
/**
448+
* The value of the `AttributesToGet` request parameter.
449+
*/
450+
AWS_DYNAMODB_ATTRIBUTES_TO_GET: 'aws.dynamodb.attributes_to_get',
451+
452+
/**
453+
* The value of the `IndexName` request parameter.
454+
*/
455+
AWS_DYNAMODB_INDEX_NAME: 'aws.dynamodb.index_name',
456+
457+
/**
458+
* The value of the `Select` request parameter.
459+
*/
460+
AWS_DYNAMODB_SELECT: 'aws.dynamodb.select',
461+
462+
/**
463+
* The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field.
464+
*/
465+
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:
466+
'aws.dynamodb.global_secondary_indexes',
467+
468+
/**
469+
* The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.
470+
*/
471+
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: 'aws.dynamodb.local_secondary_indexes',
472+
473+
/**
474+
* The value of the `ExclusiveStartTableName` request parameter.
475+
*/
476+
AWS_DYNAMODB_EXCLUSIVE_START_TABLE: 'aws.dynamodb.exclusive_start_table',
477+
478+
/**
479+
* The the number of items in the `TableNames` response parameter.
480+
*/
481+
AWS_DYNAMODB_TABLE_COUNT: 'aws.dynamodb.table_count',
482+
483+
/**
484+
* The value of the `ScanIndexForward` request parameter.
485+
*/
486+
AWS_DYNAMODB_SCAN_FORWARD: 'aws.dynamodb.scan_forward',
487+
488+
/**
489+
* The value of the `Segment` request parameter.
490+
*/
491+
AWS_DYNAMODB_SEGMENT: 'aws.dynamodb.segment',
492+
493+
/**
494+
* The value of the `TotalSegments` request parameter.
495+
*/
496+
AWS_DYNAMODB_TOTAL_SEGMENTS: 'aws.dynamodb.total_segments',
497+
498+
/**
499+
* The value of the `Count` response parameter.
500+
*/
501+
AWS_DYNAMODB_COUNT: 'aws.dynamodb.count',
502+
503+
/**
504+
* The value of the `ScannedCount` response parameter.
505+
*/
506+
AWS_DYNAMODB_SCANNED_COUNT: 'aws.dynamodb.scanned_count',
507+
508+
/**
509+
* The JSON-serialized value of each item in the `AttributeDefinitions` request field.
510+
*/
511+
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: 'aws.dynamodb.attribute_definitions',
512+
513+
/**
514+
* The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field.
515+
*/
516+
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:
517+
'aws.dynamodb.global_secondary_index_updates',
518+
405519
/**
406520
* A string identifying the messaging system.
407521
*/
@@ -606,8 +720,6 @@ export enum DbSystemValues {
606720
ELASTICSEARCH = 'elasticsearch',
607721
}
608722

609-
export enum NetTransportValues {}
610-
611723
export enum DbCassandraConsistencyLevelValues {
612724
/** ALL. */
613725
ALL = 'ALL',
@@ -658,7 +770,7 @@ export enum FaasDocumentOperationValues {
658770
export enum FaasInvokedProviderValues {
659771
/** Amazon Web Services. */
660772
AWS = 'aws',
661-
/** Amazon Web Services. */
773+
/** Microsoft Azure. */
662774
AZURE = 'azure',
663775
/** Google Cloud Platform. */
664776
GCP = 'gcp',
@@ -708,8 +820,6 @@ export enum MessagingOperationValues {
708820
PROCESS = 'process',
709821
}
710822

711-
export enum NetTransportValues {}
712-
713823
export enum RpcGrpcStatusCodeValues {
714824
/** OK. */
715825
OK = 0,

scripts/semconv/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44
ROOT_DIR="${SCRIPT_DIR}/../../"
55

66
# freeze the spec version to make SpanAttributess generation reproducible
7-
SPEC_VERSION=v1.1.0
8-
GENERATOR_VERSION=0.2.1
7+
SPEC_VERSION=v1.2.0
8+
GENERATOR_VERSION=0.3.1
99

1010
cd ${SCRIPT_DIR}
1111

scripts/semconv/templates/SemanticAttributes.ts.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,19 @@ export const {{class}} = {
4545
}
4646

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

53+
{% if attribute.attr_type.members is defined and attribute.attr_type.members|length > 0 %}
5354
export enum {{class_name}} {
5455
{%- for member in attribute.attr_type.members if attribute.is_local and not attribute.ref %}
5556
/** {% filter escape %}{{member.brief | to_doc_brief}}.{% endfilter %} */
5657
{{ member.member_id | to_const_name }} = {{ print_value(type, member.value) }},
5758
{%- endfor %}
5859
}
5960
{% endif %}
61+
{% endif %}
62+
6063
{%- endfor %}

0 commit comments

Comments
 (0)