<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ayman Farhat on Medium]]></title>
        <description><![CDATA[Stories by Ayman Farhat on Medium]]></description>
        <link>https://medium.com/@aymanf?source=rss-3c051e65c0a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KPj3ZKP_hChbkEosgJURsw.jpeg</url>
            <title>Stories by Ayman Farhat on Medium</title>
            <link>https://medium.com/@aymanf?source=rss-3c051e65c0a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:56:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aymanf/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Taming Legacy Java Dependencies with Pomify and Google Cloud Artifact Registry]]></title>
            <link>https://medium.com/google-cloud/taming-legacy-java-dependencies-with-pomify-and-google-cloud-artifact-registry-ad528be2da9e?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad528be2da9e</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[artifact-registry]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 10:46:03 GMT</pubDate>
            <atom:updated>2025-01-20T14:50:33.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uy0Nq1aJs24Q5bZuH7zaoQ.png" /><figcaption>Image Generated via Imagen 3</figcaption></figure><p>A few months back, I was tasked with rewriting a legacy Java computational chemistry service that had been lovingly (or perhaps fearfully) maintained for decades. Diving into hundreds of unorganised dependencies felt more like an archaeological dig than a software development project.</p><p>Over 600 JAR files scattered across lib folders, with no sign of Maven, Gradle or any other build tool configuration. The legacy application simply relied on having all JARs within it’s class path without any build or dependency management system in place.</p><p>It was a dependency nightmare, which included</p><ul><li>Outdated JARs that already exist on Maven central</li><li>Proprietary JARs that were not easily identifiable by their file names</li><li>Multiple JARs for the same dependency with different outdated versions</li><li>Dependencies with security vulnerabilities that needed upgrading</li></ul><p>This “just drop the JAR in the lib folder” approach might seem simple at first, but it quickly becomes a breeding ground for problems. Inconsistencies between library versions, dependency conflicts, and the dreaded “ClassNotFoundException” become frequent visitors. Not to mention the security risks associated with using outdated and potentially vulnerable dependencies.</p><h3>Cleanup Approach</h3><p>The first thing I needed to do, before kicking off the rewrite was to re-organise and clean up the dependencies as a big part of the new code still had to rely on many of those JARfiles. Of course, going through the dependencies JAR by JAR was not an option.</p><p>I wanted to apply the following workflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*n6dNhljPrYtfjX5XatFBDQ.png" /><figcaption>Initial workflow I wanted to follow for cleanup</figcaption></figure><h3>Introducing Pomify</h3><p><a href="https://github.com/aymanfarhat/pomify">Pomify</a> automates the above flow. It’s a CLI tool, which streamlines the process of generating pom.xml dependency definitions from a collection of JAR files and facilitates migration to a structured dependency management system and repository.</p><h4>How it works</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KVnQTLavevaF1AQV.png" /><figcaption>High level features of pomify</figcaption></figure><ol><li><strong>Scanning:</strong> Pomify scans a specified directory for JAR files.</li><li><strong>Identifying:</strong> It attempts to identify each JAR and determine its corresponding Maven coordinates (groupId, artifactId, version).</li><li><strong>Generating:</strong> It generates a pom.xml file containing the identified dependencies.</li><li><strong>Pushing (Optional):</strong> It can optionally push the identified JARs to a specified Maven repository, such as <a href="https://cloud.google.com/artifact-registry/docs/java">Google Cloud’s Artifact Registry</a>.</li></ol><h4>Step by step usage</h4><ol><li><strong>Scan to identify dependencies</strong></li></ol><p>Scans a directory of JAR files and output a CSV report</p><pre>pomify scan --jars /path/to/jars --output /path/to/output.csv</pre><p>This command will output a list of identified JAR files along with their inferred Maven coordinates. For JARs it can’t identify, it will flag them, allowing you to manually add the correct coordinates later.</p><p>A report is generated which gives you an overview of each JAR file and different metadata associated with it e.g.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKp1Tk7P9qe8RnmRywOJ9Q.png" /><figcaption>Example scan analysis output</figcaption></figure><p><strong>2. Generate pom.xml files</strong></p><p>Using the report from the previous step, this command will generate two pom.xml &lt;dependencies&gt; bloc split into two seperate files. One contains the list of dependencies identified to already exist on Maven central and one for the JARs that have been identified as proprietary which will need to be pushed into a private Maven repository.</p><pre>pomify generate --report /path/to/output.csv --output /path/to/output</pre><p>This makes it convenient to review the set of dependency blocks, discard what you don’t need and eventually copy paste what remains into a clean pom.xml for the new target project.</p><p><strong>3. Pushing to a private Maven repository on Artifact Registry</strong></p><p>Pomify supports pushing dependencies into any Maven repository, in this example we’ll be pushing the JAR files to <a href="https://cloud.google.com/artifact-registry/docs">Google Cloud’s Artifact Registry</a> which conveniently provides this capability.</p><p><strong>Defining an artifact registry Maven repository</strong></p><p>If you don’t have a Maven repository defined yet on Artifact Registry, you can create one with the command below.</p><pre>  gcloud artifacts repositories create your-repository-name \<br>      --repository-format=maven \<br>      --location=your-region \<br>      --description=&quot;Description of your repository&quot; \<br>      --async</pre><p>For full details, check out the <a href="https://cloud.google.com/artifact-registry/docs/java/store-java">official documentation</a> page on creating repositories.</p><p><strong>Generating the push script and uploading the JARs</strong></p><p>Once a remote repository is available, we can now run the “push” command.</p><pre>pomify push --report /path/to/output.csv --mvn_repo artifactregistry://europe-west2-maven.pkg.dev/your-gcp-project/your-custom-maven-repo</pre><p>This generates a maven deploy script for all the unidentified JAR files to be pushed into a private maven repository of your choice. Once the Maven deploy script is generated, it would look something like this</p><pre>#!/bin/bash<br><br>mvn_repo=&quot;artifactregistry://europe-west2-maven.pkg.dev/your-gcp-project/your-custom-maven-repo&quot;<br><br># Array to hold JAR details<br>jars=(  <br>  &quot;/path/to/jars/lib/ws-commons-util-1.0.2.jar org.apache.ws.commons.util ws-commons-util 1.0.2&quot;<br>  &quot;/path/to/jars/lib/wsdl4j-1.6.3.jar wsdl4j wsdl4j 1.6.3&quot;<br>  &quot;/path/to/jars/lib/xmlbeans-5.1.1.jar org.apache.xmlbeans xmlbeans 5.1.1&quot;<br>  &quot;/path/to/jars/lib/xmlgraphics-commons-2.9.jar org.apache.xmlgraphics xmlgraphics-commons 2.9&quot;<br>  ....<br>  ....<br>)<br><br># Loop through the array and execute Maven deploy command<br>for jar in &quot;${jars[@]}&quot;; do<br>  local_filepath=$(echo &quot;$jar&quot; | awk &#39;{print $1}&#39;)<br>  group_id=$(echo &quot;$jar&quot; | awk &#39;{print $2}&#39;)<br>  artifact_id=$(echo &quot;$jar&quot; | awk &#39;{print $3}&#39;)<br>  version=$(echo &quot;$jar&quot; | awk &#39;{print $4}&#39;)<br><br>  mvn deploy:deploy-file \<br>    -Dfile=&quot;$local_filepath&quot; \<br>    -DgroupId=&quot;$group_id&quot; \<br>    -DartifactId=&quot;$artifact_id&quot; \<br>    -Dversion=&quot;$version&quot; \<br>    -Dpackaging=&quot;jar&quot; \<br>    -DgeneratePom=true \<br>    -Durl=&quot;$mvn_repo&quot; \<br>    -DcreateChecksum=true<br>done</pre><p>The pomify command should save the above script in the output folder you’ve chosen. To upload the JAR files into the remote maven repository, all you have to do it run this command from a maven initialised java project e.g. sh import-command.sh</p><h3>Future Enhancements</h3><p>I’m currently working to improve <a href="https://github.com/aymanfarhat/pomify">Pomify</a> and make it more useful for automating the cleanup and migration tasks. Here is what I’m focusing on:</p><ul><li><strong>Security Vulnerability Scanning:</strong> Integrating vulnerability scanning to help identify and address security risks within your dependencies. This will provide insights into potential vulnerabilities present in your JAR files.</li><li><strong>Version Bump Recommendations:</strong> For dependencies found on Maven Central, <a href="https://github.com/aymanfarhat/pomify">Pomify</a> will suggest updates to newer versions in the report, making it easier to keep your project up-to-date and benefit from the latest features and bug fixes.</li><li><strong>Streamlined Artifact Registry Push:</strong> Simplifying the push process to Artifact Registry by directly integrating it into the CLI. This will eliminate the need for a separate mvn push script, making the workflow smoother and simpler.</li><li><strong>Duplicate JAR Detection: </strong>Adding a feature to flag potential duplicate JAR files, helping you identify and resolve dependency conflicts and reduce the overall size of your project. This will analyze the contents of your JARs to identify potential duplicates even if they have different filenames or versions.</li></ul><h3>Closing note</h3><p>So, if you’re facing a mountain of unruly JAR files in your legacy Java project, don’t despair! Maybe <a href="https://github.com/aymanfarhat/pomify">Pomify</a> can offer a practical and efficient way to bring some order to the chaos.</p><p>Check out the <a href="https://github.com/aymanfarhat/pomify">Pomify GitHub repository</a>. Contributions, feedback, and feature requests are always welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad528be2da9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/taming-legacy-java-dependencies-with-pomify-and-google-cloud-artifact-registry-ad528be2da9e">Taming Legacy Java Dependencies with Pomify and Google Cloud Artifact Registry</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Worker Dependencies in Apache Beam Pipelines]]></title>
            <link>https://medium.com/google-cloud/managing-worker-dependencies-in-apache-beam-pipelines-5ad0dd8d5be1?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad0dd8d5be1</guid>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[google-cloud-dataflow]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 16:25:40 GMT</pubDate>
            <atom:updated>2024-10-04T08:02:51.130Z</atom:updated>
            <content:encoded><![CDATA[<h3>Managing Worker Dependencies in Apache Beam Dataflow Pipelines</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGzNk1LUo8r7HUR2bN-N5w.png" /></figure><p>When building and deploying Apache Beam pipelines, you often need to include external runtime dependencies that your pipeline code relies on. It’s crucial to ensure these dependencies are available to the workers as soon as they start up, even before any processing begins.</p><p>This blog post explores the various methods and best practices for managing and loading dependencies during worker initialization in Apache Beam on Dataflow.</p><p>For the purpose of this post, “dependencies” refers to external files such as additional configuration, metadata, keys, license files, and similar resources that your pipeline code requires to function.</p><h3>Example: Managing KafkaIO TLS Dependencies</h3><p>When using the KafkaIO connector in Apache Beam with TLS authentication, the underlying workers (e.g. Dataflow) require access to various files on their local filesystem. These files, such as Truststore/Keystore JKS files and keytabs, are necessary for KafkaIO to establish secure connections.</p><h4>Anti-pattern: Embedding Dependencies Statically at Build Time</h4><p>One approach, which I discourage for this use case, is to embed these dependencies directly into the SDK container image at build time. This involves copying the necessary files into a specific directory within the image. For example:</p><pre>FROM apache/beam_java11_sdk:2.57.0<br># Copy the secrets folder to the container<br># This folder would contain client.truststore.jks and client.keystore.jks etc..<br>COPY /local-machine/secrets /secrets</pre><p>You would then configure the KafkaIO connector to use these files by specifying their location in the consumer configuration, like this:</p><pre>Map &lt; String, Object &gt; consumerConfig = ImmutableMap.of(<br>    &quot;security.protocol&quot;, &quot;SSL&quot;,<br>    // Static paths!<br>    &quot;ssl.truststore.location&quot;, &quot;/secrets/client.truststore.jks&quot;,<br>    &quot;ssl.truststore.password&quot;, options.getSslTruststorePass(),<br>    &quot;ssl.keystore.location&quot;, &quot;/secrets/client.keystore.jks&quot;,<br>    &quot;ssl.keystore.password&quot;, options.getSslKeystorePass(),<br>    &quot;ssl.endpoint.identification.algorithm&quot;, options.getSslEndpointIdentificationAlgorithm()<br>);<br><br>p.apply(&quot;Read from Kafka&quot;, KafkaIO. &lt; String, String &gt; read()<br>    .withBootstrapServers(options.getKafkaBootstrapServers())<br>    .withConsumerConfigUpdates(consumerConfig)<br>    .withTopic(options.getKafkaTopic())<br>    .withKeyDeserializerAndCoder(<br>        StringDeserializer.class, NullableCoder.of(StringUtf8Coder.of()))<br>    .withValueDeserializerAndCoder(<br>        StringDeserializer.class, NullableCoder.of(StringUtf8Coder.of())<br>    )<br>    .withoutMetadata()<br>)</pre><p>While this approach might seem straightforward, it is discouraged for several reasons:</p><ol><li>It’s <strong>Security Risk:</strong> Embedding sensitive files like JKS files in the container image exposes them to the build system, posing a significant security risk. Many organizations prohibit this practice.</li><li><strong>Tight Coupling:</strong> It tightly couples non-code dependencies to the container image. If these files (e.g, certificates) expire or change, you’ll need to rebuild and redeploy the entire pipeline, which can be disruptive, especially for continuously running pipelines.</li><li><strong>Operational Overhead:</strong> Rebuilding and redeploying frequently can introduce significant operational overhead.</li></ol><p>However, this approach might be suitable for other use cases where the dependencies are entirely static and rarely change, such as including external binaries that are tightly coupled with the SDK container image.</p><h4>Recommended Approach: Loading Dependencies Dynamically at Worker Launch</h4><p>A recommended approach for loading dependencies dynamically is to leverage Apache Beam’s <strong>JvmInitializer</strong> service. This service provides an interface for defining actions that are executed on the Java Virtual Machine (JVM) during pipeline startup.</p><p>Two key methods,<em> </em><strong><em>onStartup</em></strong> and <strong><em>beforeProcessing</em></strong>, are invoked at specific stages of worker initialization. For our KafkaIO TLS example, either method can be used to load the necessary dependencies.</p><p>To implement the JvmInitializerhook, follow these steps:</p><ol><li><strong>Define a JvmInitializer Class</strong></li></ol><p>Create a class that implements the org.apache.beam.sdk.harness.JvmInitializer interface.</p><p>The following code example demonstrates a KafkaSslInitializer class that implements the <strong><em>beforeProcessing</em></strong> method. This example downloads JKS files required for Kafka authentication from Google Cloud Secret Manager using a helper class I previously defined called SecretManagerHelper.</p><pre>package org.apache.beam.samples;<br><br>import com.google.auto.service.AutoService;<br>import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;<br>import org.apache.beam.sdk.harness.JvmInitializer;<br>import org.apache.beam.sdk.options.PipelineOptions;<br><br>@AutoService(JvmInitializer.class)<br>public class KafkaSslInitializer implements JvmInitializer {<br>  @Override<br>  public void beforeProcessing(PipelineOptions options) {<br>    StreamPipelineOptions streamOptions = options.as(StreamPipelineOptions.class);<br><br>    SecretManagerServiceClient client =<br>        SecretManagerHelper.DefaultSecretManagerServiceClientHolder.INSTANCE;<br>    SecretManagerHelper secretManagerHelper =<br>        new SecretManagerHelper(client, streamOptions.getSecretManagerProjectId());<br><br>    secretManagerHelper.downloadSecretDataToFile(<br>        streamOptions.getSslTruststoreFileSecretId(), streamOptions.getSslTruststoreLocation());<br>    secretManagerHelper.downloadSecretDataToFile(<br>        streamOptions.getSslKeystoreFileSecretId(), streamOptions.getSslKeystoreLocation());<br>  }<br>}</pre><p><strong>2. Include and Configure AutoService</strong></p><p><a href="https://central.sonatype.com/artifact/com.google.auto.service/auto-service">Auto Service</a> is a dependency that should be included in your pom.xml file.</p><p>The AutoService library automates the registration of your KafkaSslInitializer as a service provider for the JvmInitializer interface.</p><p>Essentially, it generates a META INF/services/org.apache.beam.sdk.harness.JvmInitializer file at compile time and adds your KafkaSslInitializer class to it. This ensures that Beam can discover and use your custom initializer.</p><p>To include AutoService, add the following dependency to your pom.xml file</p><pre>&lt;dependency&gt;<br>   &lt;groupId&gt;com.google.auto.service&lt;/groupId&gt;<br>    &lt;artifactId&gt;auto-service-annotations&lt;/artifactId&gt;<br>    &lt;version&gt;${auto-service.version}&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>Under your <strong>build &gt; plugins block</strong>, make sure to include a configuration for the AutoService, this ensures that AutoService is triggered at build time. eg.</p><pre>&lt;build&gt;<br>  ... <br> &lt;plugins&gt;<br>  ...<br>  &lt;plugin&gt;<br>   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>   &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>   &lt;version&gt;${maven-compiler-plugin.version}&lt;/version&gt;<br>   &lt;configuration&gt;<br>    &lt;annotationProcessorPaths&gt;<br>     &lt;path&gt;<br>      &lt;groupId&gt;com.google.auto.service&lt;/groupId&gt;<br>      &lt;artifactId&gt;auto-service&lt;/artifactId&gt;<br>      &lt;version&gt;${auto-service.version}&lt;/version&gt;<br>     &lt;/path&gt;<br>    &lt;/annotationProcessorPaths&gt;<br>   &lt;/configuration&gt;<br>  &lt;/plugin&gt;<br> &lt;/plugins&gt;<br>&lt;/build&gt;</pre><p><strong>3. Configure the Maven Shade Plugin</strong></p><p>To package your pipeline and its dependencies into a single executable JAR (<a href="https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html">UberJar</a>), you can configure the Maven Shade plugin. This is useful for simplifying deployment and ensures all class dependencies, META-INF files etc… are all in one place.</p><p>Below is an example configuration from my pom.xml file’s &lt;build&gt; section for enaling UberJar are build time.</p><pre>&lt;plugin&gt;<br> &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br> &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;<br> &lt;version&gt;${maven-shade-plugin.version}&lt;/version&gt;<br> &lt;executions&gt;<br>  &lt;execution&gt;<br>   &lt;phase&gt;package&lt;/phase&gt;<br>   &lt;goals&gt;<br>    &lt;goal&gt;shade&lt;/goal&gt;<br>   &lt;/goals&gt;<br>   &lt;configuration&gt;<br>    &lt;extraDirectories&gt;<br>     &lt;paths&gt;<br>      &lt;path&gt;${project.build.directory}/extra_libs&lt;/path&gt;<br>     &lt;/paths&gt;<br>    &lt;/extraDirectories&gt;<br>    &lt;createDependencyReducedPom&gt;false&lt;/createDependencyReducedPom&gt;<br>    &lt;artifactSet&gt;<br>     &lt;excludes&gt;<br>      &lt;exclude&gt;org.conscrypt:conscrypt-openjdk-uber&lt;/exclude&gt;<br>     &lt;/excludes&gt;<br>     &lt;includes&gt;<br>      &lt;include&gt;*:*&lt;/include&gt;<br>     &lt;/includes&gt;<br>    &lt;/artifactSet&gt;<br>    &lt;transformers&gt;<br>     &lt;transformer implementation=&quot;org.apache.maven.plugins.shade.resource.ManifestResourceTransformer&quot;&gt;&lt;/transformer&gt;<br>     &lt;transformer implementation=&quot;org.apache.maven.plugins.shade.resource.ServicesResourceTransformer&quot;/&gt;<br>    &lt;/transformers&gt;<br>    &lt;filters&gt;<br>     &lt;filter&gt;<br>      &lt;artifact&gt;*:*&lt;/artifact&gt;<br>      &lt;excludes&gt;<br>       &lt;exclude&gt;META-INF/*.SF&lt;/exclude&gt;<br>       &lt;exclude&gt;META-INF/*.DSA&lt;/exclude&gt;<br>       &lt;exclude&gt;META-INF/*.RSA&lt;/exclude&gt;<br>      &lt;/excludes&gt;<br>     &lt;/filter&gt;<br>    &lt;/filters&gt;<br>   &lt;/configuration&gt;<br>  &lt;/execution&gt;<br> &lt;/executions&gt;<br>&lt;/plugin&gt;</pre><p>You can find a complete example pom.xml configuration that includes all the necessary dependencies and plugin configurations <a href="https://github.com/aymanfarhat/kafka2pubsub/blob/main/pom.xml">here</a>.</p><p><strong>4. Triggering JvmInitializer on the Pipeline Launcher (for KafkaIO)</strong></p><p>Some IO connectors, including KafkaIO, require the dependency files to be available on the Dataflow pipeline launcher as well as the workers. This is because KafkaIO validates the paths of the JKS files during pipeline construction, which happens on the launcher before any workers are started.</p><p>To ensure these files are available on the launcher, you need to manually trigger the <strong>JvmInitializer’</strong>s beforeProcessing method in your main pipeline definition <em>before</em> creating the Pipeline object.”</p><p>The following code snippet demonstrates how to trigger the <strong><em>KafkaSslInitializer’s</em></strong> <strong><em>beforeProcessing</em></strong> method on the pipeline launcher</p><pre>public class MainPipeline {<br>  static void runKafka2Pubsub(StreamPipelineOptions options) {<br>    // Initialize the Kafka SSL properties on the worker<br>    new KafkaSslInitializer().beforeProcessing(options);<br><br>    // Initialize the pipeline object here<br>    Pipeline p = Pipeline.create(options);<br><br>    .... (Rest of the pipeine code here)<br>  }</pre><p>Full code for for the above example can be found <a href="https://github.com/aymanfarhat/kafka2pubsub/blob/main/src/main/java/org/apache/beam/samples/MainPipeline.java">here</a>.</p><h4><strong>Limitations of the JvmInitializer Approach</strong></h4><p>It’s important to note that, as of the time of writing, the <strong>JvmInitializer</strong> approach is primarily supported in portable pipelines or when using the Google Cloud Dataflow runner.</p><p>However, this approach is particularly valuable in Dataflow environments because jobs are typically ephemeral, and configuration files are often stored in services like Google Cloud Storage or Secret Manager rather than on long-running worker clusters.</p><h4><strong>End-to-End Example</strong></h4><p>To see a complete, working example of how to implement the <strong>JvmInitializer</strong> approach with KafkaIO and SSL authentication, I put together this example <a href="https://github.com/aymanfarhat/kafka2pubsub/tree/main">repository</a>. It’s a basic Beam pipeline for converting Kafka messages into PubSub events.</p><h4>Thanks for reading!</h4><p>Found this post helpful? Would love to hear your thoughts! Leave a comment below with any feedback or questions you might have. And if you enjoyed the post, don’t forget to give it a clap — it helps others discover this content too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad0dd8d5be1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/managing-worker-dependencies-in-apache-beam-pipelines-5ad0dd8d5be1">Managing Worker Dependencies in Apache Beam Pipelines</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eliminate Auto-Scaling Bottlenecks by using Private IPs for Dataflow Workers]]></title>
            <link>https://medium.com/google-cloud/eliminate-auto-scaling-bottlenecks-by-using-private-ips-for-dataflow-workers-23a8a73cecd5?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/23a8a73cecd5</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[private-and-public-ip]]></category>
            <category><![CDATA[dataflow]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Fri, 10 Mar 2023 11:28:31 GMT</pubDate>
            <atom:updated>2023-03-11T02:19:51.887Z</atom:updated>
            <content:encoded><![CDATA[<p>Scaling Cloud Dataflow pipelines to hundreds of workers can be challenging if you run out of quota for workers. One quota that can easily block autoscaling is the default number of public IP addresses in a project.</p><p><strong>By default, Dataflow launches workers with public IPs on a default network</strong>. Given a scenario where the pipeline is using single cpu workers (e.g. n1-standard-1), your compute auto-scaling would be capped to 69 machines rather than 200 (the default limit for CPUs per region per project)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Do_zAOT1j2i01I0qQAVP8w.png" /><figcaption>In a given region, my CPU compute engine quota is 200 but the number of public IPs allowed 69.</figcaption></figure><p>You can notice this in the autoscaling chart, number of current workers <strong>not reaching the target designated by Dataflow</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JfSMA3IdcDPyBhnf1q0aA.png" /></figure><p>This should also appear in your pipeline’s logs as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XYR6K1i0oy3Hp31O9hjUA.png" /><figcaption>Example Dataflow log (QUOTA_EXCEEDED)</figcaption></figure><p>Requesting a quota increase on the number of public IPs in the project works, but it’s not the correct solution for several reasons</p><ol><li><strong>It’s not automatic</strong>, it will take some time between the request and having support look at the case and approve it.</li><li>Usually there is <strong>little to no added value</strong> in publicly exposing your Dataflow workers. As a matter of fact, public IPs could contribute to higher networking costs and a less secure (publicly exposed) pipeline.</li></ol><h3>How to fix this</h3><p>This is easily solvable by simply switching workers to use <strong>private IPs</strong>. In reality there is no situation that I can think of where public IPs would be ever needed for Dataflow workers. Let’s look into how to do it.</p><h4><strong>Define a VPC and sub-network</strong></h4><p>Those can be defined from the CLI, GCP UI or Terraform. For example, here is how to do it via the command line.</p><p>Define a <a href="https://cloud.google.com/vpc/docs/vpc"><strong>VPC network</strong></a></p><pre>NETWORK=&quot;my-custom-net&quot;<br>ROUTING=&quot;regional&quot;<br><br>gcloud compute networks create $NETWORK \<br>    --subnet-mode=custom \<br>    --bgp-routing-mode=$ROUTING</pre><p>Define a <a href="https://cloud.google.com/vpc/docs/subnets"><strong>subnet</strong></a> in the VPC</p><pre>NETWORK=&quot;my-custom-net&quot;<br>SUBNET=&quot;my-custom-sub&quot;<br>PRIMARY_RANGE=&quot;10.164.0.0/23&quot;<br>REGION=&quot;europe-west1&quot;<br><br>gcloud compute networks subnets create $SUBNET \<br>    --network=$NETWORK \<br>    --range=$PRIMARY_RANGE \<br>    --region=$REGION \<br>    --enable-private-ip-google-access</pre><p>In the example above we define a subnet with an IP range of 10.164.0.0/23 this should support up to 510 usable private IP addresses.</p><p><strong>— enable-private-ip-google-access</strong> is pretty useful to have, as it will allow workers to access internal GCP services / APIs without having to define additional firewall rules for that.</p><h4><strong>Set Firewall rules</strong></h4><p><strong>Instances on this network won’t be reachable until </strong><a href="https://cloud.google.com/dataflow/docs/guides/routes-firewall"><strong>firewall rules</strong></a><strong> are created</strong>. If you try to run your pipeline with the freshly created subnet, the pipeline will launch but workers won’t be able to communicate within the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLPiDtix1b8LX_saj1U6Aw.png" /><figcaption>Firewall rules need to be set for workers to run properly</figcaption></figure><p>To fix that, we can set a simple firewall rule similar to the one below.</p><pre>NETWORK=&quot;my-custom-net&quot;<br>SUBNET=&quot;my-custom-sub&quot;<br>PRIMARY_RANGE=&quot;10.164.0.0/23&quot;<br><br>gcloud compute firewall-rules create allow-df-ingress \<br>    --network $NETWORK \<br>    --direction &quot;ingress&quot; \<br>    --action &quot;allow&quot; \<br>    --source-tags &quot;dataflow&quot; \<br>    --source-ranges $PRIMARY_RANGE \<br>    --rules &quot;tcp:12345-12346&quot;</pre><p>The above command should create the necessary ingress rules for Dataflow workers to be reachable on ports 12345 and 12346 within the same private subnetwork.</p><p>That’s the bare minimum needed for any pipeline to function properly. Depending on your pipeline you might need to add additional <a href="https://cloud.google.com/dataflow/docs/guides/routes-firewall">firewall rules</a>. For example, if your workers call HTTP APIs on external networks you will need to define <strong>egress rules </strong>allowing that.</p><h4>Launch the pipeline</h4><p>Now we can launch the pipeline, adding 3 new flags specifying the <strong>network</strong>, <strong>subnetwork</strong> path and <strong>no_use_public_ips.</strong> In addition, make sure to<strong> set the region flag to that of your subnetwork. </strong>This will launch the pipeline in a subnetwork with worker VMs on private IPs.</p><pre>python ./src/pipeline.py \<br>    --runner=&quot;DataflowRunner&quot; \<br>    --temp_location=&quot;gs://my-tmp-bucket/tmp/&quot; \<br>    --project=&quot;my-project&quot; \<br>    --region=&quot;europe-west1&quot;<br>    --machine_type=&quot;n1-standard-1&quot; \<br>    --network=&quot;mynetwork&quot; \<br>    --subnetwork=&quot;regions/europe-west1/subnetworks/mynetwork&quot; \<br>    --no_use_public_ips</pre><p>Avoiding the public IP quota on the project, the pipeline would then scale up to the target workers set by Dataflow. The chart below shows how the pipeline is auto-scaling to the number of target workers set by Dataflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaZ0ukcNPW-VKj31PlhvzA.png" /><figcaption>Current workers = target</figcaption></figure><p>Your pipeline’s summary should now indicate the network, subnet, and that it is not using public IPs similar to the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*nHI9-hJzcyuZODXJS-aD0g.png" /></figure><p>The next potential bottleneck would be the default quota on the number of CPUs per region per project which is 200 (at the time of writing).</p><p>I would make the decision here for a quota increase based on <strong>whether truly the pipeline needs more than 200 CPUs</strong> in a given run. If not, I would keep it capped to a number up to 200 and <strong>make sure there aren’t other services using compute instances in the same region and project</strong>.</p><h3>Recap</h3><p>As we’ve seen, the default number of public IP addresses in a project can easily block autoscaling. The solution is straightforward and simple: switch workers to use private IPs. This would also improves security and reduces networking costs.</p><p>After switching to private IP make sure to keep a couple of points in mind</p><ol><li>You might need to add additional egress <a href="https://cloud.google.com/dataflow/docs/guides/routes-firewall">firewall rules</a> to your subnet, depending on your pipeline’s behaviour</li><li>Keep an eye on your per project/region CPU quota</li></ol><p>I hope you found this tip helpful, if you have feedback feel free to share. I wish you the best of luck in your future Dataflow endeavours!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23a8a73cecd5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/eliminate-auto-scaling-bottlenecks-by-using-private-ips-for-dataflow-workers-23a8a73cecd5">Eliminate Auto-Scaling Bottlenecks by using Private IPs for Dataflow Workers</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Airflow Logs on Google Cloud Storage with Object Lifecycle Management]]></title>
            <link>https://medium.com/google-cloud/managing-airflow-logs-on-google-cloud-storage-with-object-lifecycle-management-a80befe8eeab?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a80befe8eeab</guid>
            <category><![CDATA[google-cloud-composer]]></category>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[object-lifecycle]]></category>
            <category><![CDATA[google-cloud-storage]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Mon, 15 Aug 2022 14:30:35 GMT</pubDate>
            <atom:updated>2022-08-15T16:36:27.406Z</atom:updated>
            <content:encoded><![CDATA[<p>Airflow DAGs on Cloud Composer generate log files on Google Cloud Storage for every run. Those scheduled to run frequently, tend to generate more logs, leading to a faster pile up of storage cost over time. Applying CGS bucket lifecycle rules can be a viable solution to this problem, let’s explore how!</p><p>One reason to be managing older historical logs is cost optimisation. Pricing on a GCS bucket is determined based on several factors such as <strong><em>storage</em></strong>, <strong><em>processing</em></strong> and <strong><em>networking</em></strong>. Storage and retrieval pricing rates depend on the storage class chosen for the bucket and objects. A detailed guide on GCS pricing <a href="https://cloud.google.com/storage/pricing">here</a>.</p><h4>Storage options for Airflow logs on GCS</h4><p>With Cloud Composer, the default storage class for the bucket and underlying objects is set to <strong>standard</strong>, with these <a href="https://cloud.google.com/storage/pricing#europe">pricing rates</a>. Standard storage is a good option for files that are frequently accessed. Other classes can be more cost efficient for content that is less frequently accessed or processed, such as logs older than<strong><em> n days</em></strong>. Below is a summary taken from the GCP UI summarising use cases for each storage class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOZUK28PDIuPcubslsgv0w.png" /><figcaption>Storage options available for GCS buckets</figcaption></figure><p>Consider a use case, where there is no need to access DAG logs that are older than 30 days except maybe once a year. <strong><em>Would it be possible to keep all log objects in the same bucket and assign different storage classes per object ?</em></strong> Luckily, Google Cloud Storage supports that and we can automate class switching on objects with lifecycle rules!</p><h4>What you need to know about GCS Lifecycle rules</h4><p>When <a href="https://cloud.google.com/storage/docs/lifecycle">lifecycle rules</a> are set, Cloud Storage would regularly inspect all objects in a bucket matching any set patterns and perform all actions applicable to those rules.</p><p>Lifecycle actions and patterns are defined and applied on the level of the entire bucket, not “folders”. One should be careful with the definition of patterns such as prefix , suffix , storage class etc.. making sure rules are as granular as required. Last thing you’d want, is actions spilling over to other objects in the same bucket that have nothing to do with the lifecycle rule.</p><p>Another detail, is that a GCS bucket needs to have object versioning pre-enabled for lifecycle rules to be applied properly. As of the time of writing, object versioning isn’t enabled by default on buckets belonging to a Cloud Composer instance. You will need to enable that yourself.</p><p>This can be easily set from the UI or via a gsutil command such as</p><pre>gsutil versioning set on gs://my-awesome-gcs-bucket</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dg_wNHX-z7b9lQuhoisaww.png" /><figcaption>Example bucket with object versioning enabled</figcaption></figure><p>Finally, object lifecycle management is a large topic, I recommend familiarising yourself with all concepts before using it in production. The <a href="https://cloud.google.com/storage/docs/lifecycle">official documentation</a> on Google Cloud Storage is a great start.</p><h3>Applying lifecycle rules on Airflow logs</h3><p>Lifecycle rules can be applied via the CLI (<a href="https://cloud.google.com/storage/docs/lifecycle-configurations#gsutil"><strong>gsutil</strong></a>), GCS API and the GCP UI. In the following examples, we’ll be applying the example rules via <a href="https://cloud.google.com/storage/docs/lifecycle-configurations#gsutil"><strong>gsutil</strong></a>.</p><h4>Archiving older logs via setting a storage class</h4><p>A GCS bucket has by default a storage class for any new object that gets written, storage class for child objects can be overridden. This is convenient, as older logs remain organised in the same bucket, but with different storage class appropriate for their expected frequency of access.</p><p>A lifecycle rule can be defined as a JSON object, composed of two main configuration blocks: <strong>action</strong> and <strong>condition</strong>. For archiving logs older than 30 days:</p><ul><li>Set the action to <strong>SetStorageClass </strong>along with the target value for that storage class, <strong>ARCHIVE</strong>.</li><li>Set the condition to multiple criteria, relevant to the structure of the logs folder in the Airflow bucket. In this case, we’re interested in capturing only files that are under the logs/* folder that have been stored for <strong>at least 30 days</strong> with <strong>STANDARD</strong> (default) class.</li><li>A typical airflow log file path would start with (prefix) <strong>logs/ </strong>and end (suffix) with<strong> .log</strong></li></ul><p>Below is an example of how this lifecycle configuration would look like with the JSON syntax.</p><pre>{<br>  &quot;lifecycle&quot;: {<br>    &quot;rule&quot;: [<br>      {<br>        &quot;action&quot;: {<br>          &quot;type&quot;: &quot;SetStorageClass&quot;,<br>          &quot;storageClass&quot;: &quot;ARCHIVE&quot;<br>        },<br>        &quot;condition&quot;: {<br>          &quot;matchesPrefix&quot;: [<br>            &quot;logs/&quot;<br>          ],<br>          &quot;matchesSuffix&quot;: [<br>            &quot;.log&quot;<br>          ],<br>          &quot;age&quot;: 30,<br>          &quot;matchesStorageClass&quot;: [<br>            &quot;STANDARD&quot;<br>          ]<br>        }<br>      }<br>    ]<br>  }<br>}</pre><p>If more frequent access to the logs is expected, you might want to consider other classes such as <strong>NEARLINE</strong>, or <strong>COLDLINE</strong> full details on each class is available <a href="https://cloud.google.com/storage/docs/storage-classes#classes">here</a>.</p><p>You can then simply apply the lifecycle configuration via gsutil with a command similar to the one below.</p><pre>gsutil lifecycle set my-lifecycle.json gs://my-awesome-airflow-bucket</pre><h4>Deleting</h4><p>If logs aren’t needed at all after a period of time, they can be simply scheduled for deletion via another rule. This would follow the same structure as the previous example. Only difference here is that the action is set to <strong>Delete</strong>.</p><pre>{<br>  &quot;lifecycle&quot;: {<br>    &quot;rule&quot;: [<br>      {<br>        &quot;action&quot;: {<br>          &quot;type&quot;: &quot;Delete&quot;<br>        },<br>        &quot;condition&quot;: {<br>          &quot;matchesPrefix&quot;: [<br>            &quot;logs/&quot;<br>          ],<br>          &quot;matchesSuffix&quot;: [<br>            &quot;.log&quot;<br>          ],<br>          &quot;age&quot;: 365<br>        }<br>      }<br>    ]<br>  }<br>}</pre><h4>Combining lifecycle rules</h4><p>A bucket’s lifecycle can be composed of several rules, this enables you to follow a hybrid approach to managing older airflow logs. One approach for example, can be to set two rules:</p><ol><li>Convert logs older than 30 days to <strong>COLDLINE</strong> or <strong>ARCHIVE</strong> storage class (depending on access frequency needed)</li><li>Delete them after 365 days</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_SIMpU3Z2ucOH1oIQaKIQ.png" /><figcaption>Example hybrid approach to GCS logs management</figcaption></figure><p>In terms of configuration, this can simply translate to combining the two previous lifecycles we defined into one lifecycle with multiple rules.</p><p>One lifecycle object, with multiple rule objects added to the rule array.</p><pre>{<br>  &quot;lifecycle&quot;: {<br>    &quot;rule&quot;: [<br>      {<br>        &quot;action&quot;: {<br>          &quot;type&quot;: &quot;SetStorageClass&quot;,<br>          &quot;storageClass&quot;: &quot;ARCHIVE&quot;<br>        },<br>        &quot;condition&quot;: {<br>          &quot;matchesPrefix&quot;: [<br>            &quot;logs/&quot;<br>          ],<br>          &quot;matchesSuffix&quot;: [<br>            &quot;.log&quot;<br>          ],<br>          &quot;age&quot;: 30,<br>          &quot;matchesStorageClass&quot;: [<br>            &quot;STANDARD&quot;<br>          ]<br>        }<br>      },<br>      {<br>        &quot;action&quot;: {<br>          &quot;type&quot;: &quot;Delete&quot;<br>        },<br>        &quot;condition&quot;: {<br>          &quot;matchesPrefix&quot;: [<br>            &quot;logs/&quot;<br>          ],<br>          &quot;matchesSuffix&quot;: [<br>            &quot;.log&quot;<br>          ],<br>          &quot;age&quot;: 365,<br>          &quot;matchesStorageClass&quot;: [<br>            &quot;ARCHIVE&quot;<br>          ]<br>        }<br>      }<br>    ]<br>  }<br>}</pre><p>Applying the above configuration, should reflect a lifecycle definition that looks like the one below in the GCS UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6x-pQPA8sEs7cdz1WRX-KA.png" /><figcaption>Example of combined lifecycle rules on GCS bucket UI</figcaption></figure><p>More elaborate set of rules are possible as well, such as converting between different storage classes based on the object age up to eventual deletion.</p><h3>Closing note</h3><p>This was a quick summary on how you can manage your airflow logs on Google Cloud Storage a bit more effectively instead of relying on default storage and retention set by Cloud Composer.</p><p>I mentioned storage costs around the article but didn’t really dive in depth on cost saving numbers. This will depend on the Airflow setup you have such as</p><ul><li>Number of DAGs,</li><li>Execution and logging frequency</li><li>The size of generated logs per DAG.</li></ul><p>I highly recommend running an estimation exercise to understand better your GCS costs and potential savings with lifecycle rules.</p><p>Hoping that you found this article useful, would love to hear any feedback / thoughts / questions on this article or topic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a80befe8eeab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/managing-airflow-logs-on-google-cloud-storage-with-object-lifecycle-management-a80befe8eeab">Managing Airflow Logs on Google Cloud Storage with Object Lifecycle Management</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysing Git repository activities with BigQuery SQL]]></title>
            <link>https://medium.com/google-cloud/analysing-a-git-repository-activities-with-bigquery-sql-e40a6d85d667?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e40a6d85d667</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Wed, 10 Aug 2022 06:59:56 GMT</pubDate>
            <atom:updated>2022-08-10T07:38:26.659Z</atom:updated>
            <content:encoded><![CDATA[<p>Reports generated from git platforms are great, but what if we need more flexibility towards creating git log reports? In this article we explore exporting logs from a git repository into BigQuery and apply some analysis queries with SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*To7q5y4jLryPnKXsL0J7yQ.png" /></figure><p>Consider a git repository with a history of activity and thousands of contributions over years. Given the logs, one eventually gets the need to apply in depth queries on it to understand some of the history, activity and contributions. In this article, we’ll follow a from-scratch approach and try to use what git and SQL would offer.</p><p>We’ll be taking <a href="https://github.com/GoogleCloudPlatform/professional-services">this repository as an example</a>. What’s interesting about it, is that it used as a mono repo consisting of several folders that represent separate projects. Part of the analysis will be related to understanding activity by folder and eventually identifying possible owners.</p><h3>Extract and load Git Logs</h3><p>The first part of our exercise, starts with extracting whatever information we find useful from git logs. The git log command provides a useful feature called <a href="https://git-scm.com/docs/pretty-formats#_pretty_formats">pretty formats</a>. It enables a lot of flexibility around what to display as commit metadata and how to format it. This is useful for preparing the log data for parsing and import later on.</p><p>On a locally cloned repository, you can run a command similar to the one below.</p><pre>git —-git-dir ../professional-services/.git log —-name-only --pretty=format:’commit: %H %nsubject: %s %nauthor: %aN %nemail: %aE %ndate: %at’</pre><p>This should return an output similar to the example below. For every commit, lines representing the hash, subject, author name, author email, date, and a list of files modified in that commit.</p><pre>commit: e551dd384acc13f6d9d186d678a8b158214c62e6<br>subject: fix typo and add addition config step (#844)<br>author: Someone<br>email: <a href="/service/mailto:7sanai@gmail.com">someone@somewhere.com</a><br>date: 1655821884<br>tools/pubsub2inbox/examples/scc-finding-config.yaml</pre><pre>commit: f96748b7b3b8f54b17e18e57c58934c57071f676<br>subject: Disclaimer for java version and copyright updates (#841)<br>author: abc-xyz<br>email: <a href="/service/mailto:78390589+anuradha-bajpai-google@users.noreply.github.com">78390589+abc-xyz@users.noreply.github.com</a><br>date: 1655797941<br>tools/quota-monitoring-alerting/README.md<br>tools/quota-monitoring-alerting/java/quota-notification/src/main/java/functions/SendNotification.java<br>tools/quota-monitoring-alerting/java/quota-notification/src/main/java/functions/eventpojos/PubSubMessage.java<br>tools/quota-monitoring-alerting/java/quota-notification/src/test/java/functions/SendNotificationTest.java<br>tools/quota-monitoring-alerting/java/quota-scan/pom.xml<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/ListProjects.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/ScanProjectQuotas.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/ScanProjectQuotasHelper.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/eventpojos/GCPProject.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/eventpojos/GCPResourceClient.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/eventpojos/ProjectQuota.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/eventpojos/PubSubMessage.java<br>tools/quota-monitoring-alerting/java/quota-scan/src/main/java/functions/eventpojos/TimeSeriesQuery.java<br>tools/quota-monitoring-alerting/java/terraform/example.tfvars<br>tools/quota-monitoring-alerting/java/terraform/main.tf<br>tools/quota-monitoring-alerting/java/terraform/terraform.tfvars<br>tools/quota-monitoring-alerting/java/terraform/variables.tf</pre><h4>Deciding on the log storage structure</h4><p>Parsing and transformation logic would depend on the structure that we’re looking to store the data in. The data resembles a “one-to-many” relationship, every commit has its unique details with a set of files associated with that commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*fOutWKbW8p2qd6d0W4xbww.png" /><figcaption>Our log data resembles a 1:n kind of relationship</figcaption></figure><p>With the above model, one could end up with repetition on files associated with multiple commits. In the context of a relational database we could even go further with more normalisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*iTzWAtQUzw24MLlGzovTyw.png" /><figcaption>Full denormalisation is an option, but not the best for BigQuery!</figcaption></figure><p>The reality of this use case though, is that we’re mostly going after running analytical read queries over a set of logs, rather than applying transactional CRUD operations.</p><p>For that, we could keep things much more flexible and simple by storing our logs in a fully denormalised table. This simplifies the parsing, log writing and eventually avoids additional joins in BigQuery SQL. The structure that I’ll go after would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*AlXcRagBcDEYequYHha_zw.png" /><figcaption>Denormalised yet effective for analytical work</figcaption></figure><p>The logs stored in a denormalised table in BQ would have a <strong>row per commit per file</strong>. That’s a lot of repetition between rows I know, but BigQuery’s engine is well optimised for data that is structured this way i.e. less tables, narrow in columns and tall in terms of rows.</p><h4>Extracting and loading into BigQuery</h4><p>Now that we’ve defined the target structure in BigQuery, we can proceed with writing a quick script for parsing these logs into a structure that can be easily loaded into a BigQuery table via the BQ CLI command. In this example, we’ll be transforming the git logs into rows represented as JSONL (line delimited JSON).</p><p>Below is a quick Python script that does exactly that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8848f10da78442ce147c0f5f516c6434/href">https://medium.com/media/8848f10da78442ce147c0f5f516c6434/href</a></iframe><p>Running the script via something like</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f5aec33733312515fc99ac97ebfc71d/href">https://medium.com/media/2f5aec33733312515fc99ac97ebfc71d/href</a></iframe><p>That should generate a <strong>jsonl</strong> file ready to be loaded into BigQuery. Structure would look similar to this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f765b6d508af6016972dc27e62c58443/href">https://medium.com/media/f765b6d508af6016972dc27e62c58443/href</a></iframe><p>From that point, loading into BigQuery should be trivial via the bq command, example</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4aba89bfd3bc31f638c4e0377b9e49d9/href">https://medium.com/media/4aba89bfd3bc31f638c4e0377b9e49d9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*iIb7CRrUzKPrAg9HMleOTg.png" /><figcaption>Resulting schema should look something like this</figcaption></figure><p>Now that we’ve got the data added into a BigQuery table, we can start running some analysis queries.</p><h3>Querying the data</h3><h4>Deriving sub-project type and names from paths</h4><p>Early on in this article, I mentioned that the repository example we’re working with treats folders and sub-folders following a naming convention as separate projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Neolw7wpfDgG8mb1eq0LuQ.png" /></figure><p>Under each category, we have a bunch of folders representing independent projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mp-uF85M-f8TC509N73VJg.png" /></figure><h4>An initial clean up query</h4><p>Given that we have the file path for every file associated with every commit, we could apply <strong>REGEXP_EXTRACT </strong>to derive a project name and type (based on the parent folder).</p><p>Within the repo, there are several irrelevant folders that made it into the extracted logs as well. We can filter those with NULL values from the results of REGEXP_EXTRACT that didn’t match the patterns we are after.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec61d23752621b7115bd0bbf6454c9d1/href">https://medium.com/media/ec61d23752621b7115bd0bbf6454c9d1/href</a></iframe><p>Results should look something similar to the below screenshot. If you’re planning to use this result frequently as a base, you might want to consider defining it as a separate <a href="https://cloud.google.com/bigquery/docs/materialized-views-intro"><strong>materialised view</strong></a>.</p><p>For convenience and illustration purposes I will re-use this query in subsequent queries via <strong>WITH</strong> rather than a materialised view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lozW2Z3wzUMkux20iTa2qw.png" /></figure><h4>Last update per sub-project</h4><p>What if we’re interested in identifying the last author date on each sub-folder (aka sub-project)? This should be straightforward with SQL, basing the query on top of the previous one via <strong>WITH</strong>. All we have to do is apply a <strong>GROUP_BY</strong> on the type and project name while getting the max value of the author_date.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d50f13337fdf2f24362d3adcaa3fba2/href">https://medium.com/media/8d50f13337fdf2f24362d3adcaa3fba2/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MC-KcNgSsMvEcK6lFZN6TA.png" /></figure><h4>Authors per sub-project</h4><p>Another useful query would be to identify all authors on every folder.</p><p>This would be a slight variation to the previous query. <strong>ARRAY_AGG</strong> is a cool aggregation function, allowing us to generate an ARRAY field of all authors per sub_repo via <strong>ARRAY_AGG(DISTINCT author_email)</strong>. Applying <strong>DISTINCT</strong> here is important since in the raw data we have a lot of repetition due to having a row per file per commit.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d913fcba53f953c88d2d29156479e00/href">https://medium.com/media/7d913fcba53f953c88d2d29156479e00/href</a></iframe><p>On the BigQuery UI, this should give a result similar to the one below (author emails blurred in for privacy in the screenshot).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxuHhus7fsNcCuvHeydwVg.png" /></figure><h4>Number of commits per author per sub-project</h4><p>In a similar fashion, we can identify the number of commits per sub-repo per user by simply grouping on those two values and applying a <strong>COUNT DISTINCT</strong> on the commit_hash value.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d85fc653fcefdbf1c3742c1056cd494/href">https://medium.com/media/8d85fc653fcefdbf1c3742c1056cd494/href</a></iframe><p>Output would look as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nm9CWfld421ziiOIRACA8A.png" /></figure><h4>Identifying top authors per sub-project</h4><p>Now let’s consider, getting a list of top authors per project in the same report. We can write a new query based on the previous one to simply aggregate author commits per project into a nice looking array of STRUCT values and sort it, via</p><pre>ARRAY_AGG(STRUCT(author_email,<br>      commits_in_folder)<br>  ORDER BY<br>    commits_in_folder DESC) AS authors</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0dfd21a732d7ada46cb40ca87eb107f/href">https://medium.com/media/c0dfd21a732d7ada46cb40ca87eb107f/href</a></iframe><p>And that should return, an array of struct for every sub repo as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrnnBELNyuTtRFOdIl5gbw.png" /></figure><h3>Wrap up</h3><p>So there you have it, a quick hack for flattening and exporting your git logs for analysis in BigQuery. The possibilities for querying this data are endless and there are probably important (solvable) angles to look at which we didn’t cover such as</p><ul><li>Continuously applying new logs into the BigQuery table</li><li>Dealing with directories / folders that don’t exist anymore but are included in the history</li><li>Plotting results on dashboards</li></ul><p>Those might be interesting topics to tackle in another follow-up article. In the meantime, would love to hear your feedback!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e40a6d85d667" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/analysing-a-git-repository-activities-with-bigquery-sql-e40a6d85d667">Analysing Git repository activities with BigQuery SQL</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A guide to auditing Cloud Dataflow jobs cost via BigQuery billing export]]></title>
            <link>https://medium.com/google-cloud/a-guide-to-auditing-cloud-dataflow-jobs-cost-via-bigquery-billing-export-502749813b8b?source=rss-3c051e65c0a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/502749813b8b</guid>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[google-cloud-dataflow]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[bigquery]]></category>
            <dc:creator><![CDATA[Ayman Farhat]]></dc:creator>
            <pubDate>Wed, 11 May 2022 22:00:52 GMT</pubDate>
            <atom:updated>2022-05-12T13:57:05.496Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Guide to Auditing Cloud Dataflow Job Cost via BigQuery Billing Export</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZYieF2lKDDtOAKOWsd2ZQ.png" /></figure><p>On Google Cloud Platform, the BigQuery <a href="https://cloud.google.com/billing/docs/how-to/export-data-bigquery">billing export service</a> can be a useful dataset for querying and auditing cost / billing on their GCP resources. In this write-up, we’ll be taking a look at the use case of Dataflow related jobs and how we can measure their cost using this dataset.</p><p>If you don’t yet have a billing export set in place, make sure that BigQuery billing export is activated on the project you’re looking into auditing. To do that, in the <a href="https://console.cloud.google.com/billing/">Google Cloud Console</a> go to Billing &gt; Billing export and activate the BigQuery billing export. <a href="https://cloud.google.com/billing/docs/how-to/export-data-bigquery">https://cloud.google.com/billing/docs/how-to/export-data-bigquery</a></p><h3>Billing export structure and services</h3><p>The <a href="https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#standard-usage-cost-data-schema">standard billing export schema</a> has a consistent set of top-level and STRUCT fields defined as follows:</p><pre>+-------------------------------+-----------+<br>|             Field             |   Type    |<br>+-------------------------------+-----------+<br>| billing_account_id            | String    |<br>| invoice.month                 | String    |<br>| cost_type                     | String    |<br>| service.id                    | String    |<br>| service.description           | String    |<br>| sku.id                        | String    |<br>| sku.description               | String    |<br>| usage_start_time              | Timestamp |<br>| usage_end_time                | Timestamp |<br>| project                       | Struct    |<br>| project.id                    | String    |<br>| project.number                | String    |<br>| project.name                  | String    |<br>| project.ancestry_numbers      | String    |<br>| project.labels.key            | String    |<br>| project.labels.value          | String    |<br>| labels.key                    | String    |<br>| labels.value                  | String    |<br>| system_labels.key             | String    |<br>| system_labels.value           | String    |<br>| location.location             | String    |<br>| location.country              | String    |<br>| location.region               | String    |<br>| location.zone                 | String    |<br>| cost                          | Float     |<br>| currency                      | String    |<br>| currency_conversion_rate      | Float     |<br>| usage.amount                  | Float     |<br>| usage.unit                    | String    |<br>| usage.amount_in_pricing_units | Float     |<br>| usage.pricing_unit            | String    |<br>| credits                       | Struct    |<br>| credits.id                    | String    |<br>| credits.full_name             | String    |<br>| credits.type                  | String    |<br>| credits.name                  | String    |<br>| credits.amount                | Float     |<br>| adjustment_info               | Struct    |<br>| adjustment_info.id            | string    |<br>| adjustment_info.description   | string    |<br>| adjustment_info.type          | String    |<br>| adjustment_info.mode          | String    |<br>| export_time                   | Timestamp |<br>+-------------------------------+-----------+</pre><p>To look at data associated with a specific service( e.g. Dataflow), it is important take a closer look at a couple of columns and their sub-fields:</p><ul><li><strong>service</strong> —Fields describing the ID and name of the service</li><li><strong>sku</strong> — Fields describing the resource types associated with the service such as compute, storage, memory etc…</li><li><strong>usage_start_time</strong> — The start time of the hourly usage window within which the given cost was calculated</li><li><strong>user_end_time</strong> — The end time of the hourly usage window within which the given cost was calculated</li><li><strong>labels</strong> — A set of key:value pairs that represent metadata related to the Google Cloud resource where the usage occurred. This would include default metadata usually set by the service and custom metadata set by users upon usage</li><li><strong>cost</strong> — The cost of the usage before any credits</li></ul><h3>Dataflow’s job cost structure</h3><h4>SKUs</h4><p>A typical dataflow job consumes different resources (SKU). For the same job, you can expect to find several rows, each representing consumption metrics for an SKU covering one of the following:</p><ul><li>Local Disk Time</li><li>RAM Time</li><li>Shuffle data processed</li><li>vCPU Time</li></ul><p>This structure provides flexibility when building cost analysis queries. You have the option of either getting the cost by one or more of the SKUs related to Dataflow jobs.</p><h4>Identifying jobs via labels</h4><p>For every row representing a Dataflow cost item, we find a set of labels identifying the details of the job associated with that cost.</p><p>Except for <strong>goog-dataflow-job-id, </strong>labels vary depending on the job and its type. <strong>goog-dataflow-job-id </strong>is the key to look for when identifying the Dataflow job ID of a cost item.</p><p>More generally, labels prepended by <strong>goog-dataflow-job-* </strong>are standard labels attached by the service. For example, template based jobs attach extra labels related to the Dataflow template used as seen in the below example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCCFhF-agZms479eJzY_qw.png" /><figcaption>An example set of labels for a Dataflow job in the BigQuery billing export</figcaption></figure><h4>Using custom labels with a dataflow jobs</h4><p>While standard labels can be useful for cost breakdowns, you could achieve greater detail in audits by attaching custom labels on jobs. Those labels are added into the cost table along with the other default labels in the <strong>labels </strong>field.</p><p>One way to add custom labels to a job is via the labels <strong>command line flag</strong> on job launch. Labels are passed as a JSON string, each key represents a label name with its corresponding value.</p><pre>java -cp ./my_pipeline \<br>        --runner=&quot;DataflowRunner&quot; \<br>        --project=&quot;my-project-id&quot; \<br>        --inputFile=&quot;gs://whatever/input.file&quot; \<br>        --region=&quot;europe-west2&quot; \<br>        <strong>--labels=&#39;{&quot;env&quot;: &quot;production&quot;, &quot;started_by&quot;:&quot;someuser&quot;, </strong>&quot;mode&quot;: &quot;production&quot;}&#39;</pre><p>It is also possible to define the labels <strong>in the pipeline’s code</strong> as part of the DataflowPipelineOptions. This might be a bit more “flexible” for some use cases, but keep in mind that this value is set before the pipeline is launched, after launch it can’t be modified.</p><pre>private DataflowPipelineOptions options = PipelineOptionsFactory.fromArgs(args).as(DataflowPipelineOptionsImpl.class); <br>options.setLabels(ImmutableMap.of(&quot;key&quot;, &quot;value&quot;));</pre><h4>Cost reporting on long running jobs (beyond 1 hour)</h4><p>For Dataflow jobs that run beyond 1 hour (e.g. streaming jobs), you might notice that the same SKU items are repeated for the same job id as in the example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f94a527ed4a193bd21320da342fa531/href">https://medium.com/media/1f94a527ed4a193bd21320da342fa531/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDS0SNjurwdMqyWXab5Uow.png" /><figcaption>Example SKUs for a streaming Job running several hours</figcaption></figure><p>This should be normal behaviour which could allow for for some flexibility around measuring the cost of a long running (1h+) job across a specific time period of the job’s lifetime.</p><h4>Batch vs Streaming job cost reporting</h4><p>By default, there isn’t a field that would provide a clear distinction for by job type (batch vs streaming). This is one use case where setting a custom label on jobs for identifying their type would make sense.</p><h3>Useful queries for Dataflow cost audits</h3><p>As you’ve seen so far, the billing export tables provide a lot of flexibility in terms of querying, let us dive into some useful ideas for queries that you might want to use.</p><h4>Total cost by location</h4><p>Reporting by location would be as straightforward as aggregating by the location.location columns and applying a sum function on the cost value.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a33b88126fe804b178914fc991804c07/href">https://medium.com/media/a33b88126fe804b178914fc991804c07/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*llEkxB-YFZN4UN2u4BPXDQ.png" /><figcaption>Result of cost per region</figcaption></figure><h4>Cost by template</h4><p>Deploying and running pipelines as templates is a standard practice in Dataflow. At many instances, templates can be representative of specific use cases. For such scenarios, aggregating cost by template name can be very useful for reporting.</p><p>As mentioned earlier, the dataflow template name is stored as a field in the labels column which is a REPEATED RECORD column. For that, we expand the labels column via UNNEST and a <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays#query_structs_in_an_array">cross join</a> against its values, giving access to every label key/value on every row.</p><p>We then filter out the rows by the key we’re looking for goog-dataflow-provided-template-name and group and apply a cost sum by the corresponding value column on that row representing the name of the Dataflow template.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2068730f93cf6723ca1217f091942436/href">https://medium.com/media/2068730f93cf6723ca1217f091942436/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*1O591MVqsAE1i9bNrwDe3Q.png" /><figcaption>Cost by template example result</figcaption></figure><h4>Cost by job per project</h4><p>Another useful and popular exercise would be to get a breakdown of cost per job per project along with any filters you might find useful such as filtering by specific location under which the jobs ran.</p><p>In the example below, we use the same strategy as in the previous example to extract the Dataflow job id from the labels, this time using goog-dataflow-job-id as the key for the struct field. In addition, we extract the id from the project column which is a non-repeated RECORD field (no unnest needed here).</p><p>Aggregation then happens on the level of both the extract job id and the project id values, along with applying a sum on the cost column.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39cb616f077480b4b5a85df54eeab46c/href">https://medium.com/media/39cb616f077480b4b5a85df54eeab46c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZo0nzWQAAW1hLVqcXpR2A.png" /><figcaption>Cost by project and job example result</figcaption></figure><h4>Cost by invoice month</h4><p>Finally, one more idea would be to explore Dataflow’s costs per invoice month and list out the top dataflow jobs that had the highest cost for that month.</p><p>In this case we can easily group by the invoice_month column while applying the SUM function on the cost.</p><p>To get a nice looking breakdown of jobs per invoice month as in the example screenshot below, we expand the labels field in an initial query to extract the dataflow job id, then in a second query we apply the aggregations mentioned above along with generating a REPEATED RECORD column integrating the results of a small sub-query to map and sort job_ids and their costs.</p><p>ARRAY_AGG(STRUCT(job_id, total_cost) ORDER BY total_cost DESC)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af4c9eb21addbf213dec950d0f7d9640/href">https://medium.com/media/af4c9eb21addbf213dec950d0f7d9640/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xu24bsUvSKgob722wLdN_g.png" /><figcaption>Cost by invoice month example result</figcaption></figure><h3>That’s all folks!</h3><p>The possibilities for queries around GCP’s BigQuery billing export tables can be endless, I hope you find the queries and explanations shared on Dataflow useful in your own billing export adventures. In the meantime, I’d love to hear your feedback and questions related to this topic. Happy querying! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=502749813b8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/a-guide-to-auditing-cloud-dataflow-jobs-cost-via-bigquery-billing-export-502749813b8b">A guide to auditing Cloud Dataflow jobs cost via BigQuery billing export</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>