Skip to content

Commit fc79f1b

Browse files
Fully replace OpenCensus metrics with OpenTelemetry - Core (#1849)
* remove influx-exporter * update THIRD-PARTY-LICENSES.txt * refactor metrics model * introduce OpenTelemetry instruments and replace tags with attributes (wip) * update THIRD-PARTY-LICENSES.txt * refactor context propagation (wip) * update THIRD-PARTY-LICENSES.txt * update default basic config * update THIRD-PARTY-LICENSES.txt * update self monitoring and metric recorders * update THIRD-PARTY-LICENSES.txt * update default instrumentation * fix metric views initialization * update THIRD-PARTY-LICENSES.txt * update jmh tests * check common attributes settings for views * refactor context propagation * fix metrics and views deletion * refactor context propagation * update THIRD-PARTY-LICENSES.txt * add OpenTelemetryConfiguredEvent * refactor common attributes * update THIRD-PARTY-LICENSES.txt * add default views * update THIRD-PARTY-LICENSES.txt * make tests compile * update THIRD-PARTY-LICENSES.txt * fix jmh test * fix attributes tests * fix exporter tests * fix instrumentation tests * update THIRD-PARTY-LICENSES.txt * fix configdocsgenerator tests * remove debug code * fix configurationserver test * update THIRD-PARTY-LICENSES.txt * fix metrics tests * update THIRD-PARTY-LICENSES.txt * fix common attributes test * update THIRD-PARTY-LICENSES.txt * add metrics tests * update THIRD-PARTY-LICENSES.txt * update timewindow test * update THIRD-PARTY-LICENSES.txt * remove unsupported character * update THIRD-PARTY-LICENSES.txt * remove unused import * update THIRD-PARTY-LICENSES.txt * update OpenTelemetryControllerImplIntTest * update THIRD-PARTY-LICENSES.txt * update comments * update THIRD-PARTY-LICENSES.txt --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 9f7e757 commit fc79f1b

File tree

176 files changed

+6959
-7176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+6959
-7176
lines changed

THIRD-PARTY-LICENSES.txt

Lines changed: 163 additions & 309 deletions
Large diffs are not rendered by default.

components/inspectit-ocelot-configdocsgenerator/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ dependencies {
3030

3131
configServerLibs.comGoogleGuava,
3232
libs.ioOpentelemetryOpentelemetryApi,
33+
libs.ioOpentelemetryOpentelemetrySdkMetrics,
3334
libs.orgAssertjAssertjCore,
3435
)
3536
}

components/inspectit-ocelot-configdocsgenerator/src/test/java/inspectit/ocelot/configdocsgenerator/ConfigDocsGeneratorTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private String getYaml(String fileName) throws IOException {
5555
* correctly scopeDoc.
5656
*/
5757
@BeforeAll
58-
private static void createDocObjects() {
58+
static void createDocObjects() {
5959

6060
// Create a sample ActionDoc object where there was documentation values in the YAML, i.e. content behind the
6161
// doc-key
@@ -116,12 +116,12 @@ private static void createDocObjects() {
116116

117117
// Create a sample MetricDoc object
118118
metricDoc = Mockito.mock(MetricDocs.class);
119-
when(metricDoc.getName()).thenReturn("disk/free");
119+
when(metricDoc.getName()).thenReturn("disk_free");
120120
when(metricDoc.getDescription()).thenReturn("free disk space");
121121
when(metricDoc.getSince()).thenReturn(null);
122122
when(metricDoc.getUnit()).thenReturn("bytes");
123123

124-
// Create a sample RuleDoc object to include inside of the other RuleDoc object
124+
// Create a sample RuleDoc object to include inside the other RuleDoc object
125125
// Create the actionCallsMap for the RuleDoc object
126126
Map<String, Map<String, ActionCallDocs>> actionCallsMapParent = RuleDocsTest.getEmptyActionCallsMap();
127127
Map<String, ActionCallDocs> actionCallsParent = new HashMap<>();
@@ -162,7 +162,7 @@ private static void createDocObjects() {
162162
constantTags.put("error", "servicegraph_is_error");
163163

164164
RuleMetricsDocs ruleMetricsDocsMock = Mockito.mock(RuleMetricsDocs.class);
165-
when(ruleMetricsDocsMock.getName()).thenReturn("service/in/responsetime");
165+
when(ruleMetricsDocsMock.getName()).thenReturn("service_in_responsetime");
166166
when(ruleMetricsDocsMock.getValue()).thenReturn("servicegraph_duration");
167167
when(ruleMetricsDocsMock.getDataTags()).thenReturn(dataTags);
168168
when(ruleMetricsDocsMock.getConstantTags()).thenReturn(constantTags);

components/inspectit-ocelot-configdocsgenerator/src/test/java/inspectit/ocelot/configdocsgenerator/parsing/ConfigParserTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package inspectit.ocelot.configdocsgenerator.parsing;
22

33
import com.google.common.io.Resources;
4+
import io.opentelemetry.sdk.metrics.InstrumentType;
5+
import io.opentelemetry.sdk.metrics.InstrumentValueType;
46
import org.junit.jupiter.api.Nested;
57
import org.junit.jupiter.api.Test;
68
import org.junit.jupiter.api.extension.ExtendWith;
79
import org.mockito.Mockito;
810
import org.mockito.junit.jupiter.MockitoExtension;
911
import rocks.inspectit.ocelot.config.model.InspectitConfig;
10-
import rocks.inspectit.ocelot.config.model.exporters.ExporterEnabledState;
1112
import rocks.inspectit.ocelot.config.model.instrumentation.actions.GenericActionSettings;
1213
import rocks.inspectit.ocelot.config.model.instrumentation.documentation.ActionDocumentation;
1314
import rocks.inspectit.ocelot.config.model.metrics.StandardPollingMetricsRecorderSettings;
@@ -53,13 +54,14 @@ void withPlaceholder() throws IOException {
5354

5455
MetricDefinitionSettings metricDefinitionMock = Mockito.mock(MetricDefinitionSettings.class);
5556
when(metricDefinitionMock.isEnabled()).thenReturn(true);
56-
when(metricDefinitionMock.getType()).thenReturn(MetricDefinitionSettings.MeasureType.LONG);
57+
when(metricDefinitionMock.getValueType()).thenReturn(InstrumentValueType.LONG);
58+
when(metricDefinitionMock.getInstrumentType()).thenReturn(InstrumentType.GAUGE);
5759
when(metricDefinitionMock.getUnit()).thenReturn("bytes");
58-
when(metricDefinitionMock.getMaxValuesPerTag()).thenReturn(5);
60+
when(metricDefinitionMock.getMaxValuesPerAttribute()).thenReturn(5);
5961
when(metricDefinitionMock.getDescription()).thenReturn("free disk space");
6062
when(metricDefinitionMock.getViews()).thenReturn(null);
6163

62-
assertThat(result.getMetrics().getDefinitions().get("disk/free")).usingRecursiveComparison()
64+
assertThat(result.getMetrics().getDefinitions().get("disk_free")).usingRecursiveComparison()
6365
.isEqualTo(metricDefinitionMock);
6466
// Build the expected result by hand
6567
Map<String, Boolean> enabledMap = new HashMap<>();

components/inspectit-ocelot-configdocsgenerator/src/test/resources/ConfigDocGeneratorTest/all.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ inspectit:
7676
db.url: jdbc_url
7777
error-status: _thrown
7878
metrics:
79-
'[service/in/responsetime]':
79+
service_in_responsetime:
8080
value: servicegraph_duration
8181
data-tags:
8282
origin_service: servicegraph_origin_service_local
@@ -90,8 +90,7 @@ inspectit:
9090
# if true, the free disk space will be measured and the view "disk/free" is registered
9191
free: true
9292
definitions:
93-
'[disk/free]':
93+
disk_free:
9494
enabled: ${inspectit.metrics.disk.enabled.free}
95-
type: LONG
9695
unit: bytes
9796
description: free disk space

components/inspectit-ocelot-configdocsgenerator/src/test/resources/ConfigDocGeneratorTest/metric.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ inspectit:
55
# if true, the free disk space will be measured and the view "disk/free" is registered
66
free: true
77
definitions:
8-
'[disk/free]':
8+
disk_free:
99
enabled: ${inspectit.metrics.disk.enabled.free}
10-
type: LONG
1110
unit: bytes
12-
description: free disk space
11+
description: free disk space

components/inspectit-ocelot-configdocsgenerator/src/test/resources/ConfigDocGeneratorTest/rules.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ inspectit:
3535
db.url: jdbc_url
3636
error-status: _thrown
3737
metrics:
38-
'[service/in/responsetime]':
38+
service_in_responsetime:
3939
value: servicegraph_duration
4040
data-tags:
4141
origin_service: servicegraph_origin_service_local
4242
origin_external: servicegraph_origin_external
4343
constant-tags:
4444
protocol: servicegraph_protocol
45-
error: servicegraph_is_error
45+
error: servicegraph_is_error

components/inspectit-ocelot-configdocsgenerator/src/test/resources/ConfigParserTest/configWithPlaceholder.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ inspectit:
55
# if true, the free disk space will be measured and the view "disk/free" is registered
66
free: true
77
definitions:
8-
'[disk/free]':
8+
disk_free:
99
enabled: ${inspectit.metrics.disk.enabled.free}
10-
type: LONG
11-
max-values-per-tag: 5
10+
max-values-per-attribute: 5
1211
unit: bytes
1312
description: free disk space

components/inspectit-ocelot-configschemagenerator/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies {
99
implementation(
1010
project(':inspectit-ocelot-config'),
1111
libs.ioOpentelemetryOpentelemetryApi,
12+
libs.ioOpentelemetryOpentelemetrySdkMetrics,
1213

1314
// We chose this generator, because it has a great feature set and is actively maintained
1415
configServerLibs.comGithubVictoolsJsonschemaGenerator,

components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/ModelAutoCompleterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void pastList() {
4747

4848
List<String> result = completer.getSuggestions(input);
4949

50-
assertThat(result).containsExactlyInAnyOrder("config", "exporters", "instrumentation", "instrumentation-feedback", "logging", "metrics", "plugins", "privacy", "publish-open-telemetry-to-bootstrap", "self-monitoring", "service-name", "tags", "thread-pool-size", "tracing", "agent-commands", "log-preloading");
50+
assertThat(result).containsExactlyInAnyOrder("config", "exporters", "instrumentation", "instrumentation-feedback", "logging", "metrics", "plugins", "privacy", "publish-open-telemetry-to-bootstrap", "self-monitoring", "service-name", "attributes", "thread-pool-size", "tracing", "agent-commands", "log-preloading");
5151
}
5252

5353
@Test
@@ -61,7 +61,7 @@ void endsInWildcard() {
6161

6262
@Test
6363
void endsInEnum() {
64-
List<String> input = Arrays.asList("inspectit", "tracing", "add-common-tags");
64+
List<String> input = Arrays.asList("inspectit", "tracing", "add-common-attributes");
6565

6666
List<String> result = completer.getSuggestions(input);
6767

@@ -74,7 +74,7 @@ void endsInEnum() {
7474

7575
@Test
7676
void propertyIsPresentAndReadMethodIsNull() {
77-
List<String> input = Arrays.asList("inspectit", "instrumentation", "data", "method_duration", "is-tag");
77+
List<String> input = Arrays.asList("inspectit", "instrumentation", "data", "method_duration", "session-storage");
7878

7979
List<String> result = completer.getSuggestions(input);
8080

@@ -152,7 +152,7 @@ public class GetProperties {
152152
void getPropertiesInspectit() {
153153
List<String> result = completer.getProperties(InspectitConfig.class);
154154

155-
assertThat(result).containsExactlyInAnyOrder("config", "env", "exporters", "instrumentation", "instrumentation-feedback", "logging", "metrics", "plugins", "privacy", "publish-open-telemetry-to-bootstrap", "self-monitoring", "service-name", "tags", "thread-pool-size", "tracing", "agent-commands", "log-preloading");
155+
assertThat(result).containsExactlyInAnyOrder("config", "env", "exporters", "instrumentation", "instrumentation-feedback", "logging", "metrics", "plugins", "privacy", "publish-open-telemetry-to-bootstrap", "self-monitoring", "service-name", "attributes", "thread-pool-size", "tracing", "agent-commands", "log-preloading");
156156
}
157157
}
158158
}

0 commit comments

Comments
 (0)