Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0209c77
initial commit of logging support extension
zenmoto Aug 10, 2020
5d12042
complete move from extensions to sdk_extensions
zenmoto Aug 10, 2020
4e3495b
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Aug 17, 2020
3200d17
address code review comments
zenmoto Aug 24, 2020
e4365df
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Aug 24, 2020
52433b0
move logging_support to logging/support
zenmoto Aug 24, 2020
3e6be4d
missed test update in last commit
zenmoto Aug 24, 2020
aa54585
code format
zenmoto Aug 24, 2020
8573b4f
change list to queue in implementation, collection in api
zenmoto Aug 25, 2020
44a238d
missed making a utility method static
zenmoto Aug 26, 2020
9f2ed0a
fix a broken test
zenmoto Aug 26, 2020
fa90ba0
Update sdk_extensions/logging/support/src/main/java/io/opentelemetry/…
zenmoto Aug 27, 2020
b9b14ae
reworked to align with how we batch process spans
zenmoto Sep 10, 2020
2d7ff2f
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Sep 10, 2020
cb607c5
move of CompletableResultCode and formatting
zenmoto Sep 10, 2020
76a73bc
update AnyValue to use long instead of int
zenmoto Sep 10, 2020
d8696e9
address code review comments
zenmoto Sep 10, 2020
64b30ef
implement BatchLogProcessor.fromConfigMap
zenmoto Sep 11, 2020
c44c10c
rearrange packages
zenmoto Sep 11, 2020
e77b91a
add readme
zenmoto Sep 16, 2020
3d652fc
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Sep 16, 2020
058d632
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Sep 17, 2020
7b238b4
respond to review feedback, refactored BatchLogProcessor
zenmoto Sep 17, 2020
d8a6d5f
added a couple tests
zenmoto Sep 17, 2020
a715564
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Sep 23, 2020
adf4a30
update to use new Attributes, remove support directory, public LogRec…
zenmoto Sep 23, 2020
5353889
Merge branch 'master' of github.com:open-telemetry/opentelemetry-java…
zenmoto Sep 29, 2020
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
6 changes: 6 additions & 0 deletions sdk_extensions/logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# OpenTelemetry Experimental Logging Support

This project contains experimental support for transport of logs via OpenTelemetry. The API
presented is intended for the use of logging library adapters to enable resource and request
correlation with other observability signals and transport of logs through the OpenTelemetry
collector.
20 changes: 20 additions & 0 deletions sdk_extensions/logging/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id "java"
id "maven-publish"

id "ru.vyarus.animalsniffer"
}

description = 'OpenTelemetry Contrib Logging Support'
ext.moduleName = "io.opentelemetry.sdk.extensions.logging"

dependencies {
api project(':opentelemetry-sdk')
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.4'
testImplementation libraries.awaitility

annotationProcessor libraries.auto_value

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-24:7.0_r2@signature"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2020, OpenTelemetry Authors
*
* 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.opentelemetry.sdk.logging;

import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.logging.data.LogRecord;
import io.opentelemetry.sdk.trace.TracerSdkProvider;

public interface LogProcessor {

void addLogRecord(LogRecord record);

/**
* Called when {@link TracerSdkProvider#shutdown()} is called.
*
* @return result
*/
CompletableResultCode shutdown();

/**
* Processes all span events that have not yet been processed.
*
* @return result
*/
CompletableResultCode forceFlush();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2020, OpenTelemetry Authors
*
* 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.opentelemetry.sdk.logging;

import io.opentelemetry.sdk.logging.data.LogRecord;

/** A LogSink accepts logging records for transmission to an aggregator or log processing system. */
public interface LogSink {
/**
* Pass a record to the SDK for transmission to a logging exporter.
*
* @param record record to transmit
*/
void offer(LogRecord record);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright 2020, OpenTelemetry Authors
*
* 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.opentelemetry.sdk.logging;

import io.opentelemetry.internal.Utils;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.logging.data.LogRecord;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class LogSinkSdkProvider {
private final LogSink logSink = new SdkLogSink();
private final List<LogProcessor> processors = new ArrayList<>();

private LogSinkSdkProvider() {}

public LogSink get(String instrumentationName, String instrumentationVersion) {
// Currently there is no differentiation by instrumentation library
return logSink;
}

public void addLogProcessor(LogProcessor processor) {
processors.add(Utils.checkNotNull(processor, "Processor can not be null"));
}

/**
* Flushes all attached processors.
*
* @return result
*/
public CompletableResultCode forceFlush() {
final List<CompletableResultCode> processorResults = new ArrayList<>(processors.size());
for (LogProcessor processor : processors) {
processorResults.add(processor.forceFlush());
}
return CompletableResultCode.ofAll(processorResults);
}

/**
* Shut down of provider and associated processors.
*
* @return result
*/
public CompletableResultCode shutdown() {
Collection<CompletableResultCode> processorResults = new ArrayList<>(processors.size());
for (LogProcessor processor : processors) {
processorResults.add(processor.shutdown());
}
return CompletableResultCode.ofAll(processorResults);
}

private class SdkLogSink implements LogSink {
@Override
public void offer(LogRecord record) {
for (LogProcessor processor : processors) {
processor.addLogRecord(record);
}
}
}

public static class Builder {
public LogSinkSdkProvider build() {
return new LogSinkSdkProvider();
}
}
}
Loading