From 5ce940a7b77a57f92ff1290e1a0beecd663f77f5 Mon Sep 17 00:00:00 2001 From: Ravindranath Kakarla Date: Tue, 21 Sep 2021 23:45:29 -0700 Subject: [PATCH 1/2] Emit Glue Schema Registry usage metrics --- amazon-kinesis-client/pom.xml | 4 ++-- .../amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/amazon-kinesis-client/pom.xml b/amazon-kinesis-client/pom.xml index 5b9808038..979ffd089 100644 --- a/amazon-kinesis-client/pom.xml +++ b/amazon-kinesis-client/pom.xml @@ -77,12 +77,12 @@ software.amazon.glue schema-registry-serde - 1.1.1 + 1.1.3 software.amazon.glue schema-registry-common - 1.1.1 + 1.1.3 com.google.guava diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java index 0418a00a3..d6f96b769 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java @@ -14,11 +14,13 @@ */ @Slf4j public class SchemaRegistryDecoder { + private static final String USER_AGENT_APP_NAME = "kcl"; private final GlueSchemaRegistryDeserializer glueSchemaRegistryDeserializer; public SchemaRegistryDecoder( GlueSchemaRegistryDeserializer glueSchemaRegistryDeserializer) { this.glueSchemaRegistryDeserializer = glueSchemaRegistryDeserializer; + this.glueSchemaRegistryDeserializer.overrideUserAgentApp(USER_AGENT_APP_NAME); } /** From 7c5492e6f865ad96e98a207f37659d4703e97508 Mon Sep 17 00:00:00 2001 From: Ravindranath Kakarla Date: Wed, 29 Sep 2021 15:47:55 -0700 Subject: [PATCH 2/2] Append KCL version to the app string. --- amazon-kinesis-client/pom.xml | 43 ++++++++++++++++++- .../KinesisClientLibraryPackage.java | 5 +++ .../schemaregistry/SchemaRegistryDecoder.java | 3 +- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 amazon-kinesis-client/src/main/java-templates/KinesisClientLibraryPackage.java diff --git a/amazon-kinesis-client/pom.xml b/amazon-kinesis-client/pom.xml index 979ffd089..e997e93a1 100644 --- a/amazon-kinesis-client/pom.xml +++ b/amazon-kinesis-client/pom.xml @@ -77,12 +77,12 @@ software.amazon.glue schema-registry-serde - 1.1.3 + 1.1.4 software.amazon.glue schema-registry-common - 1.1.3 + 1.1.4 com.google.guava @@ -324,6 +324,45 @@ + + + + org.codehaus.mojo + templating-maven-plugin + 1.0.0 + + + generate-version-class + + filter-sources + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-dist + prepare-package + + copy-resources + + + ${project.build.outputDirectory} + + + ${project.basedir}/target/generated-sources/java-templates/ + false + + + + + + + + diff --git a/amazon-kinesis-client/src/main/java-templates/KinesisClientLibraryPackage.java b/amazon-kinesis-client/src/main/java-templates/KinesisClientLibraryPackage.java new file mode 100644 index 000000000..3c63e43d7 --- /dev/null +++ b/amazon-kinesis-client/src/main/java-templates/KinesisClientLibraryPackage.java @@ -0,0 +1,5 @@ +package software.amazon.kinesis.common; + +public final class KinesisClientLibraryPackage { + public static final String VERSION = "${project.version}"; +} \ No newline at end of file diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java index d6f96b769..76415a85f 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/schemaregistry/SchemaRegistryDecoder.java @@ -3,6 +3,7 @@ import com.amazonaws.services.schemaregistry.common.Schema; import com.amazonaws.services.schemaregistry.deserializers.GlueSchemaRegistryDeserializer; import lombok.extern.slf4j.Slf4j; +import software.amazon.kinesis.common.KinesisClientLibraryPackage; import software.amazon.kinesis.retrieval.KinesisClientRecord; import java.nio.ByteBuffer; @@ -14,7 +15,7 @@ */ @Slf4j public class SchemaRegistryDecoder { - private static final String USER_AGENT_APP_NAME = "kcl"; + private static final String USER_AGENT_APP_NAME = "kcl" + "-" + KinesisClientLibraryPackage.VERSION; private final GlueSchemaRegistryDeserializer glueSchemaRegistryDeserializer; public SchemaRegistryDecoder(