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

in_opentelemetry: support tag_from_uri #8134

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

nokute78
Copy link
Collaborator

@nokute78 nokute78 commented Nov 4, 2023

This patch is to support property tag_from_uri.

Currently, in_otel composes tag from uri.
e.g. v1_metrics, v1_traces or v1_logs.

It may confuse user. #7939

If user set tag_from_uri=false, tag will be the value of property tag.
Default is true to prevent breaking current behavior.

Key Description Default
tag_from_uri If true, tag will be created from uri. e.g. v1_metrics from /v1/metrics . true

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • [N/A] Backport to latest stable release.

Configuration

[INPUT]
    Name opentelemetry
    Tag not_uri
    Tag_from_uri false

[OUTPUT]
    Name stdout
    Match *

Debug/Valgrind output

Use curl like

curl --header "Content-Type: application/json" --request POST --data '{"resourceLogs":[{"resource":{},"scopeLogs":[{"scope":{},"logRecords":[{"timeUnixNano":"1660296023390371588","body":{"stringValue":"{\"message\":\"dummy\"}"},"traceId":"","spanId":""}]}]}]}'   http://0.0.0.0:4318/v1/logs
$ valgrind --leak-check=full bin/fluent-bit -c a.conf 
==10939== Memcheck, a memory error detector
==10939== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==10939== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==10939== Command: bin/fluent-bit -c a.conf
==10939== 
Fluent Bit v2.2.0
* Copyright (C) 2015-2023 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2023/11/04 09:15:32] [ info] [fluent bit] version=2.2.0, commit=99d568b7c1, pid=10939
[2023/11/04 09:15:32] [ info] [storage] ver=1.2.0, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2023/11/04 09:15:32] [ info] [cmetrics] version=0.6.4
[2023/11/04 09:15:32] [ info] [ctraces ] version=0.3.1
[2023/11/04 09:15:32] [ info] [input:opentelemetry:opentelemetry.0] initializing
[2023/11/04 09:15:32] [ info] [input:opentelemetry:opentelemetry.0] storage_strategy='memory' (memory only)
[2023/11/04 09:15:32] [ info] [input:opentelemetry:opentelemetry.0] listening on 0.0.0.0:4318
[2023/11/04 09:15:32] [ info] [output:stdout:stdout.0] worker #0 started
[2023/11/04 09:15:32] [ info] [sp] stream processor started
[0] not_uri: [[1660296023.1698112429, {}], {"log"=>"{"message":"dummy"}"}]
^C[2023/11/04 09:15:35] [engine] caught signal (SIGINT)
[2023/11/04 09:15:35] [ warn] [engine] service will shutdown in max 5 seconds
[2023/11/04 09:15:35] [ info] [engine] service has stopped (0 pending tasks)
[2023/11/04 09:15:35] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2023/11/04 09:15:35] [ info] [output:stdout:stdout.0] thread worker #0 stopped
==10939== 
==10939== HEAP SUMMARY:
==10939==     in use at exit: 0 bytes in 0 blocks
==10939==   total heap usage: 1,605 allocs, 1,605 frees, 1,243,678 bytes allocated
==10939== 
==10939== All heap blocks were freed -- no leaks are possible
==10939== 
==10939== For lists of detected and suppressed errors, rerun with: -s
==10939== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@nokute78
Copy link
Collaborator Author

Doc PR is fluent/fluent-bit-docs#1275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants