-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathService.php
More file actions
129 lines (116 loc) · 2.84 KB
/
Service.php
File metadata and controls
129 lines (116 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
declare(strict_types=1);
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
namespace Elastic\Types;
use JsonSerializable;
/**
* Serializes to ECS Trace
*
* @version v1.x
*
* @see https://www.elastic.co/guide/en/ecs/current/ecs-service.html
*
* @author Philip Krauss <philip.krauss@elastic.co>
*/
class Service extends BaseType implements JsonSerializable
{
/**
* @var array
*/
private $data;
/**
* Unique identifier of the running service.
*
* <em>If the service is comprised of many nodes, the service.id should be the same for all nodes.</em>
*
* @internal core
*
* @param mixed: string | int
*/
final public function setId($id)
{
$this->data['id'] = $id;
}
/**
* Ephemeral identifier of this service (if one exists)
*
* <em>This id normally changes across restarts, but service.id does not.</em>
*
* @param mixed: string | int
*/
final public function setEphemeralId(string $ephemeralId)
{
$this->data['ephemeral_id'] = $ephemeralId;
}
/**
* Name of the service data is collected from
*
* @internal core
*
* @param string
*/
final public function setName(string $name)
{
$this->data['name'] = $name;
}
/**
* Name of a service node
*
* <em>
* This allows for two nodes of the same service running on the same host to be differentiated.
* Therefore, service.node.name should typically be unique across nodes of a given service.
* </em>
*
* @param string
*/
final public function setNodeName(string $nodeName)
{
$this->data['node'] = ['name' => $nodeName];
}
/**
* Current state of the service
*
* @internal core
*
* @param string
*/
final public function setState(string $state)
{
$this->data['state'] = $state;
}
/**
* The type of the service data is collected from
*
* <em>The type can be used to group and correlate logs and metrics from one service type.</em>
*
* @internal core
*
* @param string
*/
final public function setType(string $type)
{
$this->data['type'] = $type;
}
/**
* Version of the service the data was collected from
*
* <em>This allows to look at a data set only for a specific version of a service.</em>
*
* @internal core
*
* @param string
*/
final public function setVersion(string $version)
{
$this->data['version'] = $version;
}
/**
* @return array
*/
public function jsonSerialize()
{
return ['service' => $this->data];
}
}