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

AzureMonitor: Deprecate using separate credentials for Azure Monitor Logs #34758

Merged
merged 3 commits into from May 28, 2021

Conversation

andresmgot
Copy link
Contributor

What this PR does / why we need it:

Remove the switch that allow people to specify different credentials when creating an AzureMonitor data source:

Screenshot from 2021-05-26 17-36-38

To maintain backwards compatibility, if a data source already has different credentials, we still show the switch but with a deprecation notice:

Screenshot from 2021-05-26 17-36-28

Which issue(s) this PR fixes:

Fixes #34621
5th item at #34622

Special notes for your reviewer:

Let me know if you think of a better deprecation text.

cc/ @kostrse

@andresmgot andresmgot requested review from a team and joshhunt and removed request for a team May 26, 2021 15:53
@grafanabot grafanabot added datasource/Azure Azure Monitor Datasource area/frontend labels May 26, 2021
@andresmgot andresmgot added the old backport v8.0.x Mark PR for automatic backport to v8.0.x label May 26, 2021
@andresmgot andresmgot changed the title Hide switch for using different credentials in AzureMonitor AzureMonitor: Deprecate using separate credentials for Logs May 26, 2021
@joshhunt joshhunt self-assigned this May 26, 2021
@andresmgot andresmgot added this to the 8.0.0-beta3 milestone May 26, 2021
Copy link
Contributor

@joshhunt joshhunt left a comment

Choose a reason for hiding this comment

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

Haven't had a chance to test this out yet, but looks great so far (just with two super minor comments)

Comment on lines 154 to 160
{showSameAsHelpMsg && (
<div className="grafana-info-box m-t-2">
<div className="alert-body">
<p>Re-enter your Azure Monitor Client Secret to use this setting.</p>
</div>
</div>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Include this in the condition as well - we don't want to show this if the switch isn't visible.

It might not in practice, but we want to be extra sure 😅

{showLogAnalyticsCreds && logAnalyticsCredentials && (
<>
<Alert severity="info" title="Deprecated">
Using different credentials for Azure Monitor logs is deprecated and will be removed in a future
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalise "Logs".

onChange={onLogAnalyticsSameAsChange}
{...tooltipAttribute}
/>
{showLogAnalyticsCreds && (
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable credentialsEnabled above serves the same purpose - to hide the credentials section when not needed., You can change condition of that variaable instead.

Copy link
Contributor

@kostrse kostrse left a comment

Choose a reason for hiding this comment

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

I would merge the two variables showLogAnalyticsCreds and credentialsEnabled into a one.
Something like this:

const [credentialsUsed] = useState(!!logAnalyticsCredentials);
const credentialsEnabled = credentialsUsed && primaryCredentials.authType === 'clientsecret';

@andresmgot andresmgot requested a review from a team as a code owner May 27, 2021 09:09
@andresmgot
Copy link
Contributor Author

I would merge the two variables showLogAnalyticsCreds and credentialsEnabled into a one.

Liked it! It's more clean now.

BTW @joshhunt I migrated the tests to the @testing-library as suggested offline. That caused the snapshots to be quite different but it should be fine (TBH I'm not a fan of snapshots in any case).

@joshhunt
Copy link
Contributor

Yeah, I wouldn't fuss too much about the snapshot tests 🙄

Copy link
Contributor

@kostrse kostrse left a comment

Choose a reason for hiding this comment

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

🚀

@andresmgot andresmgot merged commit 48dc78f into grafana:main May 28, 2021
@andresmgot andresmgot deleted the az_analytics_creds branch May 28, 2021 08:15
grafanabot pushed a commit that referenced this pull request May 28, 2021
* Hide switch for using different credentials in AzureMonitor

* Apply feedback. Use @testing-library

(cherry picked from commit 48dc78f)
andresmgot added a commit that referenced this pull request May 28, 2021
…34877)

* Hide switch for using different credentials in AzureMonitor

* Apply feedback. Use @testing-library

(cherry picked from commit 48dc78f)

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
@hugohaggmark hugohaggmark changed the title AzureMonitor: Deprecate using separate credentials for Logs AzureMonitor: Deprecate using separate credentials for Azure Monitor Logs Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/frontend datasource/Azure Azure Monitor Datasource old backport v8.0.x Mark PR for automatic backport to v8.0.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AzureMonitor: remove "same as" credentials switch for newly created datasources
4 participants