-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from tidal/psr4
Reorganize directory structure
- Loading branch information
Showing
96 changed files
with
349 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Aws\Ecs; | ||
|
||
class DataProvider | ||
{ | ||
private const DEFAULT_CGROUP_PATH = '/proc/self/cgroup'; | ||
|
||
/** | ||
* Returns the host name of the container the process is in. | ||
* This would be the os the container is running on, | ||
* i.e. the platform on which it is deployed | ||
*/ | ||
public function getHostName() | ||
{ | ||
return php_uname('n'); | ||
} | ||
|
||
/** | ||
* Get data from the Cgroup file | ||
*/ | ||
public function getCgroupData() | ||
{ | ||
return file(self::DEFAULT_CGROUP_PATH, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Aws\Eks; | ||
|
||
class DataProvider | ||
{ | ||
private const DEFAULT_CGROUP_PATH = '/proc/self/cgroup'; | ||
private const K8S_TOKEN_PATH = '/var/run/secrets/kubernetes.io/serviceaccount/token'; | ||
private const K8S_CERT_PATH = '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'; | ||
|
||
public function getK8sHeader() | ||
{ | ||
$credHeader = file_get_contents(self::K8S_TOKEN_PATH); | ||
|
||
if ($credHeader) { | ||
return 'Bearer' . $credHeader; | ||
} | ||
|
||
//TODO: Add log 'Unable to load K8s client token' | ||
return null; | ||
} | ||
|
||
// Check if there exists a k8s certification file | ||
public function isK8s() | ||
{ | ||
return file_get_contents(self::K8S_CERT_PATH); | ||
} | ||
|
||
public function getCgroupData() | ||
{ | ||
return file(self::DEFAULT_CGROUP_PATH, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); | ||
} | ||
} |
Oops, something went wrong.