Skip to content

Commit

Permalink
Add context graph and mesh uid into stackdriver template (istio#353)
Browse files Browse the repository at this point in the history
* add context graph and mesh uid into sd template

* address comment

* add two more labels to context graph edge
  • Loading branch information
bianpengyuan authored and istio-testing committed Aug 30, 2019
1 parent 582d630 commit 920e822
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
58 changes: 58 additions & 0 deletions istio-telemetry/mixer-telemetry/templates/stackdriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ spec:
logInfo:
server-accesslog-stackdriver.instance.{{ .Release.Namespace }}:
labelNames:
- mesh_uid
- source_uid
- source_ip
- source_app
Expand Down Expand Up @@ -148,6 +149,7 @@ spec:
- referer
server-tcp-accesslog-stackdriver.instance.{{ .Release.Namespace }}:
labelNames:
- mesh_uid
- connection_id
- connection_event
- source_uid
Expand Down Expand Up @@ -259,6 +261,7 @@ spec:
params:
value: "1"
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -298,6 +301,7 @@ spec:
params:
value: "1"
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -336,6 +340,7 @@ spec:
params:
value: request.total_size
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -375,6 +380,7 @@ spec:
params:
value: request.total_size
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -413,6 +419,7 @@ spec:
params:
value: response.total_size
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -452,6 +459,7 @@ spec:
params:
value: response.total_size
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -490,6 +498,7 @@ spec:
params:
value: response.duration
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -529,6 +538,7 @@ spec:
params:
value: response.duration
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -567,6 +577,7 @@ spec:
params:
value: connection.received.bytes | 0
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -602,6 +613,7 @@ spec:
params:
value: connection.received.bytes | 0
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -636,6 +648,7 @@ spec:
params:
value: connection.sent.bytes | 0
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -671,6 +684,7 @@ spec:
params:
value: connection.sent.bytes | 0
dimensions:
mesh_uid: '"{{ .Values.global.meshID }}"'
destination_service_name: destination.service.name | "unknown"
destination_service_namespace: destination.service.namespace | "unknown"
destination_port: destination.port | 0
Expand Down Expand Up @@ -706,6 +720,7 @@ spec:
severity: '"Info"'
timestamp: request.time
variables:
mesh_uid: '"{{ .Values.global.meshID }}"'
source_uid: source.uid | ""
source_ip: source.ip | ip("0.0.0.0")
source_app: source.labels["app"] | ""
Expand Down Expand Up @@ -765,6 +780,7 @@ spec:
severity: '"Info"'
timestamp: context.time | timestamp("2017-01-01T00:00:00Z")
variables:
mesh_uid: '"{{ .Values.global.meshID }}"'
source_uid: source.uid | ""
connection_id: connection.id | ""
connection_event: connection.event | ""
Expand Down Expand Up @@ -886,4 +902,46 @@ spec:
instances:
- stackdriver-span
{{- end }}
---
{{- if .Values.mixer.adapters.stackdriver.contextGraph.enabled }}
apiVersion: "config.istio.io/v1alpha2"
kind: instance
metadata:
name: stackdriver-edge
namespace: {{ .Release.Namespace }}
labels:
app: istio-telemetry
release: {{ .Release.Name }}
spec:
compiledTemplate: edge
params:
timestamp: request.time | context.time | timestamp("2017-01-01T00:00:00Z")
sourceUid: source.uid | "Unknown"
sourceOwner: source.owner | "Unknown"
sourceWorkloadName: source.workload.name | "Unknown"
sourceWorkloadNamespace: source.workload.namespace | "Unknown"
destinationUid: destination.uid | "Unknown"
destinationOwner: destination.owner | "Unknown"
destinationWorkloadName: destination.workload.name | "Unknown"
destinationWorkloadNamespace: destination.workload.namespace | "Unknown"
contextProtocol: context.protocol | "Unknown"
apiProtocol: api.protocol | "Unknown"
destinationServiceName: destination.service.name | "Unknown"
destinationServiceNamespace: destination.service.namespace | "Unknown"
---
apiVersion: "config.istio.io/v1alpha2"
kind: rule
metadata:
name: stackdriver-edge
namespace: {{ .Release.Namespace }}
labels:
app: istio-telemetry
release: {{ .Release.Name }}
spec:
match: (context.reporter.kind | "inbound" == "inbound") && (context.protocol | "unknown" != "unknown")
actions:
- handler: stackdriver
instances:
- stackdriver-edge
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions istio-telemetry/mixer-telemetry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ mixer:
enabled: false
sampleProbability: 1

contextGraph:
enabled: false

# Setting this to false sets the useAdapterCRDs mixer startup argument to false
useAdapterCRDs: false

Expand Down

0 comments on commit 920e822

Please sign in to comment.