forked from trinodb/trino
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
259 additions
and
43 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
core/trino-main/src/main/java/io/trino/eventlistener/EventListenerContextInstance.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,53 @@ | ||
/* | ||
* 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.trino.eventlistener; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.trace.Tracer; | ||
import io.trino.spi.eventlistener.EventListenerFactory; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class EventListenerContextInstance | ||
implements EventListenerFactory.EventListenerContext | ||
{ | ||
private final OpenTelemetry openTelemetry; | ||
private final Tracer tracer; | ||
private final String version; | ||
|
||
public EventListenerContextInstance(String version, OpenTelemetry openTelemetry, Tracer tracer) | ||
{ | ||
this.version = requireNonNull(version, "version is null"); | ||
this.openTelemetry = requireNonNull(openTelemetry, "openTelemetry is null"); | ||
this.tracer = requireNonNull(tracer, "tracer is null"); | ||
} | ||
|
||
@Override | ||
public String getVersion() | ||
{ | ||
return version; | ||
} | ||
|
||
@Override | ||
public OpenTelemetry getOpenTelemetry() | ||
{ | ||
return openTelemetry; | ||
} | ||
|
||
@Override | ||
public Tracer getTracer() | ||
{ | ||
return tracer; | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
core/trino-main/src/main/java/io/trino/testing/TestingEventListenerContext.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,41 @@ | ||
/* | ||
* 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.trino.testing; | ||
|
||
import io.airlift.tracing.Tracing; | ||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.trace.Tracer; | ||
import io.trino.spi.eventlistener.EventListenerFactory; | ||
|
||
public class TestingEventListenerContext | ||
implements EventListenerFactory.EventListenerContext | ||
{ | ||
@Override | ||
public String getVersion() | ||
{ | ||
return "test-version"; | ||
} | ||
|
||
@Override | ||
public OpenTelemetry getOpenTelemetry() | ||
{ | ||
return OpenTelemetry.noop(); | ||
} | ||
|
||
@Override | ||
public Tracer getTracer() | ||
{ | ||
return Tracing.noopTracer(); | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
...-toolkit/src/test/java/io/trino/plugin/base/evenlistener/TestingEventListenerContext.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,54 @@ | ||
/* | ||
* 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.trino.plugin.base.evenlistener; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.api.trace.Tracer; | ||
import io.trino.spi.eventlistener.EventListenerFactory; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class TestingEventListenerContext | ||
implements EventListenerFactory.EventListenerContext | ||
{ | ||
private final String trinoVersion; | ||
|
||
public TestingEventListenerContext() | ||
{ | ||
this("trino-version"); | ||
} | ||
|
||
public TestingEventListenerContext(String version) | ||
{ | ||
this.trinoVersion = requireNonNull(version, "version is null"); | ||
} | ||
|
||
@Override | ||
public String getVersion() | ||
{ | ||
return this.trinoVersion; | ||
} | ||
|
||
@Override | ||
public OpenTelemetry getOpenTelemetry() | ||
{ | ||
return OpenTelemetry.noop(); | ||
} | ||
|
||
@Override | ||
public Tracer getTracer() | ||
{ | ||
return OpenTelemetry.noop().getTracer("TEST_TRACER"); | ||
} | ||
} |
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.