Skip to content

Commit

Permalink
Set up initial metrics reporter. (airbytehq#10408)
Browse files Browse the repository at this point in the history
Part 1 of https://docs.google.com/document/d/11pEUsHyKUhh4CtV3aReau3SUG-ncEvy6ROJRVln6YB4/edit?usp=sharing.

This is the initial set up of the reporter. Will add actual metrics in the follow up PR.

Since the reporter is primarily for Cloud use and limited to DD to begin with, we are keeping it outside the regular Airbyte docker and Kube deploys for now.

Add ReadMes to better define various modules.
  • Loading branch information
davinchia authored Feb 18, 2022
1 parent ef673c5 commit f927dc5
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ serialize =

[bumpversion:file:airbyte-bootloader/Dockerfile]

[bumpversion:file:airbyte-scheduler/app/Dockerfile]
[bumpversion:file:airbyte-container-orchestrator/Dockerfile]

[bumpversion:file:airbyte-server/Dockerfile]
[bumpversion:file:airbyte-metrics/reporter/Dockerfile]

[bumpversion:file:airbyte-workers/Dockerfile]
[bumpversion:file:airbyte-scheduler/app/Dockerfile]

[bumpversion:file:airbyte-container-orchestrator/Dockerfile]
[bumpversion:file:airbyte-server/Dockerfile]

[bumpversion:file:airbyte-webapp/package.json]

[bumpversion:file:airbyte-webapp/package-lock.json]

[bumpversion:file:airbyte-workers/Dockerfile]

[bumpversion:file:charts/airbyte/Chart.yaml]

[bumpversion:file:charts/airbyte/values.yaml]
Expand Down
3 changes: 3 additions & 0 deletions airbyte-metrics/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Airbyte Metrics Lib

This module contains helpers for emitting metrics. This is primarily intended to be consumed by Airbyte Cloud, though OSS users are certainly welcome to make sure of this.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2021 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.metrics;
package io.airbyte.metrics.lib;

import com.timgroup.statsd.NonBlockingStatsDClientBuilder;
import com.timgroup.statsd.StatsDClient;
Expand Down
11 changes: 11 additions & 0 deletions airbyte-metrics/reporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS scheduler

ENV APPLICATION airbyte-metrics-reporter

WORKDIR /app

ADD bin/${APPLICATION}-0.35.30-alpha.tar /app

# wait for upstream dependencies to become available before starting server
ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-0.35.30-alpha/bin/${APPLICATION}"]
5 changes: 5 additions & 0 deletions airbyte-metrics/reporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Airbyte Metrics Reporter

The Reporter attempts to keep code clean by centralising metric calculation and submissions.

This is primarily intended for Airbyte Cloud, though OSS users are certainly welcome to make use of this.
27 changes: 27 additions & 0 deletions airbyte-metrics/reporter/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
plugins {
id 'application'
}

dependencies {
implementation project(':airbyte-metrics:lib')
}

application {
applicationName = "airbyte-metrics-reporter"
mainClass = 'io.airbyte.metrics.reporter.ReporterApp'
applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0']
}

task copyGeneratedTar(type: Copy) {
dependsOn copyDocker
dependsOn distTar

from('build/distributions') {
include 'airbyte-metrics-reporter-*.tar'
}
into 'build/docker/bin'
}

Task dockerBuildTask = getDockerBuildTask("reporter", "$project.projectDir")
dockerBuildTask.dependsOn(copyGeneratedTar)
assemble.dependsOn(dockerBuildTask)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2021 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.metrics.reporter;

import io.airbyte.metrics.lib.DogstatsdMetricSingleton;

public class ReporterApp {

public static void main(final String[] args) {
DogstatsdMetricSingleton.initialize("airbyte-metrics-reporter", false);
}

}
2 changes: 1 addition & 1 deletion airbyte-scheduler/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
implementation project(':airbyte-config:persistence')
implementation project(':airbyte-db:lib')
implementation project(':airbyte-json-validation')
implementation project(':airbyte-metrics')
implementation project(':airbyte-metrics:lib')
implementation project(':airbyte-protocol:models')
implementation project(':airbyte-scheduler:models')
implementation project(':airbyte-scheduler:persistence')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.airbyte.db.Database;
import io.airbyte.db.instance.configs.ConfigsDatabaseInstance;
import io.airbyte.db.instance.jobs.JobsDatabaseInstance;
import io.airbyte.metrics.DogstatsdMetricSingleton;
import io.airbyte.metrics.lib.DogstatsdMetricSingleton;
import io.airbyte.scheduler.models.Job;
import io.airbyte.scheduler.models.JobStatus;
import io.airbyte.scheduler.persistence.DefaultJobPersistence;
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ include ':airbyte-commons-docker'
include ':airbyte-config:models' // reused by acceptance tests in connector base.
include ':airbyte-db:lib' // reused by acceptance tests in connector base.
include ':airbyte-json-validation'
include ':airbyte-metrics'
include ':airbyte-metrics:lib'
include ':airbyte-metrics:reporter'
include ':airbyte-oauth'
include ':airbyte-protocol:models'
include ':airbyte-queue'
Expand Down

0 comments on commit f927dc5

Please sign in to comment.