Skip to content

Commit

Permalink
Merge pull request #1255 from smallc2009/add-tag-from-uri
Browse files Browse the repository at this point in the history
add tag and tag_from_uri for opentelemetry input plugin
  • Loading branch information
benjaminhuo authored Jul 24, 2024
2 parents 4f02f21 + 721681a commit 8ecf48b
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 @@ -428,6 +428,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 @@ -428,6 +428,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 @@ -2396,6 +2396,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 @@ -2396,6 +2396,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 8ecf48b

Please sign in to comment.