Skip to content

Commit

Permalink
add tag and tag_from_uri for opentelemetry input plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Anson Liu <[email protected]>
  • Loading branch information
smallc2009 committed Jul 23, 2024
1 parent eeb5bfd commit 721681a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/input/open_telemetry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ type OpenTelemetry struct {
BufferChunkSize string `json:"bufferChunkSize,omitempty"`
//It allows to set successful response code. 200, 201 and 204 are supported(default 201).
SuccessfulResponseCode *int32 `json:"successfulResponseCode,omitempty"`
// opentelemetry uses the tag value for incoming metrics.
Tag string `json:"tag,omitempty"`
// If true, tag will be created from uri. e.g. v1_metrics from /v1/metrics
TagFromURI *bool `json:"tagFromURI,omitempty"`
}

func (_ *OpenTelemetry) Name() string {
Expand Down Expand Up @@ -61,5 +65,11 @@ func (ot *OpenTelemetry) Params(_ plugins.SecretLoader) (*params.KVs, error) {
if ot.SuccessfulResponseCode != nil {
kvs.Insert("successful_response_code", fmt.Sprint(*ot.SuccessfulResponseCode))
}
if ot.Tag != "" {
kvs.Insert("tag", ot.Tag)
}
if ot.TagFromURI != nil {
kvs.Insert("tag_from_uri", fmt.Sprint(*ot.TagFromURI))
}
return kvs, nil
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ spec:
and 204 are supported(default 201).
format: int32
type: integer
tag:
description: opentelemetry uses the tag value for incoming metrics.
type: string
tagFromURI:
description: If true, tag will be created from uri. e.g. v1_metrics
from /v1/metrics
type: boolean
tagKey:
description: Specify the key name to overwrite a tag. If set,
the tag will be overwritten by a value of the key.
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ spec:
and 204 are supported(default 201).
format: int32
type: integer
tag:
description: opentelemetry uses the tag value for incoming metrics.
type: string
tagFromURI:
description: If true, tag will be created from uri. e.g. v1_metrics
from /v1/metrics
type: boolean
tagKey:
description: Specify the key name to overwrite a tag. If set,
the tag will be overwritten by a value of the key.
Expand Down
2 changes: 2 additions & 0 deletions docs/plugins/fluentbit/input/open_telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ The OpenTelemetry plugin allows you to ingest telemetry data as per the OTLP spe
| bufferMaxSize | Specify the maximum buffer size in KB to receive a JSON message(default 4M). | string |
| bufferChunkSize | This sets the chunk size for incoming incoming JSON messages. These chunks are then stored/managed in the space available by buffer_max_size(default 512K). | string |
| successfulResponseCode | It allows to set successful response code. 200, 201 and 204 are supported(default 201). | *int32 |
| tag | opentelemetry uses the tag value for incoming metrics. | string |
| tagFromURI | If true, tag will be created from uri. e.g. v1_metrics from /v1/metrics | *bool |
7 changes: 7 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,13 @@ spec:
and 204 are supported(default 201).
format: int32
type: integer
tag:
description: opentelemetry uses the tag value for incoming metrics.
type: string
tagFromURI:
description: If true, tag will be created from uri. e.g. v1_metrics
from /v1/metrics
type: boolean
tagKey:
description: Specify the key name to overwrite a tag. If set,
the tag will be overwritten by a value of the key.
Expand Down
7 changes: 7 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,13 @@ spec:
and 204 are supported(default 201).
format: int32
type: integer
tag:
description: opentelemetry uses the tag value for incoming metrics.
type: string
tagFromURI:
description: If true, tag will be created from uri. e.g. v1_metrics
from /v1/metrics
type: boolean
tagKey:
description: Specify the key name to overwrite a tag. If set,
the tag will be overwritten by a value of the key.
Expand Down

0 comments on commit 721681a

Please sign in to comment.