Skip to content

Commit 7347dae

Browse files
committed
Component provider implemented
1 parent 9987d02 commit 7347dae

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright Splunk Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.splunk.opentelemetry.profiler.snapshot;
18+
19+
import com.google.auto.service.AutoService;
20+
import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties;
21+
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
22+
import io.opentelemetry.sdk.trace.SpanProcessor;
23+
24+
@SuppressWarnings("rawtypes")
25+
@AutoService(ComponentProvider.class)
26+
public class SnapshotProfilingSpanProcessorComponentProvider
27+
implements ComponentProvider<SpanProcessor> {
28+
private final TraceRegistry traceRegistry;
29+
30+
public SnapshotProfilingSpanProcessorComponentProvider() {
31+
this(TraceRegistryHolder.getTraceRegistry());
32+
}
33+
34+
SnapshotProfilingSpanProcessorComponentProvider(TraceRegistry traceRegistry) {
35+
this.traceRegistry = traceRegistry;
36+
}
37+
38+
@Override
39+
public Class<SpanProcessor> getType() {
40+
return SpanProcessor.class;
41+
}
42+
43+
@Override
44+
public String getName() {
45+
return "splunk_snapshot_profiling";
46+
}
47+
48+
@Override
49+
public SnapshotProfilingSpanProcessor create(
50+
DeclarativeConfigProperties declarativeConfigProperties) {
51+
return new SnapshotProfilingSpanProcessor(traceRegistry);
52+
}
53+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright Splunk Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.splunk.opentelemetry.profiler.snapshot;
18+
19+
class TraceRegistryHolder {
20+
private static final TraceRegistry registry = new TraceRegistry();
21+
22+
private TraceRegistryHolder() {}
23+
24+
public static TraceRegistry getTraceRegistry() {
25+
return registry;
26+
}
27+
}

0 commit comments

Comments
 (0)