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

feat(websocket_server sink): add simple customizable extra metrics tags for websocket_server #22484

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

esensar
Copy link
Contributor

@esensar esensar commented Feb 20, 2025

Summary

This adds a new configuration option to websocket_server to enable adding additional tags to metrics generated by this component.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Besides the added tests, I have tested Vector with the following config:

sources:
  demo_logs_test:
    type: "demo_logs"
    format: "json"

  mets:
    type: "internal_metrics"

transforms:
  filtered_metrics:
    type: "filter"
    inputs: ["mets"]
    condition: .tags.component_id == "websocket_sink"

sinks:
  websocket_sink:
    inputs: ["demo_logs_test"]
    type: "websocket_server"
    address: "0.0.0.0:1234"
    internal_metrics:
      extra_tags:
        test_extra_tag:
          type: fixed
          value: test_value
        user_auth:
          type: header
          name: Authorization
        client_ip:
          type: ip_address
        full_url:
          type: url
        some_query:
          type: query
          name: last_received
    acknowledgements:
      enabled: false
    encoding:
      codec: "json"

  console:
    inputs: ["filtered_metrics"]
    target: "stdout"
    type: "console"
    acknowledgements:
      enabled: false
    encoding:
      codec: "json"

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Please read our Vector contributor resources.
    • make check-all is a good command to run locally. This check is
      defined here. Some of these
      checks might not be relevant to your PR. For Rust changes, at the very least you should run:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

Sponsored by Quad9

…gs for `websocket_server`

This adds a new configuration option to `websocket_server` to enable adding additional tags to
metrics generated by this component.
@esensar esensar requested review from a team as code owners February 20, 2025 17:35
@github-actions github-actions bot added domain: sinks Anything related to the Vector's sinks domain: external docs Anything related to Vector's external, public documentation labels Feb 20, 2025
@pront pront self-assigned this Feb 20, 2025
Copy link
Contributor

@rtrieu rtrieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback for style consistency.

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
@esensar
Copy link
Contributor Author

esensar commented Feb 20, 2025

Some feedback for style consistency.

Thank you!

@esensar esensar requested a review from rtrieu February 20, 2025 19:59
Copy link
Contributor

@rtrieu rtrieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor feedback.

Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
@esensar esensar requested a review from rtrieu February 21, 2025 08:57
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @esensar

Copy link
Contributor

@rtrieu rtrieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a simple non-breaking suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation domain: sinks Anything related to the Vector's sinks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants