forked from fluent/fluent-bit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that replicate issue in fluent#8734
Signed-off-by: Stewart Webb <[email protected]>
- Loading branch information
1 parent
d675102
commit 8f165e0
Showing
5 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
tests/runtime_shell/conf/in_opentelemetry_tagfromuri_expect.conf
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,38 @@ | ||
[SERVICE] | ||
Flush 1 | ||
Grace 1 | ||
Log_Level error | ||
|
||
[INPUT] | ||
name dummy | ||
samples 1 | ||
|
||
[OUTPUT] | ||
name file | ||
match dummy.* | ||
file ${SIGNAL_FILE_PATH} | ||
mkdir on | ||
|
||
[INPUT] | ||
name opentelemetry | ||
tag_from_uri True | ||
tag target_input | ||
listen ${LISTENER_HOST} | ||
port ${LISTENER_PORT} | ||
|
||
[FILTER] | ||
Name expect | ||
Match target_input | ||
Log_Level debug | ||
|
||
# Use explicit matches on what tag_from_uri should be setting for each | ||
# of the three OpenTelemetry signal types | ||
[OUTPUT] | ||
Name exit | ||
Match v1_logs | ||
[OUTPUT] | ||
Name exit | ||
Match v1_metrics | ||
[OUTPUT] | ||
Name exit | ||
Match v1_traces |
30 changes: 30 additions & 0 deletions
30
tests/runtime_shell/in_opentelemetry_tagfromuri_log_expect.sh
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,30 @@ | ||
#!/bin/sh | ||
|
||
. ${FLB_RUNTIME_SHELL_PATH}/common.sh | ||
|
||
input_generator() { | ||
result=$(wait_for_fluent_bit ${SIGNAL_FILE_PATH}) | ||
|
||
if test "$result" -eq "0" | ||
then | ||
# sample data from https://github.com/open-telemetry/opentelemetry-proto/blob/main/examples/logs.json | ||
curl \ | ||
--header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"my.service"}}]},"scopeLogs":[{"scope":{"name":"my.library","version":"1.0.0","attributes":[{"key":"my.scope.attribute","value":{"stringValue":"somescopeattribute"}}]},"logRecords":[{"timeUnixNano":"1544712660300000000","observedTimeUnixNano":"1544712660300000000","severityNumber":10,"severityText":"Information","traceId":"5B8EFFF798038103D269B633813FC60C","spanId":"EEE19B7EC3C1B174","body":{"stringValue":"Examplelogrecord"},"attributes":[{"key":"string.attribute","value":{"stringValue":"somestring"}},{"key":"boolean.attribute","value":{"boolValue":true}},{"key":"int.attribute","value":{"intValue":"10"}},{"key":"double.attribute","value":{"doubleValue":637.704}},{"key":"array.attribute","value":{"arrayValue":{"values":[{"stringValue":"many"},{"stringValue":"values"}]}}},{"key":"map.attribute","value":{"kvlistValue":{"values":[{"key":"some.map.key","value":{"stringValue":"somevalue"}}]}}}]}]}]}]}' \ | ||
http://${LISTENER_HOST}:${LISTENER_PORT}/v1/logs | ||
fi | ||
} | ||
|
||
test_in_opentelemetry_tagfromuri_log_expect() { | ||
export SIGNAL_FILE_PATH="/tmp/fb_signal_$$" | ||
export LISTENER_HOST=127.0.0.1 | ||
export LISTENER_PORT=4318 | ||
|
||
input_generator & | ||
|
||
$FLB_BIN -c $FLB_RUNTIME_SHELL_CONF/in_opentelemetry_tagfromuri_expect.conf | ||
} | ||
|
||
# The following command launch the unit test | ||
. $FLB_RUNTIME_SHELL_PATH/runtime_shell.env |
30 changes: 30 additions & 0 deletions
30
tests/runtime_shell/in_opentelemetry_tagfromuri_metric_expect.sh
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,30 @@ | ||
#!/bin/sh | ||
|
||
. ${FLB_RUNTIME_SHELL_PATH}/common.sh | ||
|
||
input_generator() { | ||
result=$(wait_for_fluent_bit ${SIGNAL_FILE_PATH}) | ||
|
||
if test "$result" -eq "0" | ||
then | ||
# sample data from https://github.com/open-telemetry/opentelemetry-proto/blob/main/examples/metrics.json | ||
curl \ | ||
--header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"resourceMetrics":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"my.service"}}]},"scopeMetrics":[{"scope":{"name":"my.library","version":"1.0.0","attributes":[{"key":"my.scope.attribute","value":{"stringValue":"somescopeattribute"}}]},"metrics":[{"name":"my.counter","unit":"1","description":"IamaCounter","sum":{"aggregationTemporality":1,"isMonotonic":true,"dataPoints":[{"asDouble":5,"startTimeUnixNano":"1544712660300000000","timeUnixNano":"1544712660300000000","attributes":[{"key":"my.counter.attr","value":{"stringValue":"somevalue"}}]}]}},{"name":"my.gauge","unit":"1","description":"IamaGauge","gauge":{"dataPoints":[{"asDouble":10,"timeUnixNano":"1544712660300000000","attributes":[{"key":"my.gauge.attr","value":{"stringValue":"somevalue"}}]}]}},{"name":"my.histogram","unit":"1","description":"IamaHistogram","histogram":{"aggregationTemporality":1,"dataPoints":[{"startTimeUnixNano":"1544712660300000000","timeUnixNano":"1544712660300000000","count":2,"sum":2,"bucketCounts":[1,1],"explicitBounds":[1],"min":0,"max":2,"attributes":[{"key":"my.histogram.attr","value":{"stringValue":"somevalue"}}]}]}}]}]}]}' \ | ||
http://${LISTENER_HOST}:${LISTENER_PORT}/v1/metrics | ||
fi | ||
} | ||
|
||
test_in_opentelemetry_tagfromuri_metric_expect() { | ||
export SIGNAL_FILE_PATH="/tmp/fb_signal_$$" | ||
export LISTENER_HOST=127.0.0.1 | ||
export LISTENER_PORT=4318 | ||
|
||
input_generator & | ||
|
||
$FLB_BIN -c $FLB_RUNTIME_SHELL_CONF/in_opentelemetry_tagfromuri_expect.conf | ||
} | ||
|
||
# The following command launch the unit test | ||
. $FLB_RUNTIME_SHELL_PATH/runtime_shell.env |
30 changes: 30 additions & 0 deletions
30
tests/runtime_shell/in_opentelemetry_tagfromuri_trace_expect.sh
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,30 @@ | ||
#!/bin/sh | ||
|
||
. ${FLB_RUNTIME_SHELL_PATH}/common.sh | ||
|
||
input_generator() { | ||
result=$(wait_for_fluent_bit ${SIGNAL_FILE_PATH}) | ||
|
||
if test "$result" -eq "0" | ||
then | ||
# sample data from https://github.com/open-telemetry/opentelemetry-proto/blob/main/examples/trace.json | ||
curl \ | ||
--header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"my.service"}}]},"scopeSpans":[{"scope":{"name":"my.library","version":"1.0.0","attributes":[{"key":"my.scope.attribute","value":{"stringValue":"somescopeattribute"}}]},"spans":[{"traceId":"5B8EFFF798038103D269B633813FC60C","spanId":"EEE19B7EC3C1B174","parentSpanId":"EEE19B7EC3C1B173","name":"I'\''maserverspan","startTimeUnixNano":"1544712660000000000","endTimeUnixNano":"1544712661000000000","kind":2,"attributes":[{"key":"my.span.attr","value":{"stringValue":"somevalue"}}]}]}]}]}' \ | ||
http://${LISTENER_HOST}:${LISTENER_PORT}/v1/traces | ||
fi | ||
} | ||
|
||
test_in_opentelemetry_tagfromuri_trace_expect() { | ||
export SIGNAL_FILE_PATH="/tmp/fb_signal_$$" | ||
export LISTENER_HOST=127.0.0.1 | ||
export LISTENER_PORT=4318 | ||
|
||
input_generator & | ||
|
||
$FLB_BIN -c $FLB_RUNTIME_SHELL_CONF/in_opentelemetry_tagfromuri_expect.conf | ||
} | ||
|
||
# The following command launch the unit test | ||
. $FLB_RUNTIME_SHELL_PATH/runtime_shell.env |