Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Aug 9, 2022
1 parent b219200 commit a5530dd
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 202 deletions.
31 changes: 17 additions & 14 deletions google-cloud-bigtable-stats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<description>Experimental project to shade OpenCensus dependencies.</description>

<properties>
<opencensus.version>0.31.1</opencensus.version>
<cloud.monitoring.version>3.3.6</cloud.monitoring.version>
</properties>

Expand All @@ -30,20 +29,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-metrics-util</artifactId>
<version>${opencensus.version}</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-monitoring</artifactId>
<version>${cloud.monitoring.version}</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-monitoring-v3</artifactId>
<artifactId>google-cloud-monitoring-bom</artifactId>
<version>${cloud.monitoring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Expand All @@ -56,7 +47,7 @@
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-metrics-util</artifactId>
<artifactId>opencensus-exporter-stats-stackdriver</artifactId>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
Expand All @@ -68,6 +59,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-monitoring</artifactId>
<!-- Excluding http dependencies since they're not used and are causing conflict in google-cloud-bigtable -->
<exclusions>
<exclusion>
<groupId>com.google.http-client</groupId>
Expand Down Expand Up @@ -192,6 +184,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<!-- Ignore opencensus-exporter-metrics-util and opencensus-exporter-stats-stackdriver from -->
<!-- dependency analyze. opencensus-exporter-metrics-util is a transitive dependency from -->
<!-- opencensus-exporter-stats-stackdriver but it's not defined in java-shared-dependencies. -->
<!-- To make the opencensus version consistent, only include opencensus-exporter-stats-stackdriver -->
<!-- until opencensus-exporter-metrics-util is added to java-shared-dependencies. -->
<configuration>
<ignoredDependencies>
<ignoredDependency>io.opencensus:opencensus-exporter-metrics-util:*</ignoredDependency>
<ignoredDependency>io.opencensus:opencensus-exporter-stats-stackdriver:*</ignoredDependency>
</ignoredDependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand All @@ -218,7 +221,7 @@
<!-- gax-grpc transitvely brings in opencensus-proto, which the latest version is 0.2.0-->
<!-- Only allow 0.2.0 for opencensus-proto and then the latest version (currently 0.31.1) for all other modules-->
<!-- this will need to be updated whenever the opencensus version gets updated -->
<dependency>io.opencensus:*:[${opencensus.version}]</dependency>
<dependency>io.opencensus:*:[0.31.1]</dependency>
<dependency>io.opencensus:opencensus-proto:[0.2.0]</dependency>
</includes>
</bannedDependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import com.google.cloud.monitoring.v3.MetricServiceClient;
import com.google.monitoring.v3.CreateTimeSeriesRequest;
import com.google.monitoring.v3.ProjectName;
import com.google.monitoring.v3.TimeSeries;
import io.opencensus.exporter.metrics.util.MetricExporter;
import io.opencensus.metrics.export.Metric;
import io.opencensus.metrics.export.TimeSeries;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand All @@ -48,23 +48,18 @@ final class BigtableCreateTimeSeriesExporter extends MetricExporter {
}

public void export(Collection<Metric> metrics) {
List<TimeSeries> timeSeriesList = new ArrayList(metrics.size());
List<com.google.monitoring.v3.TimeSeries> timeSeriesList = new ArrayList(metrics.size());

for (Metric metric : metrics) {
// only export bigtable metrics
if (!metric.getMetricDescriptor().getName().contains("bigtable")) {
continue;
}

for (io.opencensus.metrics.export.TimeSeries timeSeries : metric.getTimeSeriesList()) {
for (TimeSeries timeSeries : metric.getTimeSeriesList()) {
timeSeriesList.add(
BigtableStackdriverExportUtils.convertTimeSeries(
metric.getMetricDescriptor().getName(),
metric.getMetricDescriptor().getType(),
metric.getMetricDescriptor().getLabelKeys(),
timeSeries,
clientId,
monitoredResource));
metric.getMetricDescriptor(), timeSeries, clientId, monitoredResource));
}
}

Expand Down
Loading

0 comments on commit a5530dd

Please sign in to comment.