Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
morriq committed Sep 24, 2018
2 parents dd440a7 + e94e71d commit e2b2fba
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 38 deletions.
112 changes: 103 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,100 @@ services:
build: .
hostname: webapp
ports:
- 8080:80
- 8080:80
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
depends_on:
- consul
- jaeger
- consul
- jaeger
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5


service-vue-client:
build: packages/fragment-vue-client
hostname: service-vue-client
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
depends_on:
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5

service-vue-file-read:
build: packages/fragment-vue-file-read
hostname: service-vue-file-read
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
depends_on:
- consul
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5

service-vue-http:
build: packages/fragment-vue-http
hostname: service-vue-http
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
depends_on:
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5

service-react:
build: packages/fragment-react
hostname: service-react
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
depends_on:
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5

service-dotnet:
build: packages/fragment-dotnet
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
ports:
- 1231:1231
depends_on:
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
timeout: 10s
retries: 5

service-common:
build: packages/fragment-common
hostname: service-common
environment:
- CONSUL_HOST=consul
- TRACING_HOST=jaeger
ports:
- 1234:80
depends_on:
- consul
healthcheck:
test: ["CMD", "curl", "-f", "consul:8500"]
interval: 30s
Expand Down Expand Up @@ -76,3 +147,26 @@ services:
timeout: 10s
retries: 5

# running kibana at http://localhost:5601
kibana:
image: docker.elastic.co/kibana/kibana:6.4.1
ports:
- 5601:5601
depends_on:
- elasticsearch

# running grafana at http://localhost:3000
grafana:
image: grafana/grafana:5.1.0
ports:
- 3000:3000
depends_on:
- elasticsearch

# running prometheus at http://localhost:9090
prometheus:
image: prom/prometheus
ports:
- 9090:9090
depends_on:
- elasticsearch
1 change: 1 addition & 0 deletions packages/fragment-vue-file-read/file-to-read.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
36 changes: 21 additions & 15 deletions packages/fragment-vue-file-read/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const consul = require('consul')
const { readFileSync } = require('fs')
const { initTracer, PrometheusMetricsFactory, ProbabilisticSampler } = require('jaeger-client')
const promClient = require('prom-client')
const bunyan = require('bunyan')
const { Tags, FORMAT_HTTP_HEADERS } = require('opentracing')

const renderStream = require('./render-stream.js')
const { consulAddress, address, hostname, port } = require('./environment.js')

const tracingAddress = 'jaeger'
const serviceName = 'frontend:microservices'

const d = initTracer(
const tracer = initTracer(
{
serviceName,
reporter: {
Expand Down Expand Up @@ -39,26 +41,30 @@ agent.service.register({
'logowanie do spana'
})

module.exports = (request, response, a, b) => {
const { globalTracer, Tags, FORMAT_HTTP_HEADERS } = require('opentracing');
// @todo dlaczego globalTracer nie loguje, tylko musze instancje?
const tracer = globalTracer()
const parentSpanContext = d.extract(
module.exports = (request, response) => {
const file = readFileSync('file-to-read.txt')

response.write(file)

const parentSpanContext = tracer.extract(
FORMAT_HTTP_HEADERS,
request.headers
);
const spanOptions = parentSpanContext ? { childOf: parentSpanContext } : {};
)
const spanOptions = parentSpanContext ? { childOf: parentSpanContext } : {}

const span = d.startSpan('teststata_asdaa', spanOptions);
const span = tracer.startSpan('teststata_asdaa', spanOptions)
span.addTags({
[Tags.HTTP_URL]: 'teateatae',
[Tags.SPAN_KIND]: Tags.SPAN_KIND_RPC_SERVER
});
})

console.log(request.headers)
response.writeHead(200, {
'Content-Type': 'text/html'
})
renderStream().pipe(response)
span.finish();
'Content-Type': 'text/html'
})
renderStream()
.on('error', ({ message, stack }) => {
console.log(message, stack)
})
.pipe(response)
span.finish()
}
3 changes: 0 additions & 3 deletions packages/fragment-vue-file-read/src/app/Recommendations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
</template>

<script>
console.log('poc-vue-test');
export default {
computed: {
gimmeDate() {
Expand Down
7 changes: 5 additions & 2 deletions packages/fragment-vue-http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = async (request, response) => {
'Content-Type': 'text/html'
})

renderStream()
.pipe(response)
renderStream()
.on('error', ({ message, stack }) => {
console.log(message, stack)
})
.pipe(response)
}
3 changes: 0 additions & 3 deletions packages/fragment-vue-http/src/app/Recommendations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
</template>

<script>
console.log('poc-vue-test');
export default {
methods: {
test(id) {
Expand Down
7 changes: 3 additions & 4 deletions packages/fragment-vue-http/src/app/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Vuex from 'vuex';
import axios from 'axios';


Vue.use(Vuex);
Vue.use(Vuex)

export default function createStore() {
return new Vuex.Store({
Expand All @@ -13,16 +13,15 @@ export default function createStore() {
actions: {
fetchItems({ commit }) {
return axios.get('https://jsonplaceholder.typicode.com/comments')
.catch(() => ({data: []}))
.then(({data}) => {
commit('setItems', data)
})
}
},
mutations: {
setItems(state, items) {
state.items = items;
state.items = items
}
}
});
})
}
12 changes: 10 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,23 @@
</head>
<body>
<!--<div class="service" data-title="service-react">-->
<!--<fragment id="service-react"></fragment>-->
<!--<fragment id="service-react"></fragment>-->
<!--</div>-->
<!--<div class="service" data-title="service-vue-client">-->
<!--<fragment id="service-vue-client"></fragment>-->
<!--<fragment id="service-vue-client"></fragment>-->
<!--</div>-->

<div class="service" data-title="service-vue-file-read">
<fragment id="service-vue-file-read"></fragment>
</div>

<div class="service" data-title="service-vue-http">
<fragment id="service-vue-http"></fragment>
</div>

<div class="service" data-title="service-dotnet">
<fragment id="service-dotnet" src="http://service-dotnet:1231"></fragment>
</div>

</body>
</html>

0 comments on commit e2b2fba

Please sign in to comment.