Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use splunk-otel-js as Docker image for node.js auto-instrumentation #965

Merged
merged 8 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .chloggen/adopt-splunk-otel-js.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, networkExplorer, operator, chart, other)
component: operator
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: use splunk-otel-js as Docker image for node.js auto-instrumentation
# One or more tracking issues related to the change
issues: [967]
# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
# Add languages that require version updates here
language: ['java']
language: ['java', 'nodejs']
steps:
- uses: actions/checkout@v4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ spec:
- name: OTEL_RESOURCE_ATTRIBUTES
value: splunk.zc.method=splunk-otel-java:v1.28.0
nodejs:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:0.41.1
image: ghcr.io/signalfx/splunk-otel-js/splunk-otel-js:v2.4.4
env:
- name: OTEL_RESOURCE_ATTRIBUTES
value: splunk.zc.method=autoinstrumentation-nodejs:0.41.1
value: splunk.zc.method=splunk-otel-js:v2.4.4
python:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.40b0
env:
Expand Down
87 changes: 50 additions & 37 deletions functional_tests/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func testNodeJSTraces(t *testing.T) {
ignoreStartTimestamp(expectedTraces)
ignoreEndTimestamp(expectedTraces)

require.NoError(t, ptracetest.CompareTraces(expectedTraces, latestTrace,
err = ptracetest.CompareTraces(expectedTraces, latestTrace,
ptracetest.IgnoreResourceAttributeValue("process.pid"),
ptracetest.IgnoreResourceAttributeValue("container.id"),
ptracetest.IgnoreResourceAttributeValue("k8s.deployment.name"),
Expand All @@ -304,7 +304,14 @@ func testNodeJSTraces(t *testing.T) {
ptracetest.IgnoreResourceAttributeValue("host.arch"),
ptracetest.IgnoreResourceSpansOrder(),
ptracetest.IgnoreScopeSpansOrder(),
))
)
if err != nil {
internal.WriteTraces(t, filepath.Join("testdata", "actual_traces.yaml"), latestTrace)
b, _ := os.ReadFile(filepath.Join("testdata", "actual_traces.yaml"))
fmt.Println(string(b))
}

require.NoError(t, err)
}

func ignoreStartTimestamp(traces ptrace.Traces) {
Expand Down Expand Up @@ -455,42 +462,48 @@ func testK8sClusterReceiverMetrics(t *testing.T) {

metricNames := []string{"k8s.node.condition_ready", "k8s.namespace.phase", "k8s.pod.phase", "k8s.replicaset.desired", "k8s.replicaset.available", "k8s.daemonset.ready_nodes", "k8s.daemonset.misscheduled_nodes", "k8s.daemonset.desired_scheduled_nodes", "k8s.daemonset.current_scheduled_nodes", "k8s.container.ready", "k8s.container.memory_request", "k8s.container.memory_limit", "k8s.container.cpu_request", "k8s.container.cpu_limit", "k8s.deployment.desired", "k8s.deployment.available", "k8s.container.restarts", "k8s.container.cpu_request", "k8s.container.memory_request", "k8s.container.memory_limit"}

require.NoError(t,
pmetrictest.CompareMetrics(expectedMetrics, *selected,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricAttributeValue("container.id", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.daemonset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.deployment.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.namespace.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("container.image.tag", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.node.uid", metricNames...),
pmetrictest.IgnoreMetricValues(metricNames...),
pmetrictest.ChangeResourceAttributeValue("k8s.deployment.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.pod.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.replicaset.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.deployment.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.pod.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.replicaset.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.id", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.image.tag", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.node.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.namespace.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.daemonset.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.image.name", containerImageShorten),
pmetrictest.ChangeResourceAttributeValue("container.id", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("host.name", replaceWithStar),
pmetrictest.IgnoreScopeVersion(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreScopeMetricsOrder(),
pmetrictest.IgnoreMetricDataPointsOrder(),
),
err = pmetrictest.CompareMetrics(expectedMetrics, *selected,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricAttributeValue("container.id", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.daemonset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.deployment.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.namespace.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("container.image.tag", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.node.uid", metricNames...),
pmetrictest.IgnoreMetricValues(metricNames...),
pmetrictest.ChangeResourceAttributeValue("k8s.deployment.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.pod.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.replicaset.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.deployment.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.pod.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.replicaset.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.id", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.image.tag", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.node.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.namespace.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.daemonset.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.image.name", containerImageShorten),
pmetrictest.ChangeResourceAttributeValue("container.id", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("host.name", replaceWithStar),
pmetrictest.IgnoreScopeVersion(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreScopeMetricsOrder(),
pmetrictest.IgnoreMetricDataPointsOrder(),
)

if err != nil {
internal.WriteMetrics(t, filepath.Join("testdata", "actual_cluster_receiver.yaml"), *selected)
b, _ := os.ReadFile(filepath.Join("testdata", "actual_cluster_receiver.yaml"))
fmt.Println(string(b))
}

require.NoError(t, err)
}

func testAgentLogs(t *testing.T) {
Expand Down
Loading
Loading