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

Require telemetry for API calls #441

Merged
merged 1 commit into from
Apr 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions lib/WP_Auth0_Api_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,21 @@ public static function validate_user_token( $app_token ) {
return true;
}

/**
* Get required telemetry header
*
* @return array
*/
public static function get_info_headers() {
global $wp_version;

$a0_options = WP_Auth0_Options::Instance();

if ( $a0_options->get( 'metrics' ) != 1 ) {
return array();
}

return array(
'Auth0-Client' => base64_encode( wp_json_encode( array(
'name' => 'wp-auth0',
'version' => WPA0_VERSION,
'environment' => array(
'PHP' => phpversion(),
'WordPress' => $wp_version,
)
) ) )
$header_value = array(
'name' => 'wp-auth0',
'version' => WPA0_VERSION,
'environment' => array(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we support a non-plain object (this environment dictionary). Looking at the previous implementation it seems we do, but may be worth checking if this is easy to query later on the BI app.

'PHP' => phpversion(),
'WordPress' => get_bloginfo('version'),
),
);
return array( 'Auth0-Client' => base64_encode( wp_json_encode( $header_value ) ) );
}

/**
Expand Down