Skip to content

Commit

Permalink
Emit Glue Schema Registry usage metrics (#855)
Browse files Browse the repository at this point in the history
* Emit Glue Schema Registry usage metrics

* Append KCL version to the app string.

Co-authored-by: Ravindranath Kakarla <rnath@amazon.com>
  • Loading branch information
blacktooth and blacktooth authored Sep 30, 2021
1 parent e73a8a9 commit c5ce30f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
43 changes: 41 additions & 2 deletions amazon-kinesis-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-serde</artifactId>
<version>1.1.1</version>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>software.amazon.glue</groupId>
<artifactId>schema-registry-common</artifactId>
<version>1.1.1</version>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -324,6 +324,45 @@
</execution>
</executions>
</plugin>

<!-- Required for generating maven version as a Java class for runtime access -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>generate-version-class</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-dist</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/target/generated-sources/java-templates/</directory>
<filtering>false</filtering>
<excludes>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package software.amazon.kinesis.common;

public final class KinesisClientLibraryPackage {
public static final String VERSION = "${project.version}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,11 +15,13 @@
*/
@Slf4j
public class SchemaRegistryDecoder {
private static final String USER_AGENT_APP_NAME = "kcl" + "-" + KinesisClientLibraryPackage.VERSION;
private final GlueSchemaRegistryDeserializer glueSchemaRegistryDeserializer;

public SchemaRegistryDecoder(
GlueSchemaRegistryDeserializer glueSchemaRegistryDeserializer) {
this.glueSchemaRegistryDeserializer = glueSchemaRegistryDeserializer;
this.glueSchemaRegistryDeserializer.overrideUserAgentApp(USER_AGENT_APP_NAME);
}

/**
Expand Down

0 comments on commit c5ce30f

Please sign in to comment.