Skip to content

Suggestions for PR 44357#1

Merged
florianl merged 6 commits into
florianl:convertPprofileToPproffrom
felixge:review-pr-44357
Dec 19, 2025
Merged

Suggestions for PR 44357#1
florianl merged 6 commits into
florianl:convertPprofileToPproffrom
felixge:review-pr-44357

Conversation

@felixge
Copy link
Copy Markdown

@felixge felixge commented Dec 19, 2025

@florianl florianl merged commit 7faed11 into florianl:convertPprofileToPprof Dec 19, 2025
florianl pushed a commit that referenced this pull request Dec 19, 2025
…-telemetry#43882)

#### Description

Currently `{TraceID,SpanID,ProfileID}` only support byte IDs, however in
open-telemetry#43429
it was brought up that it is difficult to take a string representation
of an ID and directly use that to set a trace ID. This would be for a
hexadecimal string representation comprising 32 bytes. This change
allows the `{TraceID,SpanID,ProfileID}` functions to also work on string
inputs.

In short, the following now works:

```yaml
statements:
  - set(span.trace_id, TraceID("a389023abaa839283293ed323892389d"))
```

#### Link to tracking issue
Fixes
open-telemetry#43429

#### Testing

In addition to the included go tests the following config 


[test-str-trace.yml](https://github.com/user-attachments/files/23217501/test-str-trace.yml)

was used to manually test by invoking `make otelcontribcol &&
./bin/otelcontribcol_darwin_arm64 --config test-str-trace.yml` in one
window and `telemetrygen traces --otlp-insecure --traces 1` in another.
The output is as shown:
<details>
<summary>CLI Output</summary>

```
Span #0
    Trace ID       : a389023abaa839283293ed323892389d
    Parent ID      : e5c516b0c8942eab
    ID             : 1914136d5f9ca838
    Name           : okey-dokey-0
    Kind           : Server
    Start time     : 2025-10-29 18:59:03.312829 +0000 UTC
    End time       : 2025-10-29 18:59:03.312952 +0000 UTC
    Status code    : Unset
    Status message :
Attributes:
     -> network.peer.address: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-client)
Span #1
    Trace ID       : a389023abaa839283293ed323892389d
    Parent ID      :
    ID             : e5c516b0c8942eab
    Name           : lets-go
    Kind           : Client
    Start time     : 2025-10-29 18:59:03.312829 +0000 UTC
    End time       : 2025-10-29 18:59:03.312952 +0000 UTC
    Status code    : Unset
    Status message :
Attributes:
     -> network.peer.address: Str(1.2.3.4)
     -> peer.service: Str(telemetrygen-server)
```

</details>

#### Documentation

I don't currently see documentation for these functions, but I'm new
here, maybe I'm missing something? Glad to update it

---------

Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com>
florianl 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 open-telemetry#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 open-telemetry#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>
florianl pushed a commit that referenced this pull request Apr 17, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Add support timeout setting for telemetrygen 


<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#47203

#### Testing

Sending traces to a collector that has an artificial delay of `10s`
before answering
```
❯ go run . traces --traces 1 --timeout 5s --otlp-insecure
2026-04-01T17:29:31.673+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to READY	{"grpc_log": true}
2026/04/01 17:29:34 traces export: context deadline exceeded: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2026-04-01T17:29:34.980+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to SHUTDOWN	{"grpc_log": true}
```

```
❯ go run . traces --traces 1 --timeout 15s --otlp-insecure
2026-04-01T17:30:42.046+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to READY	{"grpc_log": true}
2026-04-01T17:30:52.052+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to SHUTDOWN	{"grpc_log": true}
```
florianl pushed a commit that referenced this pull request Apr 21, 2026
…arsing in %Z field (open-telemetry#47767)

#### Description
Adds a new optional time_zone_locations field to TimeParser that maps
timezone abbreviations to IANA location names. This allows correct
parsing of log streams that contain timestamps with multiple timezone
abbreviations (e.g. IST, PDT, NZST) in a single operator block.

Changes:


[time.go](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
— added [TimeZoneLocations
map[string]string](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
field (mapstructure: time_zone_locations), resolveLocation() method, and
a validation that rejects time_zone_locations when the layout contains
no %Z/MST directive

[time_test.go](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
— added
[TestTimeZoneLocations](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html),
[TestTimeZoneLocationsErrors](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html),
and
[TestUnmarshalTimeConfig/time_zone_locations](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)

[timestamp.yaml](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
— added time_zone_locations unmarshal fixture

[timestamp.md](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
— documented
[location](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
and time_zone_locations fields; added multi-timezone example

[time_parser.md](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
— added
[location](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
and time_zone_locations to the configuration fields table


#### Link to tracking issue
Fixes
[47594](open-telemetry#47594)

#### Testing
Unit tests added and verified existing and new tests are passing.

**Manual testing:**

**Test log lines used:**
```
Wed Aug 27 15:08:58 IST 2025 Log from India
Wed Aug 20 14:08:48 CST 2025 Log from China
Wed Jul 16 10:00:00 NZST 2025 Log from New Zealand
```

**Without time_zone_locations param added/old behaviour:** 

[collector-config.yaml](https://github.com/user-attachments/files/26901647/collector-config.yaml)



timeout 15 ./otelcol-tz-test/otelcol-tz-test --config
collector-config.yaml 2>&1 | grep -E "LogRecord|Timestamp:|Body:" ||
true
LogRecord #0
ObservedTimestamp: 2026-04-20 14:11:36.028277 +0000 UTC
Timestamp: 2025-08-27 09:38:58 +0000 UTC
Body: Str(Wed Aug 27 15:08:58 IST 2025 Log from India)
LogRecord #1
ObservedTimestamp: 2026-04-20 14:11:36.028279 +0000 UTC
Timestamp: 1970-01-01 00:00:00 +0000 UTC
Body: Str(Wed Aug 20 14:08:48 CST 2025 Log from China)
LogRecord #0
ObservedTimestamp: 2026-04-20 14:11:36.628855 +0000 UTC
Timestamp: 1970-01-01 00:00:00 +0000 UTC
Body: Str(Wed Jul 16 10:00:00 NZST 2025 Log from New Zealand)

NZST and CST are not parsed properly.

**With time_zone_locations param configured:**

[collector-config.yaml](https://github.com/user-attachments/files/26901658/collector-config.yaml)


timeout 15 ./otelcol-tz-test/otelcol-tz-test --config
collector-config.yaml 2>&1 | grep -E "LogRecord|Timestamp:|Body:" ||
true
LogRecord #0
ObservedTimestamp: 2026-04-20 14:12:22.096579 +0000 UTC
Timestamp: 2025-08-27 09:38:58 +0000 UTC
Body: Str(Wed Aug 27 15:08:58 IST 2025 Log from India)
LogRecord #1
ObservedTimestamp: 2026-04-20 14:12:22.096582 +0000 UTC
Timestamp: 2025-08-20 06:08:48 +0000 UTC
Body: Str(Wed Aug 20 14:08:48 CST 2025 Log from China)
LogRecord #0
ObservedTimestamp: 2026-04-20 14:12:22.696974 +0000 UTC
Timestamp: 2025-07-15 22:00:00 +0000 UTC
Body: Str(Wed Jul 16 10:00:00 NZST 2025 Log from New Zealand)

All timezone abbreviations are parsed properly into their respective UTC
times.


#### Documentation
Updated
[timestamp.md](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
and
[time_parser.md](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
to document the new time_zone_locations field and add a multi-timezone
parsing example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants