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

[breaking][pkg/stanza] Pass TelemetrySettings to Build of Builder interface #32662

Merged

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Apr 24, 2024

Description:

This PR resumes the work from #31618.

The goal is to pass in the component.TelemetrySettings so as to use them later in various ways:

  1. report the filelog's state stats: [pkg/stanza] Add monitoring metrics for open and harvested files in fileconsumer #31544
  2. switch from SugaredLogger to Logger: [pkg/stanza] Switch from SugaredLogger to Logger #32177

More about the breaking change decision at #31618 (comment).

Link to tracking Issue: #31256

Testing: Testing suite got updated.

Manual Testing

receivers:
  filelog:
    start_at: end
    include:
    - /var/log/busybox/refactroring_test.log
    operators:
      - id: addon
        type: add
        field: attributes.extra
        value: my-val
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    logs:
      receivers: [filelog]
      exporters: [debug]
      processors: []
  1. ./bin/otelcontribcol_linux_amd64 --config ~/otelcol/config.yaml
  2. echo 'some line' >> /var/log/busybox/refactroring_test.log
2024-04-24T09:29:17.104+0300	info	LogsExporter	{"kind": "exporter", "data_type": "logs", "name": "debug", "resource logs": 1, "log records": 1}
2024-04-24T09:29:17.104+0300	info	ResourceLog #0
Resource SchemaURL: 
ScopeLogs #0
ScopeLogs SchemaURL: 
InstrumentationScope  
LogRecord #0
ObservedTimestamp: 2024-04-24 06:29:17.005433317 +0000 UTC
Timestamp: 1970-01-01 00:00:00 +0000 UTC
SeverityText: 
SeverityNumber: Unspecified(0)
Body: Str(some line)
Attributes:
     -> extra: Str(my-val)
     -> log.file.name: Str(1.log)
Trace ID: 
Span ID: 
Flags: 0
	{"kind": "exporter", "data_type": "logs", "name": "debug"}

Documentation: TBA.

@ChrsMark ChrsMark marked this pull request as ready for review April 24, 2024 09:05
@ChrsMark ChrsMark requested a review from a team April 24, 2024 09:05
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Thanks @ChrsMark. This looks good to me except for the unrelated logger import.

pkg/stanza/go.mod Outdated Show resolved Hide resolved
pkg/stanza/operator/parser/regex/config.go Outdated Show resolved Hide resolved
@ChrsMark ChrsMark force-pushed the pass_telemetry_settings_to_stanza_ops branch 2 times, most recently from e024f86 to a48bad4 Compare April 24, 2024 14:09
…erface

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark force-pushed the pass_telemetry_settings_to_stanza_ops branch from a48bad4 to ffdb8f6 Compare April 24, 2024 14:14
@djaglowski djaglowski merged commit 6cefabc into open-telemetry:main Apr 24, 2024
171 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 24, 2024
@ChrsMark ChrsMark deleted the pass_telemetry_settings_to_stanza_ops branch April 24, 2024 14:56
djaglowski pushed a commit that referenced this pull request Apr 25, 2024
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Telemetry settings in general are passed by value in the project. This
commit aligns the stanza Builder interface with this convention. This
will also ensures that Logger can be overwritten without changing the
original object.
Follow up of
#32662.
cc-ing @djaglowski who pointed that out.

**Link to tracking Issue:** <Issue number if applicable>

**Testing:** <Describe what testing was performed and which tests were
added.> Same as
#32662

**Documentation:** <Describe the documentation added.>

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
djaglowski added a commit that referenced this pull request May 16, 2024
#32662 updated many exported functions to accept
`component.TelemetrySettings` instead of `zap.SugaredLogger`. This PR
continues from there by passing `component.TelemetrySettings` deeper
into the inner packages, and migrates from using `zap.SugaredLogger` to
instead using `zap.Logger` (as provided by
`component.TelemetrySettings`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants