From 2b3da729c608ee48932e636aa36cf2364057e9e6 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Fri, 11 Sep 2020 17:46:17 +0900 Subject: [PATCH 1/2] Add FaaS attributes. --- .../trace/attributes/SemanticAttributes.java | 42 +++++++++++++++++++ .../sdk/resources/ResourceAttributes.java | 11 +++++ 2 files changed, 53 insertions(+) diff --git a/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java b/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java index 78b54661e31..40f07b43acc 100644 --- a/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java +++ b/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java @@ -291,5 +291,47 @@ public final class SemanticAttributes { public static final StringAttributeSetter THREAD_NAME = StringAttributeSetter.create("thread.name"); + /** Type of the trigger on which the function is executed. */ + public static final StringAttributeSetter FAAS_TRIGGER = + StringAttributeSetter.create("faas.trigger"); + /** String containing the execution id of the function. */ + public static final StringAttributeSetter FAAS_EXECUTION = + StringAttributeSetter.create("faas.execution"); + /** Indicates that the serverless function is executed for the first time (aka cold start). */ + public static final BooleanAttributeSetter FAAS_COLDSTART = + BooleanAttributeSetter.create("faas.coldstart"); + /** The name of the invoked function. */ + public static final StringAttributeSetter FAAS_INVOKED_NAME = + StringAttributeSetter.create("faas.invoked_name"); + /** The cloud provider of the invoked function. */ + public static final StringAttributeSetter FAAS_INVOKED_PROVIDER = + StringAttributeSetter.create("faas.invoked_provider"); + /** The cloud region of the invoked function. */ + public static final StringAttributeSetter FAAS_INVOKED_REGION = + StringAttributeSetter.create("faas.invoked_region"); + + // faas.trigger == datasource + /** The name of the source on which the operation was perfomed. */ + public static final StringAttributeSetter FAAS_DOCUMENT_COLLECTION = + StringAttributeSetter.create("faas.document.collection"); + /** Describes the type of the operation that was performed on the data. */ + public static final StringAttributeSetter FAAS_DOCUMENT_OPERATION = + StringAttributeSetter.create("faas.document.operation"); + /** + * A string containing the time when the data was accessed in the ISO 8601 format expressed in + * UTC. + */ + public static final StringAttributeSetter FAAS_DOCUMENT_TIME = + StringAttributeSetter.create("faas.document.time"); + /** The document name/table subjected to the operation. */ + public static final StringAttributeSetter FAAS_DOCUMENT_NAME = + StringAttributeSetter.create("faas.document.name"); + + // faas.trigger == timer + /** A string containing the function invocation time in the ISO 8601 format expressed in UTC. */ + public static final StringAttributeSetter FAAS_TIME = StringAttributeSetter.create("faas.time"); + /** A string containing the schedule period as Cron Expression. */ + public static final StringAttributeSetter FAAS_CRON = StringAttributeSetter.create("faas.cron"); + private SemanticAttributes() {} } diff --git a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java index 1a882d0ef00..88baef2eb53 100644 --- a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java +++ b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java @@ -150,5 +150,16 @@ public final class ResourceAttributes { /** Zones are a sub set of the region connected through low-latency links. */ public static final StringAttributeSetter CLOUD_ZONE = StringAttributeSetter.create("cloud.zone"); + /** The name of the function being executed. */ + public static final StringAttributeSetter FAAS_NAME = StringAttributeSetter.create("faas.name"); + /** The unique ID of the function being executed. */ + public static final StringAttributeSetter FAAS_ID = StringAttributeSetter.create("faas.id"); + /** The version string of the function being executed. */ + public static final StringAttributeSetter FAAS_VERSION = + StringAttributeSetter.create("faas.version"); + /** The execution environment ID as a string. */ + public static final StringAttributeSetter FAAS_INSTANCE = + StringAttributeSetter.create("faas.instance"); + private ResourceAttributes() {} } From d128afdc7d9d52ea67bd1bae0302d51d5eacfb40 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Fri, 11 Sep 2020 18:36:33 +0900 Subject: [PATCH 2/2] Move to javadoc --- .../trace/attributes/SemanticAttributes.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java b/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java index 40f07b43acc..737e8c6c594 100644 --- a/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java +++ b/api/src/main/java/io/opentelemetry/trace/attributes/SemanticAttributes.java @@ -310,27 +310,31 @@ public final class SemanticAttributes { public static final StringAttributeSetter FAAS_INVOKED_REGION = StringAttributeSetter.create("faas.invoked_region"); - // faas.trigger == datasource - /** The name of the source on which the operation was perfomed. */ + /** For faas.trigger == datasource, the name of the source on which the operation was perfomed. */ public static final StringAttributeSetter FAAS_DOCUMENT_COLLECTION = StringAttributeSetter.create("faas.document.collection"); - /** Describes the type of the operation that was performed on the data. */ + /** + * For faas.trigger == datasource, describes the type of the operation that was performed on the + * data. + */ public static final StringAttributeSetter FAAS_DOCUMENT_OPERATION = StringAttributeSetter.create("faas.document.operation"); /** - * A string containing the time when the data was accessed in the ISO 8601 format expressed in - * UTC. + * For faas.trigger == datasource, a string containing the time when the data was accessed in the + * ISO 8601 format expressed in UTC. */ public static final StringAttributeSetter FAAS_DOCUMENT_TIME = StringAttributeSetter.create("faas.document.time"); - /** The document name/table subjected to the operation. */ + /** For faas.trigger == datasource, the document name/table subjected to the operation. */ public static final StringAttributeSetter FAAS_DOCUMENT_NAME = StringAttributeSetter.create("faas.document.name"); - // faas.trigger == timer - /** A string containing the function invocation time in the ISO 8601 format expressed in UTC. */ + /** + * For faas.trigger == time, a string containing the function invocation time in the ISO 8601 + * format expressed in UTC. + */ public static final StringAttributeSetter FAAS_TIME = StringAttributeSetter.create("faas.time"); - /** A string containing the schedule period as Cron Expression. */ + /** For faas.trigger == time, a string containing the schedule period as Cron Expression. */ public static final StringAttributeSetter FAAS_CRON = StringAttributeSetter.create("faas.cron"); private SemanticAttributes() {}