Skip to content

Commit

Permalink
feat: add OpenTelemetry feature into Gravitee Node
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumelamirand committed Oct 16, 2024
1 parent 3b37b30 commit 53eee18
Show file tree
Hide file tree
Showing 98 changed files with 4,257 additions and 597 deletions.
19 changes: 13 additions & 6 deletions gravitee-node-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-api</artifactId>
Expand All @@ -48,11 +48,6 @@
<artifactId>gravitee-reporter-api</artifactId>
</dependency>

<dependency>
<groupId>io.gravitee.tracing</groupId>
<artifactId>gravitee-tracing-api</artifactId>
</dependency>

<!-- RxJava 3 -->
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
Expand All @@ -63,5 +58,17 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<!-- Vertx -->
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
</dependency>

<!-- OpenTelemetry -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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 io.gravitee.node.api.opentelemetry;

import io.vertx.core.Context;

/**
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
public interface InstrumenterTracer {
String instrumentationName();

<R> boolean canHandle(final R request);

<R> Span startSpan(final Context vertxContext, final R request, final boolean root, final Span parentSpan);

<R> void endSpan(final Context vertxContext, final Span span, final R response, final Throwable throwable);
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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
* 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 io.gravitee.node.api.tracing;
package io.gravitee.node.api.opentelemetry;

import io.gravitee.common.component.LifecycleComponent;
import io.gravitee.tracing.api.Span;
import io.opentelemetry.api.OpenTelemetry;

/**
* @author David BRASSELY (david.brassely at graviteesource.com)
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
public interface Tracer extends LifecycleComponent<Tracer> {
Span trace(String spanName);
public interface InstrumenterTracerFactory {
InstrumenterTracer createInstrumenterTracer(final OpenTelemetry openTelemetry);
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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
* 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 io.gravitee.node.tracing.plugin;

import io.gravitee.plugin.core.api.Plugin;
package io.gravitee.node.api.opentelemetry;

/**
* @author David BRASSELY (david.brassely at graviteesource.com)
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
public interface TracerPlugin extends Plugin {
String PLUGIN_TYPE = "tracer";
public interface Span {
boolean isRoot();

<T> Span withAttribute(final String name, final T value);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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 io.gravitee.node.api.opentelemetry;

import io.gravitee.common.service.Service;
import io.vertx.core.Context;

/**
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
public interface Tracer extends Service<Tracer> {
<R> Span startRootSpanFrom(final Context vertxContext, final R request);

<R> Span startSpanFrom(final Context vertxContext, final R request);

<R> Span startSpanWithParentFrom(Context vertxContext, Span parentSpan, R request);

void end(final Context vertxContext, final Span span);

void endOnError(final Context vertxContext, final Span span, final Throwable throwable);

void endOnError(final Context vertxContext, final Span span, final String message);

<R> void endWithResponse(final Context vertxContext, final Span span, final R response);

<R> void endWithResponseAndError(final Context vertxContext, final Span span, final R response, final Throwable throwable);

<R> void endWithResponseAndError(final Context vertxContext, final Span span, final R response, final String message);
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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
* 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 io.gravitee.node.tracing.vertx;

import io.gravitee.node.api.tracing.Tracer;
package io.gravitee.node.api.opentelemetry;

/**
* @author David BRASSELY (david.brassely at graviteesource.com)
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
public interface VertxTracer<I, O> extends Tracer, io.vertx.core.spi.tracing.VertxTracer<I, O> {}
public interface TracerFactory {
Tracer createTracer(final String id, final String serviceName, final String serviceNamespace, final String version);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License.
*/

package io.gravitee.node.api.opentelemetry.internal;

import java.util.Map;
import lombok.Builder;

/**
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com)
* @author GraviteeSource Team
*/
@Builder
public record InternalRequest(String name, Map<String, String> attributes) {}
2 changes: 1 addition & 1 deletion gravitee-node-cache/gravitee-node-cache-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cache</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cache</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache-plugin-handler</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cache</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache-plugin-hazelcast</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cache</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache-plugin-redis</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cache</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache-plugin-standalone</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cache</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-certificates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-certificates</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cluster</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cluster-plugin-handler</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cluster</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cluster-plugin-hazelcast</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-cluster</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cluster-plugin-standalone</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-cluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-cluster</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-container</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-jetty</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-kubernetes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-kubernetes</artifactId>
Expand Down
6 changes: 5 additions & 1 deletion gravitee-node-license/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-license</artifactId>
Expand All @@ -44,6 +44,10 @@
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node-management</artifactId>
</dependency>
<dependency>
<groupId>io.gravitee.plugin</groupId>
<artifactId>gravitee-plugin-core</artifactId>
</dependency>

<!-- Licensing -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-node-management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.node</groupId>
<artifactId>gravitee-node</artifactId>
<version>6.4.6</version>
<version>6.5.0-archi-401-opentelemetry-SNAPSHOT</version>
</parent>

<artifactId>gravitee-node-management</artifactId>
Expand Down
Loading

0 comments on commit 53eee18

Please sign in to comment.