Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Add new output plugin for sending OpenTelemetry metrics over gRPC. #232

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-core</artifactId>
</dependency>
<dependency>
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-api</artifactId>
</dependency>
<dependency>
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-module-kafka</artifactId>
Expand Down Expand Up @@ -66,6 +70,10 @@
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-module-opencensus</artifactId>
</dependency>
<dependency>
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-module-opentelemetry</artifactId>
</dependency>

<!-- logging -->
<dependency>
Expand Down
1 change: 1 addition & 0 deletions agent/src/main/java/com/spotify/ffwd/FastForwardAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static FastForwardAgent setup(final Optional<Path> configPath) {
modules.add(com.spotify.ffwd.http.HttpModule.class);
modules.add(com.spotify.ffwd.pubsub.PubsubOutputModule.class);
modules.add(com.spotify.ffwd.opencensus.OpenCensusOutputModule.class);
modules.add(com.spotify.ffwd.opentelemetry.OpenTelemetryOutputModule.class);

final AgentCore.Builder builder = AgentCore.builder()
.modules(modules)
Expand Down
17 changes: 16 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
Expand All @@ -31,7 +37,10 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.11.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>


Expand Down Expand Up @@ -68,6 +77,12 @@
<dependency>
<groupId>com.spotify.metrics</groupId>
<artifactId>semantic-metrics-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- testing -->
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/com/spotify/ffwd/Initializable.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ public interface Initializable {
/**
* Initialize a component, will be called synchronously after everything has been started.
*/
void init();
default void init() {
}
}
4 changes: 4 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<groupId>com.uchuhimo</groupId>
<artifactId>konf</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
Expand Down
6 changes: 5 additions & 1 deletion docs/_layouts/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
<a href="docs/protobuf">Protobuf</a>
</li>

<li {% if page.title == 'Pubsub' %}class="active"{% endif %}>
<li {% if page.title == 'Pubsub' %}class="active"{% endif %}>
<a href="docs/pubsub">Pubsub</a>
</li>

<li {% if page.title == 'OpenTelemetry' %}class="active"{% endif %}>
<a href="docs/opentelemetry">OpenTelemetry</a>
</li>
</ul>
</li>

Expand Down
23 changes: 23 additions & 0 deletions docs/content/_docs/opentelemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: OpenTelemetry
---

# FastForward OpenTelemetry

This module provies an output plugin for [OpenTelemetry metrics](https://github.com/open-telemetry/opentelemetry-proto/). It does not provide any tracing related functionality.

## Configuration

* `endpoint` - The gRPC endpoint to send metrics to.
* `headers` - An optional map of headers to include in the [MetricService export](https://github.com/open-telemetry/opentelemetry-proto/blob/v0.7.0/opentelemetry/proto/collector/metrics/v1/metrics_service.proto#L32) RPC.

Here is an example configuration using the OpenTelemetry plugin:

```
output:
plugins:
- type: opentelemetry
endpoint: ingestion.example.com:443
headers:
Authentication: Bearer Z29vZCBqb2IgZGVjb2RpbmcgdGhpcyBlYXN0ZXIgZWdn
```
121 changes: 67 additions & 54 deletions modules/opencensus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,60 +42,73 @@
</exclusions>
</dependency>

<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-api</artifactId>
<version>0.23.0</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-impl</artifactId>
<version>0.23.0</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-stats-stackdriver</artifactId>
<version>0.23.0</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-auth</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core-grpc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-api</artifactId>
<version>0.23.0</version>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-impl</artifactId>
<version>0.23.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opencensus</groupId>
<artifactId>opencensus-exporter-stats-stackdriver</artifactId>
<version>0.23.0</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-auth</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core-grpc</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

</dependencies>
</project>
95 changes: 95 additions & 0 deletions modules/opentelemetry/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-parent</artifactId>
<version>0.7.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>ffwd-module-opentelemetry</artifactId>
<version>0.7.4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>FastForward OpenTelemetry Module</name>

<properties>
<opentelemetry.version>0.14.1</opentelemetry.version>
</properties>

<dependencies>
<dependency>
<groupId>com.spotify.ffwd</groupId>
<artifactId>ffwd-api</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-proto</artifactId>
<version>${opentelemetry.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* -\-\-
* FastForward OpenTelemetry Module
* --
* Copyright (C) 2021 Spotify AB.
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -/-/-
*/

package com.spotify.ffwd.opentelemetry;

import com.google.inject.Inject;
import com.spotify.ffwd.module.FastForwardModule;
import com.spotify.ffwd.module.PluginContext;

public class OpenTelemetryOutputModule implements FastForwardModule {
@Inject
private PluginContext context;

@Override
public void setup() {
context.registerOutput("opentelemetry", OpenTelemetryOutputPlugin.class);
}
}
Loading