Skip to content

Conversation

jcantrill
Copy link
Contributor

@jcantrill jcantrill commented Nov 14, 2023

Description

This PR:

  • Moves metrics and throttle templates to separate files
  • Moves metrics templates to output package since that is what it is
  • Refactors TLS Options logic into separate helper function
  • Refactors Secret retrieval into helper function

Links

cc @syedriko @cahartma

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 14, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 14, 2023

@jcantrill: This pull request references LOG-4812 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.8.0" version, but no target version was set.

In response to this:

Description

This PR:

  • Moves metrics and throttle templates to separate files
  • Moves metrics templates to output package since that is what it is
  • Refactors TLS Options logic into separate helper function
  • Refactors Secret retrieval into helper function

Links

cc @syedriko @cahartma

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jcantrill jcantrill added release/5.9 and removed jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Nov 14, 2023
@openshift-ci openshift-ci bot requested review from vimalk78 and vparfonov November 14, 2023 20:44
Copy link
Contributor

openshift-ci bot commented Nov 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2023
op[framework.MinTLSVersion] = outMinTlsVersion
op[framework.Ciphers] = outCiphers
}
}
Copy link
Contributor

@syedriko syedriko Nov 14, 2023

Choose a reason for hiding this comment

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

How 'bout

func SetTLSProfileOptions(o logging.OutputSpec, op framework.Options) {
    op[framework.MinTLSVersion], op[framework.Ciphers] = func()(string, string) {
        if o.Name == logging.OutputNameDefault && o.Type == logging.OutputTypeElasticsearch {
            return "", ""
        } else {
            return op.TLSProfileInfo(o, ",")
        }
    }()
}

)

var (
SinkTransformThrottle = "sink_throttle"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not used outside of package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code to remove vars

return NewThrottleForSink(id, spec, inputs)
}

func NewThrottleForSink(id string, spec *logging.OutputSpec, inputs []string) []framework.Element {
Copy link
Contributor

@syedriko syedriko Nov 14, 2023

Choose a reason for hiding this comment

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

Not used outside of package either

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to 'normalize' and made more generic

PrometheusExporterListenPort = `24231`
AddNodenameToMetricTransformName = "add_nodename_to_metric"
InternalMetricsSourceName = "internal_metrics"
PrometheusOutputSinkName = "prometheus_output"
Copy link
Contributor

@syedriko syedriko Nov 14, 2023

Choose a reason for hiding this comment

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

The Prometheus* consts should've gone to the metrics package it seems

@jcantrill
Copy link
Contributor Author

/retest

@syedriko
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2023
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2023

UserDefinedInput = fmt.Sprintf("%s.%%s", RouteApplicationLogs)
UserDefinedSourceThrottle = fmt.Sprintf("%s_%%s", SourceTransformThrottle)
UserDefinedSourceThrottle = `source_throttle_%s`
Copy link
Contributor

Choose a reason for hiding this comment

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

UserDefinedSourceThrottle and perContainerLimitKeyField look like consts

{{end}}`
}

type AddNodenameToMetric struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

AddNodeNameToMetric is only used in one place, together with the PrometheusOutput, may be we could just inline it into func (p PrometheusExporter) Template() string { and remove all the AddNodenameToMetric code?

Copy link
Contributor

Choose a reason for hiding this comment

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

And even merge internal_metrics into that same template ^^^?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds like a future refactoring

@jcantrill
Copy link
Contributor Author

/test functional-target

@syedriko
Copy link
Contributor

/test functional
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2023
Copy link
Contributor

openshift-ci bot commented Nov 16, 2023

@jcantrill: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit c4edcab into openshift:master Nov 16, 2023
@jcantrill jcantrill deleted the log4812 branch November 16, 2023 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release/5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants