Postgres stored procedure stats#2
Closed
cjksplunk wants to merge 24 commits into
Closed
Conversation
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
# Conflicts: # receiver/postgresqlreceiver/client.go # receiver/postgresqlreceiver/scraper.go # receiver/postgresqlreceiver/scraper_test.go
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
|
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
cjksplunk
pushed a commit
that referenced
this pull request
Feb 24, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Add `Base64Encode` OTTL converter function to encode strings into base64 format with support for multiple variants (`base64`, `base64-raw`, `base64-url`, `base64-raw-url`). This function addresses the need to handle characters not allowed by certain exporters like NATS Core. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#46071 <!--Describe what testing was performed and which tests were added.--> #### Testing Tested manually and added unit and e2e tests. Test config: ```yaml processors: transform: log_statements: - context: log statements: - set(attributes["encoded_default"], Base64Encode(attributes["plain_text"])) - set(attributes["encoded_base64_raw"], Base64Encode(attributes["plain_text"], "base64-raw")) - set(attributes["encoded_base64_url"], Base64Encode(attributes["plain_text"], "base64-url")) - set(attributes["encoded_base64_raw_url"], Base64Encode(attributes["plain_text"], "base64-raw-url")) ``` Test input: ```json {"plain_text": "test string"} {"plain_text": "hello world"} {"plain_text": "special chars: @#$%"} {"plain_text": "URL encoding test: https://example.com?param=value&other=123"} ``` Test result: ``` LogRecord #0 Body: Str({"plain_text": "test string"}) Attributes: -> log.file.name: Str(test_data.log) -> plain_text: Str(test string) -> encoded_default: Str(dGVzdCBzdHJpbmc=) -> encoded_base64_raw: Str(dGVzdCBzdHJpbmc) -> encoded_base64_url: Str(dGVzdCBzdHJpbmc=) -> encoded_base64_raw_url: Str(dGVzdCBzdHJpbmc) LogRecord #1 Body: Str({"plain_text": "hello world"}) Attributes: -> log.file.name: Str(test_data.log) -> plain_text: Str(hello world) -> encoded_default: Str(aGVsbG8gd29ybGQ=) -> encoded_base64_raw: Str(aGVsbG8gd29ybGQ) -> encoded_base64_url: Str(aGVsbG8gd29ybGQ=) -> encoded_base64_raw_url: Str(aGVsbG8gd29ybGQ) LogRecord #2 Body: Str({"plain_text": "special chars: @#$%"}) Attributes: -> log.file.name: Str(test_data.log) -> plain_text: Str(special chars: @#$%) -> encoded_default: Str(c3BlY2lhbCBjaGFyczogQCMkJQ==) -> encoded_base64_raw: Str(c3BlY2lhbCBjaGFyczogQCMkJQ) -> encoded_base64_url: Str(c3BlY2lhbCBjaGFyczogQCMkJQ==) -> encoded_base64_raw_url: Str(c3BlY2lhbCBjaGFyczogQCMkJQ) LogRecord #3 Body: Str({"plain_text": "URL encoding test: https://example.com?param=value&other=123"}) Attributes: -> log.file.name: Str(test_data.log) -> plain_text: Str(URL encoding test: https://example.com?param=value&other=123) -> encoded_default: Str(VVJMIGVuY29kaW5nIHRlc3Q6IGh0dHBzOi8vZXhhbXBsZS5jb20/cGFyYW09dmFsdWUmb3RoZXI9MTIz) -> encoded_base64_raw: Str(VVJMIGVuY29kaW5nIHRlc3Q6IGh0dHBzOi8vZXhhbXBsZS5jb20/cGFyYW09dmFsdWUmb3RoZXI9MTIz) -> encoded_base64_url: Str(VVJMIGVuY29kaW5nIHRlc3Q6IGh0dHBzOi8vZXhhbXBsZS5jb20_cGFyYW09dmFsdWUmb3RoZXI9MTIz) -> encoded_base64_raw_url: Str(VVJMIGVuY29kaW5nIHRlc3Q6IGh0dHBzOi8vZXhhbXBsZS5jb20_cGFyYW09dmFsdWUmb3RoZXI9MTIz) ``` <!--Describe the documentation added.--> #### Documentation Updated `README.md` with function documentation, usage examples, and supported variants. <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com>
cjksplunk
pushed a commit
that referenced
this pull request
Apr 17, 2026
…pen-telemetry#45518) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The `extract_percentile_metric` function creates a new Gauge metric from a Histogram or ExponentialHistogram by calculating the specified percentile value from the bucket counts. A metric will only be created if there is at least one data point. `percentile` is a float64 value between 0 and 100 representing the desired percentile to extract (e.g., 50 for median, 95 for p95, 99 for p99). `suffix` is an optional string that defines the suffix for the metric name. By default, it is set to `_p{percentile}` (e.g., `_p50`, `_p95`, `_p99`). <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Closes open-telemetry#44316 <!--Describe what testing was performed and which tests were added.--> #### Testing Included unit tests and tested manually with this configuration: ``` yaml receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 exporters: debug: verbosity: detailed sampling_initial: 10000 sampling_thereafter: 10000 processors: transform: error_mode: ignore metric_statements: - context: metric statements: - extract_percentile_metric(50.0) - extract_percentile_metric(95.0) - extract_percentile_metric(99.0, "_p99_custom") service: telemetry: metrics: level: none pipelines: metrics: receivers: [otlp] processors: [transform] exporters: - debug ``` tested with `telemetrygen` tool with params to generate regular histogram metrics: ``` ./bin/telemetrygen_darwin_arm64 metrics \ ok | 14:34:29 --otlp-insecure \ --otlp-endpoint localhost:4317 \ --metrics 1 \ --otlp-attributes 'service.name="histogram-service"' \ --metric-type Histogram \ --otlp-metric-name "http.server.duration" ``` Obtained output: ``` Metric #1 Descriptor: -> Name: http.server.duration_p50 -> Description: (p50) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:34:29.409727 +0000 UTC Timestamp: 2026-01-20 13:34:29.409727 +0000 UTC Value: 137.500000 Metric #2 Descriptor: -> Name: http.server.duration_p95 -> Description: (p95) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:34:29.409727 +0000 UTC Timestamp: 2026-01-20 13:34:29.409727 +0000 UTC Value: 750.000000 Metric #3 Descriptor: -> Name: http.server.duration_p99_custom -> Description: (p99) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:34:29.409727 +0000 UTC Timestamp: 2026-01-20 13:34:29.409727 +0000 UTC Value: 750.000000 # p99 is placed in last bucket which is [bucket_lower_bound, + Inf ]. Cannot interpolate with Inf values so it is necessary to use lowerbound (750) ``` Tested with Exponential histogram as well: ``` ./bin/telemetrygen_darwin_arm64 metrics \ ok | 14:42:11 --otlp-insecure \ --otlp-endpoint localhost:4317 \ --metrics 1 \ --otlp-attributes 'service.name="histogram-service"' \ --metric-type ExponentialHistogram \ --otlp-metric-name "http.server.duration" ``` and got the output: ``` Metric #1 Descriptor: -> Name: http.server.duration_p50 -> Description: (p50) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:42:11.599314 +0000 UTC Timestamp: 2026-01-20 13:42:11.599315 +0000 UTC Value: 545.301038 Metric #2 Descriptor: -> Name: http.server.duration_p95 -> Description: (p95) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:42:11.599314 +0000 UTC Timestamp: 2026-01-20 13:42:11.599315 +0000 UTC Value: 961.465253 Metric #3 Descriptor: -> Name: http.server.duration_p99_custom -> Description: (p99) -> Unit: -> DataType: Gauge NumberDataPoints #0 StartTimestamp: 2026-01-20 13:42:11.599314 +0000 UTC Timestamp: 2026-01-20 13:42:11.599315 +0000 UTC Value: 1024.000000 ``` <!--Describe the documentation added.--> #### Documentation Added proper documentation to transform processor `README.md`. <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inital PR for internal review