-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add OpenTelemetry feature into Gravitee Node
- Loading branch information
1 parent
3b37b30
commit 53eee18
Showing
98 changed files
with
4,257 additions
and
597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
gravitee-node-api/src/main/java/io/gravitee/node/api/opentelemetry/InstrumenterTracer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
17 changes: 8 additions & 9 deletions
17
.../io/gravitee/node/api/tracing/Tracer.java → ...ntelemetry/InstrumenterTracerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
18 changes: 9 additions & 9 deletions
18
...tee/node/tracing/plugin/TracerPlugin.java → ...gravitee/node/api/opentelemetry/Span.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
43 changes: 43 additions & 0 deletions
43
gravitee-node-api/src/main/java/io/gravitee/node/api/opentelemetry/Tracer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
16 changes: 8 additions & 8 deletions
16
...vitee/node/tracing/vertx/VertxTracer.java → ...node/api/opentelemetry/TracerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
15 changes: 15 additions & 0 deletions
15
...e-node-api/src/main/java/io/gravitee/node/api/opentelemetry/internal/InternalRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (C) 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.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) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.